[data-puzzle-deck]{--ink:#18271e;--paper:#faf3e4;--gold:#8b5d24;--line:#b4a486;color:var(--ink);max-width:70rem;margin-inline:auto}
[data-puzzle-deck] [hidden]{display:none!important}
[data-puzzle-deck] h2{margin:0}
[data-puzzle-deck] .deck-intro{max-width:58ch;margin-block:.6rem 1.5rem}
[data-puzzle-controls]{display:flex;align-items:center;justify-content:space-between;gap:.65rem;margin-block:1.15rem;flex-wrap:wrap}
[data-puzzle-status]{font-size:.86rem;font-weight:700;flex:1;text-align:center;margin:0;min-width:8rem}
[data-puzzle-deck] button{min-height:44px;padding:.55em .95em;border:1px solid currentColor;border-radius:999px;background:#fffaf0;color:var(--ink);font:inherit;font-weight:700;cursor:pointer}
[data-puzzle-deck] :is(a,button):focus-visible{outline:3px solid var(--gold);outline-offset:4px}
[data-puzzle-card]{position:relative;z-index:2;display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);align-items:center;gap:clamp(1rem,4vw,3.2rem);border:1px solid var(--line);background:var(--paper);padding:clamp(1.05rem,4vw,2.7rem);margin:0 0 1rem;border-radius:.85rem;box-shadow:0 9px 24px #18271e20;transform-origin:55% 78%}
[data-puzzle-card] figure{margin:0}
[data-puzzle-card] :is(img,figure){max-width:100%}
[data-puzzle-card] img{display:block;width:100%;height:auto;aspect-ratio:1;object-fit:contain;background:#e9dec6;border-radius:.4rem}
[data-puzzle-card] h3{font-size:clamp(1.75rem,4.6vw,3.35rem);line-height:1.07;margin:.3em 0 .4em}
[data-puzzle-card] p{max-width:56ch;line-height:1.55}
[data-puzzle-card] .puzzle-actions{display:flex;align-items:center;flex-wrap:wrap;gap:.45rem 1.15rem;margin-top:1rem}
[data-puzzle-card] .puzzle-actions a{display:inline-flex;align-items:center;min-height:44px;font-weight:700;text-decoration:underline;text-underline-offset:.2em;color:var(--ink)}
[data-puzzle-card] .puzzle-actions a:first-child{background:var(--ink);color:var(--paper);padding:.5em .9em;border-radius:.3rem;text-decoration:none}
[data-puzzle-stack]{position:relative;isolation:isolate}
[data-puzzle-ready] [data-puzzle-stack]::before{content:'';position:absolute;inset:8px 5px -7px;background:#e8dabc;border:1px solid var(--line);border-radius:.85rem;transform:rotate(-.95deg);pointer-events:none}
[data-puzzle-ready] [data-puzzle-grip]{touch-action:pan-y pinch-zoom;user-select:none;cursor:grab}
[data-puzzle-card][data-puzzle-dragging]{transform:translate(var(--drag-x,0),var(--drag-y,0)) rotate(var(--drag-rotate,0))}
[data-puzzle-card][data-puzzle-dragging] [data-puzzle-grip]{cursor:grabbing}
[data-puzzle-peek]{position:absolute;z-index:1;inset:0;display:flex;gap:.5rem;align-items:center;justify-content:flex-end;flex-direction:column;background:#e8dabc;border:1px solid var(--line);border-radius:.85rem;padding:1rem;pointer-events:none}
[data-puzzle-peek][data-peek-previous]{justify-content:flex-start}
[data-puzzle-peek] img{height:clamp(3rem,9vw,6.5rem);max-width:70%;object-fit:contain}
[data-puzzle-peek] strong{font-size:clamp(.95rem,2vw,1.5rem);text-align:center}
[data-puzzle-grip] figcaption{display:none}
[data-puzzle-ready] [data-puzzle-grip] figcaption{display:block;font-size:.78rem;color:#4b4337;margin-top:.45rem;text-align:center}
@media(max-width:42rem){[data-puzzle-card]{grid-template-columns:1fr;gap:.65rem}[data-puzzle-card] img{max-height:15rem}[data-puzzle-status]{order:-1;flex-basis:100%;text-align:left}}
@media(prefers-reduced-motion:reduce){[data-puzzle-card][data-puzzle-dragging]{transform:none}}

[data-puzzle-deck]:not([data-puzzle-ready]) .deck-hint{display:none}

/* Puzzle artwork viewer. The opener sits outside the swipe surface. */
[data-puzzle-deck] .puzzle-artwork-tools{margin:.5rem 0 0}
[data-puzzle-deck] .puzzle-artwork-tools a{display:inline-flex;align-items:center;min-height:44px;color:var(--ink);font-weight:700;text-decoration:underline;text-underline-offset:.2em}
[data-puzzle-deck] [data-puzzle-viewer]{position:fixed;inset:0;width:100%;height:100%;width:100dvw;height:100dvh;margin:0;max-width:none;max-height:none;padding:clamp(.75rem,3vw,1.5rem);border:0;overflow:auto;background:#161f19;color:#fff8e9}
[data-puzzle-deck] [data-puzzle-viewer]:not([open]){display:none}
[data-puzzle-deck] [data-puzzle-viewer]::backdrop{background:#101712eb}
[data-puzzle-deck] .puzzle-viewer-bar{display:flex;align-items:center;justify-content:space-between;gap:.6rem 1rem;flex-wrap:wrap;max-width:90rem;margin:0 auto .8rem}
[data-puzzle-deck] .puzzle-viewer-bar h3{font:inherit;font-weight:700;margin:0;flex:1;min-width:9rem}
[data-puzzle-deck] .puzzle-viewer-bar a{display:inline-flex;align-items:center;min-height:44px;color:#fff8e9;text-decoration:underline;text-underline-offset:.2em}
[data-puzzle-deck] img[data-puzzle-viewer-image]{display:block;width:100%;height:auto;max-width:86rem;max-height:76vh;max-height:76dvh;object-fit:contain;margin-inline:auto}
@media(max-width:42rem){[data-puzzle-card] img{max-height:19rem}}
