.puzzle-page{max-width:1000px;margin:auto;padding:48px 28px 65px;display:grid;grid-template-columns:1fr 420px;gap:65px;align-items:start}.puzzle-intro{padding-top:75px}.puzzle-intro .back-link{display:inline-block;margin-bottom:48px}.puzzle-intro h1{font:normal 64px/1.1 Fell,Georgia,serif;margin:15px 0}.puzzle-intro>p{font-size:22px;color:var(--muted)}.puzzle-intro .puzzle-description{font-size:16px;line-height:1.6;margin-top:30px;max-width:260px}.puzzle-tools{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px;font-size:14px}.puzzle-tools button,.puzzle-tray-nav button{background:#eeeae2;padding:11px 18px;border-radius:16px;color:#806e57;font:inherit}.puzzle-tools button[aria-pressed=true]{background:#c46f80;color:white}#puzzle-board{position:relative;width:min(100%,360px);aspect-ratio:3/4;margin:auto;background:#e9decb;border-radius:5px;box-shadow:0 0 0 9px #f1e9da,0 8px 28px #45372416;isolation:isolate}.puzzle-full{position:absolute;inset:0;width:100%;height:100%;opacity:0;transition:opacity .3s;pointer-events:none;border-radius:5px}.previewing .puzzle-full,.finished .puzzle-full{opacity:1}.previewing #puzzle-slots{opacity:.18}.finished #puzzle-slots{opacity:0;pointer-events:none}#puzzle-slots{position:absolute;inset:0;transition:opacity .4s}.puzzle-slot{position:absolute;width:33.3333%;height:25%;padding:0;background:none;border:0;border-radius:0}.puzzle-slot svg{position:absolute;width:140%;height:140%;left:-20%;top:-20%;pointer-events:none}.puzzle-slot:focus-visible{outline:3px solid #c46f80;outline-offset:-4px;z-index:2}.puzzle-slot.placed{pointer-events:none}.puzzle-slot.placed svg{filter:drop-shadow(0 1px 1px #42312330)}#puzzle-tray{display:flex;gap:10px;overflow-x:auto;padding:12px 4px 15px;scroll-behavior:smooth;overscroll-behavior-x:contain;scrollbar-width:thin}.puzzle-piece{flex:none;width:105px;height:105px;border:2px solid transparent;padding:0;border-radius:16px;background:#eee8dd;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}.puzzle-piece[aria-pressed=true]{border-color:#c46f80;background:#ecdce0}.puzzle-piece svg{width:100%;height:100%;pointer-events:none;filter:drop-shadow(0 2px 2px #42312344)}.puzzle-ghost{position:fixed;pointer-events:none;z-index:1000;filter:drop-shadow(0 8px 7px #42312344);transform:translate(-50%,-50%)}.puzzle-ghost svg{width:100%;height:100%}.puzzle-tray-nav{display:flex;justify-content:space-between;gap:10px;font-size:11px}.puzzle-tray-nav button{padding:8px 12px}#puzzle-status{font-size:12px;text-align:center;color:var(--muted);margin:22px 0 0;min-height:32px;line-height:1.45}#puzzle-save{font-size:11px;color:var(--muted);text-align:center;margin-top:18px}#puzzle-complete{text-align:center;margin-top:22px}#puzzle-complete h2{font:normal 32px Fell,Georgia,serif}#puzzle-complete p{font-size:14px;margin:12px 0 22px}.puzzle-end-actions{display:flex;align-items:center;justify-content:center;gap:25px}.puzzle-end-actions button{font-size:14px}.puzzle-piece:focus-visible{outline:3px solid #c46f80}.puzzle-game [hidden]{display:none!important}
@media(max-width:700px){.puzzle-page{display:block;padding:20px 24px 40px;max-width:430px}.puzzle-intro{padding:0}.puzzle-intro .back-link{font-size:12px;margin-bottom:22px}.puzzle-intro h1{font-size:38px;margin:7px 0}.puzzle-intro>p{font-size:16px}.puzzle-intro .eyebrow{font-size:9px}.puzzle-intro .puzzle-description{display:none}.puzzle-game{margin-top:22px}#puzzle-board{width:min(100%,calc((100svh - 310px)*.75));min-width:210px}.puzzle-piece{width:88px;height:88px}.puzzle-tools{margin-bottom:16px}body:has(.puzzle-page) .site-header,body:has(.puzzle-page) .site-footer{display:none}#puzzle-status{margin-top:17px}}
@media(prefers-reduced-motion:reduce){.puzzle-full,#puzzle-slots{transition:none}#puzzle-tray{scroll-behavior:auto}}
/* Outer edges are flat; clip only transparent SVG margins at the board boundary. */
#puzzle-board{overflow:hidden}
/* Match the app collection header: centred title and circular close control. */
.puzzle-page{display:block;max-width:480px;padding-top:24px}.puzzle-app-header{display:grid;grid-template-columns:44px 1fr 44px;align-items:start;text-align:center;gap:8px;padding:0;margin-bottom:26px}.puzzle-app-header h1{font:36px/1.1 Fell,Georgia,serif;margin:7px 0 6px;min-height:40px}.puzzle-app-header p{font:12px/1.5 var(--app-copy-font);color:#8b7c66;margin:0}.puzzle-close{display:grid;place-items:center;width:44px;height:44px;background:#ffffff9c;border-radius:50%;font:30px/1 sans-serif;color:#78634c;text-decoration:none}.puzzle-close:focus-visible{outline:3px solid #c46f80;outline-offset:3px}.previewing:not(.finished) .puzzle-full{filter:grayscale(1)}.finished .puzzle-full{filter:none}.previewing #puzzle-slots{opacity:1}.previewing .puzzle-slot:not(.placed) svg{opacity:.15}.puzzle-game{margin-top:0}
@media(max-width:700px){.puzzle-page{padding-top:24px;max-width:430px}.puzzle-app-header{margin-bottom:22px}.puzzle-app-header h1{font-size:36px}.puzzle-app-header p{font-size:12px}}
/* A continuous shelf for the 73 book puzzles. */
#puzzle-books{display:flex;gap:10px;overflow-x:auto;padding:4px 2px 12px;overscroll-behavior-x:contain;scrollbar-width:thin;margin:0 -4px;scroll-snap-type:x proximity}.puzzle-book{flex:0 0 76px;min-width:0;text-align:center;padding:0;color:#806e57;scroll-snap-align:start;font:11px/1.3 var(--app-copy-font)}.puzzle-book-art{display:grid;place-items:center;width:66px;height:78px;margin:0 auto 7px;border-radius:10px;background:#e9e3d7;border:2px solid transparent;overflow:hidden}.puzzle-book-art img{width:100%;height:100%;object-fit:cover}.puzzle-book>span:not(.puzzle-book-art){display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.puzzle-book small{display:block;font-size:9px;margin-top:3px;color:#9d8f7c}.puzzle-book.current .puzzle-book-art{border-color:#c46f80;box-shadow:0 0 0 2px #c46f8020}.puzzle-book.solved small{color:#456453}.puzzle-lock{width:18px;height:15px;border:2px solid #a3947d;border-radius:4px;position:relative;margin-top:8px}.puzzle-lock:before{content:'';position:absolute;width:10px;height:10px;border:2px solid #a3947d;border-bottom:0;border-radius:8px 8px 0 0;left:2px;top:-11px}.puzzle-lock:after{content:'';position:absolute;width:3px;height:5px;border-radius:2px;background:#a3947d;top:4px;left:6px}#puzzle-book-status{font-size:11px;line-height:1.4;color:#806e57;margin:5px 0 14px;min-height:0}#puzzle-book-status:empty{margin:0 0 18px}.puzzle-book:focus-visible{outline:2px solid #c46f80;outline-offset:2px;border-radius:10px}
/* White seams remain readable over the grayscale preview. */
.puzzle-book-art{position:relative}.puzzle-book-art img+.puzzle-lock{position:absolute;background:#f5f0e6;box-shadow:0 0 0 10px #f5f0e6d9}.puzzle-book[aria-disabled=true] .puzzle-book-art img{filter:grayscale(1);opacity:.3}
.previewing .puzzle-slot:not(.placed) svg{opacity:1}.previewing .puzzle-slot:not(.placed) svg>path:first-of-type{fill:transparent}.previewing .puzzle-slot svg>path:last-child{stroke:#fff;stroke-width:1.7;filter:drop-shadow(0 1px 1px #42312355)}
@media(max-width:700px){.puzzle-app-header{margin-bottom:16px}#puzzle-board{width:min(100%,calc((100svh - 420px)*.75));min-width:195px}.puzzle-book-art{width:56px;height:63px}.puzzle-book{flex-basis:66px}#puzzle-books{gap:8px}}
/* Full-height game: only the book shelf and piece tray scroll horizontally. */
html:has(.puzzle-page),body:has(.puzzle-page){height:100%;overflow:hidden;overscroll-behavior:none}
body:has(.puzzle-page) .site-header,body:has(.puzzle-page) .site-footer{display:none}
.puzzle-page{box-sizing:border-box;height:100svh;max-width:480px;padding:16px 22px max(12px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:0;overflow:hidden}
.puzzle-app-header{flex:none;margin-bottom:12px}.puzzle-app-header h1{font-size:32px;min-height:35px;margin:3px 0 4px}
#puzzle-books{flex:none;min-height:92px;padding-bottom:8px;margin-bottom:12px;scrollbar-width:none}
#puzzle-books::-webkit-scrollbar,#puzzle-tray::-webkit-scrollbar{display:none}
.puzzle-book-art{width:56px;height:63px}.puzzle-book{flex-basis:66px}.puzzle-game{flex:1;min-height:0;display:flex;flex-direction:column;align-items:stretch;justify-content:space-between;gap:14px}
#puzzle-board{flex:none;width:min(100%,calc((100svh - 292px)*.75));min-width:0;margin:6px auto 0;max-height:none}
#puzzle-tray{flex:none;min-height:90px;padding:4px 0;scrollbar-width:none}.puzzle-piece{width:82px;height:82px}
#puzzle-preview{position:absolute;right:8px;top:8px;z-index:5;width:42px;height:42px;display:grid;place-items:center;padding:10px;border:1px solid #ffffffa6;border-radius:50%;background:#faf6eddc;color:#5d4934;box-shadow:0 2px 8px #352b2822;cursor:pointer}
#puzzle-preview svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
#puzzle-preview .eye-slash{display:none}#puzzle-preview[aria-pressed=true] .eye-slash{display:block}#puzzle-preview[aria-pressed=true]{background:#ead6dc;color:#684c53}#puzzle-preview:focus-visible{outline:3px solid #c46f80;outline-offset:-3px}
.puzzle-sr,#puzzle-status,#puzzle-book-status,#puzzle-book-status:empty{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}
#puzzle-complete{margin:0;flex:none}#puzzle-complete h2{font-size:25px;margin:0}#puzzle-complete p{font-size:11px;margin:4px 0 8px}.puzzle-end-actions{gap:20px}.puzzle-end-actions .button{padding:10px 14px}.puzzle-end-actions a{font-size:13px}
@media(max-height:600px){.puzzle-page{padding-top:10px}.puzzle-app-header{margin-bottom:6px}.puzzle-app-header h1{font-size:28px}#puzzle-books{margin-bottom:6px}.puzzle-piece{width:68px;height:68px}#puzzle-tray{min-height:74px}#puzzle-board{width:min(100%,calc((100svh - 265px)*.75))}}
.puzzle-page{align-items:stretch}.puzzle-game,#puzzle-books{min-width:0;width:100%;box-sizing:border-box}#puzzle-books{margin-left:0;margin-right:0}#puzzle-board{width:min(100%,calc((100svh - 328px)*.75))}
@media(max-height:600px){#puzzle-board{width:min(100%,calc((100svh - 300px)*.75))}}
.puzzle-book-art img+.puzzle-lock{background:transparent;box-shadow:none}
#puzzle-preview{border-radius:12px}
/* Shared tray: pieces sit directly on one responsive surface. */
#puzzle-tray{box-sizing:border-box;width:100%;min-height:0;height:clamp(88px,13svh,116px);padding:10px 12px;gap:8px;border-radius:18px;background:#eee8dd;align-items:center;margin-top:12px}
.puzzle-piece{width:clamp(66px,10svh,92px);height:clamp(66px,10svh,92px);background:transparent;border:0;border-radius:12px;flex-shrink:0}
.puzzle-piece[aria-pressed=true]{background:transparent;outline:2px solid #c46f80;outline-offset:-2px}
.puzzle-game{gap:12px}
#puzzle-board{width:min(100%,calc((100svh - 350px)*.75))}
@media(max-height:600px){#puzzle-board{width:min(100%,calc((100svh - 318px)*.75))}}
/* Completion follows the app's soft rose selection and rounded controls. */
#puzzle-complete{padding:8px 0 0;text-align:center}
#puzzle-complete h2{font:normal 23px/1.15 Fell,Georgia,serif;color:#574332;margin:0}
#puzzle-complete p{font:12px/1.4 var(--app-copy-font);color:#92816d;margin:5px 0 13px}
.puzzle-end-actions{display:flex;gap:10px;align-items:stretch}
.puzzle-end-actions .button,.puzzle-end-actions .text-link{display:flex;align-items:center;justify-content:center;flex:1;min-height:44px;padding:10px 12px;border:0;border-radius:16px;font:500 14px/1.2 var(--app-copy-font);text-decoration:none;box-shadow:none}
.puzzle-end-actions .button{background:#ead6dc;color:#72525d}
.puzzle-end-actions .text-link{background:#ede7dc;color:#78634c}
.puzzle-end-actions .text-link::after{display:none}
.puzzle-end-actions .button:hover{background:#e3c6d0}.puzzle-end-actions .text-link:hover{background:#e5ddcf}
.puzzle-end-actions :focus-visible{outline:2px solid #c46f80;outline-offset:3px}
@media(max-height:600px){#puzzle-complete h2{font-size:20px}#puzzle-complete p{margin:3px 0 8px}#puzzle-complete{padding-top:0}}
.puzzle-end-actions .button{background:#c46f80;color:#fff}
.puzzle-end-actions .text-link{background:var(--green,#354f42);color:#fff7e3}
.puzzle-end-actions .button:hover{background:#b76072}.puzzle-end-actions .text-link:hover{background:#496854;color:#fff7e3}
/* Website desktop keeps its navigation; the embedded app stays full-screen. */
@media(min-width:701px){
 html:has(.site-header):has(.puzzle-page),body:has(.site-header):has(.puzzle-page){height:auto;overflow:visible;overscroll-behavior:auto}
 body:has(.puzzle-page) .site-header,body:has(.puzzle-page) .site-footer{display:flex}
 body:has(.site-header) .puzzle-page{height:auto;min-height:0;max-width:720px;padding:44px 40px 56px;overflow:visible}
 body:has(.site-header) .puzzle-close{display:none}
 body:has(.site-header) .puzzle-app-header{display:block;margin-bottom:24px}
 body:has(.site-header) .puzzle-app-header h1{font-size:42px}
 body:has(.site-header) .puzzle-app-header p{font-size:14px}
 body:has(.site-header) #puzzle-books{margin-bottom:30px;gap:14px}
 body:has(.site-header) .puzzle-game{gap:24px;align-items:center}
 body:has(.site-header) #puzzle-board{width:min(100%,360px);margin:6px auto 0}
 body:has(.site-header) #puzzle-tray{width:100%;height:116px;margin-top:8px}
 body:has(.site-header) .puzzle-piece{width:92px;height:92px}
 body:has(.site-header) #puzzle-complete{width:min(100%,420px);padding-top:8px}
}

/* Tactile feedback complements the Collection-style unfolding entrance. */
.puzzle-book-art,.puzzle-piece{transition:transform .24s cubic-bezier(.2,.8,.2,1),box-shadow .24s ease}
.puzzle-book.current .puzzle-book-art{transform:translateY(-2px)}
.puzzle-piece[aria-pressed=true]{transform:translateY(-3px) scale(1.035)}
.puzzle-book:active .puzzle-book-art,.puzzle-piece:active{transform:scale(.96)}
@media(hover:hover){.puzzle-book[aria-disabled=false]:hover .puzzle-book-art{transform:translateY(-3px);box-shadow:0 5px 10px #42312320}.puzzle-piece:hover{transform:translateY(-3px)}}
@media(prefers-reduced-motion:reduce){.puzzle-book-art,.puzzle-piece{transition:none;transform:none!important}}

.puzzle-embedded .puzzle-close{display:none}
.puzzle-embedded .puzzle-app-header{display:none}
.puzzle-embedded .puzzle-page{height:100%;padding-top:14px}
.puzzle-embedded .puzzle-app-header h1{font-size:28px}
