.ap{padding:32px;background:#f0f6e9;border:1px solid #d6e4c9;border-radius:28px}.ap-toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:24px 0}.ap-toolbar button,.ap-toolbar select{font:inherit;padding:12px 16px;min-height:48px;background:white;color:#244b3c;border:2px solid #cadcbd;border-radius:14px;cursor:pointer}.ap-toolbar label{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.ap-board,.ap-tray{direction:ltr;display:grid;grid-template-columns:repeat(var(--ap-n,2),minmax(0,1fr));gap:5px;max-width:900px;margin-inline:auto}.ap-board{aspect-ratio:3/2;border:6px solid #fff;border-radius:18px;overflow:hidden;background:#cbdcba;box-shadow:0 8px 24px #254b3b12}.ap-cell,.ap-piece{min-width:0;padding:0;border:2px solid transparent;border-radius:7px;cursor:pointer;background-color:#e1ebd6;background-image:var(--ap-image,none);background-size:var(--ap-size,100%);background-position:var(--ap-pos,center);background-repeat:no-repeat;touch-action:pan-y}.ap-cell{font:600 18px system-ui;color:#607851}.ap-cell.ap-placed{border-color:#fff;cursor:default}.ap-piece{aspect-ratio:3/2;border:3px solid #fff;box-shadow:0 3px 8px #244b3c22}.ap-piece[aria-pressed=true]{outline:4px solid #e59c27;outline-offset:1px}.ap-piece:disabled{visibility:hidden;pointer-events:none}.ap-tray{gap:12px;padding:8px}.ap-status{min-height:30px;font-weight:700;text-align:center}.ap-reference{max-width:450px;margin:20px auto}.ap-reference[hidden]{display:none}.ap-reference img{display:block;width:100%;height:auto;border-radius:18px}.ap button:focus-visible,.ap select:focus-visible{outline:4px solid #345fbb;outline-offset:3px}.ap.ap-win .ap-board{border-color:#78b349}.ap h3{text-align:center;margin-top:28px}@media(max-width:600px){.ap{padding:16px 10px}.ap-board{gap:3px;border-width:4px}.ap-tray{gap:8px}.ap-toolbar{gap:8px}.ap-toolbar button,.ap-toolbar select{font-size:16px}.ap-cell{font-size:14px}}

.ap{box-sizing:border-box;position:relative;height:calc(100svh - 150px);min-height:220px;max-height:850px;display:flex;flex-direction:column;padding:16px 20px;scroll-margin-top:78px;overflow:hidden}.ap>.aw-eyebrow{display:none}.ap>h2{font-size:clamp(21px,3vw,32px);margin:0 0 6px;line-height:1.2}.ap>p:not(.ap-status){font-size:14px;line-height:1.35;margin:0}.ap-toolbar{gap:8px;margin:10px 0;flex-shrink:0}.ap-toolbar button,.ap-toolbar select{font-size:14px;min-height:40px;padding:6px 10px}.ap-toolbar label{font-size:14px;gap:6px}.ap-status{font-size:14px;line-height:1.3;min-height:19px;margin:0 0 10px;flex-shrink:0}.ap-play-area{display:flex;flex:1;min-height:0;gap:16px;align-items:center;justify-content:center;direction:ltr}.ap-play-area.ap-stacked{flex-direction:column;gap:12px}.ap-board,.ap-tray{box-sizing:border-box;flex:none;margin:0;max-width:100%;max-height:100%;min-height:0}.ap-board{border-width:4px;gap:3px}.ap-tray{padding:4px;gap:7px}.ap-piece{min-height:0;aspect-ratio:auto;border-width:2px}.ap-reference{position:absolute;z-index:3;inset:110px 12px 12px;max-width:none;margin:0;background:#f0f6e9f2;display:flex;align-items:center;justify-content:center;pointer-events:none}.ap-reference img{width:auto;height:auto;max-height:100%;max-width:100%;object-fit:contain}.ap-cell{min-height:0}
@media(max-width:600px){.ap{height:calc(100svh - 135px);padding:12px 10px}.ap-toolbar{gap:5px;margin:8px 0}.ap-toolbar button,.ap-toolbar select{font-size:13px;padding:5px 7px;min-height:36px}.ap-status{margin-bottom:6px;font-size:13px}.ap>h2{font-size:23px}.ap-tray{gap:5px}}
@media(max-height:500px){.ap{height:calc(100svh - 95px);padding:8px 12px;scroll-margin-top:50px}.ap>p:not(.ap-status){display:none}.ap>h2{font-size:20px}.ap-toolbar{margin:5px 0}.ap-toolbar button,.ap-toolbar select{min-height:30px;padding:3px 7px}.ap-status{margin:0 0 4px;font-size:12px}.ap-reference{inset:70px 10px 10px}}

.ap-reference{inset:165px 12px 12px;pointer-events:auto;cursor:pointer}.ap-reference[hidden]{display:none!important}.ap-win .ap-board{background-image:var(--ap-complete-image);background-size:100% 100%;background-position:center;background-repeat:no-repeat;box-shadow:0 0 0 3px #98c76d,0 8px 24px #254b3b22;transition:box-shadow .35s}.ap-win .ap-board .ap-cell{visibility:hidden}.ap-win .ap-tray{opacity:0;pointer-events:none}@media(max-height:500px){.ap-reference{inset:100px 10px 10px}}

/* A viewport-sized phone dialog; no desktop puzzle selectors are changed. */
.ap-mobile-dialog{position:fixed;inset:0;width:100vw;height:100vh;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;border-radius:0;overflow:hidden;overscroll-behavior:contain;background:#f0f6e9;color:#254739;z-index:2147483000}
.ap-mobile-dialog[open]{display:flex;flex-direction:column}
.ap-mobile-dialog::backdrop{background:#17352bd9}
.ap-mobile-topbar{display:flex;align-items:center;gap:10px;flex:none;padding:calc(6px + env(safe-area-inset-top)) 12px 6px;border-bottom:1px solid #cadcbd;background:#fff}
.ap-mobile-topbar h2{flex:1;font-size:20px;line-height:1.2;margin:0}
.ap-mobile-close{flex:none;font:600 15px Arial,sans-serif;min-height:44px;padding:6px 12px;border:2px solid #cadcbd;border-radius:12px;color:#254739;background:#fff;cursor:pointer}
.ap-mobile-dialog .ap.ap-mobile-open{width:100%;height:auto;min-height:0;max-height:none;flex:1;margin:0;border:0;border-radius:0;padding:8px max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));overflow:hidden}
.ap-mobile-open>h2,.ap-mobile-open>.aw-eyebrow,.ap-mobile-open>p:not(.ap-status){display:none}
.ap-mobile-open .ap-toolbar{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:0 0 6px}
.ap-mobile-open .ap-toolbar label{grid-column:1/-1;flex-wrap:nowrap;min-width:0}
.ap-mobile-open .ap-toolbar select{flex:1;min-width:0}
.ap-mobile-open .ap-toolbar button,.ap-mobile-open .ap-toolbar select{font-size:15px;min-height:44px;padding:6px 9px}
.ap-mobile-open .ap-mobile-open-button{display:none!important}
.ap-mobile-open .ap-status{font-size:14px;line-height:1.25;margin:0 0 6px;min-height:18px}
.ap-mobile-open .ap-play-area{gap:12px;align-items:center}
.ap-mobile-open .ap-board{border-width:3px;gap:3px}
.ap-mobile-open .ap-tray{overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;align-content:start;padding:4px;gap:6px;scrollbar-gutter:stable}
.ap-mobile-open .ap-cell,.ap-mobile-open .ap-piece{touch-action:pan-y}
.ap-mobile-open .ap-reference{inset:104px 8px 8px}
@media(max-width:749px),(max-width:1024px) and (pointer:coarse){
 .ap.ap-mobile-ready:not(.ap-mobile-open){height:auto;min-height:0;max-height:none}
 .ap-mobile-ready:not(.ap-mobile-open) .ap-play-area,.ap-mobile-ready:not(.ap-mobile-open)>.ap-status,.ap-mobile-ready:not(.ap-mobile-open) .ap-reference{display:none!important}
 .ap-mobile-ready:not(.ap-mobile-open) [data-ap-preview],.ap-mobile-ready:not(.ap-mobile-open) [data-ap-reset]{display:none}
 .ap-mobile-ready:not(.ap-mobile-open) .ap-toolbar{margin-bottom:0}
}
@media(min-aspect-ratio:5/4){
 .ap-mobile-open .ap-toolbar{display:flex;flex-wrap:nowrap;justify-content:center}
 .ap-mobile-open .ap-toolbar label{flex-wrap:nowrap}
 .ap-mobile-open .ap-toolbar select{flex:none}
 .ap-mobile-open .ap-reference{inset:56px 8px 8px}
}
