.game-shop {padding-block:clamp(2rem,6vw,4rem) clamp(3rem,8vw,6rem)}
.shop-heading {margin-bottom:1.05rem}
.shop-heading p {margin:0;color:#854427;font-size:.82rem;font-weight:800;letter-spacing:.2em}
.shop-heading h2 {margin:.15rem 0 .4rem;color:#3f2024;font-size:clamp(1.65rem,5vw,2.65rem);line-height:1.1}
.shop-heading div {color:#614a41;font-size:1rem}
.shop-case {isolation:isolate;box-shadow:0 .7rem 1.4rem #34201345;border:1px solid #2d180e;border-radius:.27rem;background:#3c2013 url("/media/game-shelf/shelf.webp") center / 100% 100% no-repeat}
.shop-rail {display:flex;align-items:flex-end;justify-content:center;gap:8%;padding:5.5% 8% 5%;margin:0;overflow-x:auto;scroll-snap-type:x proximity;scroll-padding-inline:8%;scrollbar-width:thin;scrollbar-color:#b18b61 #2c1710}
.shop-item {display:block;position:relative;align-self:flex-end;flex:none;color:inherit;text-decoration:none;scroll-snap-align:start;-webkit-tap-highlight-color:transparent;transition:transform 180ms ease;transform-origin:bottom center}
.shop-item-adventure {width:53%}
.shop-item-detective {width:27.5%;padding-right:4%;box-sizing:content-box}
.shop-item:is(:hover,:focus-visible,.is-picked) {transform:translateY(-.18rem) scale(1.045);z-index:1}
.shop-item:focus-visible,.shop-rail:focus-visible {outline:2px solid #fff0b5;outline-offset:4px}
.shop-box {display:block;position:relative;isolation:isolate;filter:drop-shadow(.15rem .45rem .4rem #150903d9)}
.shop-box img {display:block;width:100%;height:auto}
.shop-box-adventure {margin:-5.9% -2.7% -4.55%}
.shop-box-adventure img {clip-path:polygon(2.5% 13%,3.2% 10.6%,6.2% 8.8%,96.3% 9.1%,97.2% 10.5%,97.2% 89.8%,96.1% 92.6%,95.2% 93%,2.5% 92%,2.3% 90.6%)}
.shop-box-detective {transform:perspective(900px) rotateY(-5deg);transform-origin:right center}
.shop-box-detective img {box-shadow:inset 0 0 0 1px #56382c;border-radius:.11rem;position:relative;z-index:1}
.detective-spine {position:absolute;left:99.7%;top:0;bottom:0;width:15%;box-sizing:border-box;display:grid;place-items:center;padding:.25rem;color:#fff0bc;background:linear-gradient(90deg,#183b32,#25594e 24%,#17352f 91%,#9c784b);border-block:1px solid #a38255;clip-path:polygon(0 0,100% 4%,100% 96%,0 100%);font:900 clamp(.7rem,2vw,1.12rem)/1.1 sans-serif;writing-mode:vertical-rl;text-shadow:1px 1px #172c22}
.shop-sr {position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
/* Keep the exit outside the game iframe and above its scrollable viewport. */
.shop-dialog {box-sizing:border-box;position:fixed;inset:0;width:min(calc(100% - 1.5rem),74rem);max-width:none;height:min(calc(100dvh - 1.5rem),58rem);max-height:none;padding:0;overflow:hidden;border:1px solid #78573a;border-radius:.45rem;background:#1d1716;color:#fff1d3;box-shadow:0 1rem 4rem #0009}
.shop-dialog[open] {display:flex;flex-direction:column;animation:box-lift 180ms ease-out both}
.shop-dialog::backdrop {background:#1b100bd1}
@keyframes box-lift {from{opacity:.2;transform:scale(.98)}to{opacity:1;transform:none}}
.shop-player-bar {display:flex;align-items:center;justify-content:space-between;gap:.7rem;position:relative;z-index:2;flex:none;padding:.25rem .5rem .25rem .95rem;background:#3c2523;border-bottom:1px solid #856347}
.shop-player-bar h2 {margin:0;font-size:clamp(.94rem,2.4vw,1.22rem);line-height:1.25;color:#fff1d3}
.shop-close-form {flex:none;margin:0}
.shop-player-close {display:grid;place-items:center;position:relative;z-index:1;pointer-events:auto;border:1px solid #b39373;border-radius:.28rem;background:#fff2d1;color:#422721;width:44px;height:44px;padding:0;font:700 1.65rem/1 system-ui;cursor:pointer}
.shop-player-content {display:flex;min-width:0;min-height:0;flex:1;background:#1d1716}
.shop-player-content iframe {display:block;width:100%;height:100%;flex:1;border:0;background:#1d1716}
@media(max-width:640px), (orientation:landscape) and (max-height:590px) {
 .shop-dialog {width:100%;height:100dvh;margin:0;border:0;border-radius:0}
 .shop-player-bar {padding-top:max(.18rem,env(safe-area-inset-top));padding-right:max(.5rem,env(safe-area-inset-right));padding-left:max(.7rem,env(safe-area-inset-left))}
}
@media(max-width:640px) {
 .shop-rail {justify-content:flex-start;gap:11%;padding:9% 8% 8%;scroll-padding-inline:8%}
 .shop-item-adventure {width:72%}
 .shop-item-detective {width:39%;padding-right:6%}
 .shop-case {background-size:auto 100%}
}
@media(prefers-reduced-motion:reduce) {.shop-item {transition:none}.shop-dialog[open] {animation:none}}

/* The box back is the first view; only choosing Play loads the game. */
.shop-dialog:not([data-playing]) {width:min(calc(100% - 1.5rem),31rem);height:auto;max-height:calc(100dvh - 1.5rem);margin:auto;border:1px solid #78573a;border-radius:.45rem}
.shop-player-content[hidden],.shop-box-preview[hidden] {display:none}
.shop-box-preview {overflow:auto;min-height:0;padding:clamp(.85rem,4vw,1.6rem);color:#32251e;background:linear-gradient(135deg,#fff2d1,#e3cda1);border:.3rem double #85603d}
.box-preview-brand,.box-preview-genre {font-weight:850;margin:0 0 .7rem;color:#713c2b;font-size:.9rem}
.box-preview-brand {letter-spacing:.16em}
.shop-box-preview img {display:block;width:100%;aspect-ratio:16 / 9;object-fit:contain;background:#2d3027;border:3px double #7e6244}
.box-preview-genre {margin-top:.9rem;margin-bottom:.2rem}
.box-preview-description {margin:.25rem 0 1rem;line-height:1.6}
.box-preview-actions {display:flex;gap:.65rem;flex-wrap:wrap}
.box-preview-actions form {margin:0}
.box-preview-actions button {min-height:44px;padding:.4rem 1rem;border-radius:.25rem;border:1px solid #693d32;background:#fff1d0;color:#57372a;font:800 1rem system-ui;cursor:pointer}
#game-box-start {background:#66362d;color:#fff4dd}

.box-preview-actions button[hidden]{display:none}
.shop-dialog[data-title-preview]:not([data-playing]){width:min(calc(100% - 1.5rem),44rem)}
.shop-dialog[data-title-preview] .shop-box-preview{min-height:0;overflow:auto}
.shop-dialog[data-title-preview] .shop-box-preview img{aspect-ratio:4/3;max-height:56dvh;box-sizing:border-box;object-fit:contain}
