/* Keep scenery around each game, with an always-available host close button. */
html body dialog.v2-arcade.arcade-popup,html body.ui2 dialog#modal.arcade-inline{
 position:fixed;inset:0;margin:auto;padding:0!important;box-sizing:border-box;
 width:min(1160px,calc(100vw - 40px - env(safe-area-inset-left) - env(safe-area-inset-right)));
 height:min(840px,calc(92dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
 max-width:none;max-height:none;border:3px solid #fff9ef;border-radius:30px;
 background:#fff8ed;box-shadow:0 8px 0 #c5a88b,0 25px 80px #38254d55;overflow:hidden;
}
html body dialog.arcade-popup[open],html body.ui2 dialog#modal.arcade-inline[open]{display:grid;grid-template-rows:54px minmax(0,1fr)}
html body dialog.arcade-popup::backdrop{background:#43345770;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
.arcade-popup>:is(header,.arcade-inline-header){display:flex;align-items:center;justify-content:space-between;gap:12px;padding:4px 10px 4px 18px;background:#fff8ed;min-width:0}
.arcade-popup h2{margin:0;color:#684580;font:900 clamp(17px,2.2vw,23px)/1.1 ui-rounded,'Nunito',system-ui,sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.arcade-popup-close{flex:none;width:44px;height:44px;min-height:44px;padding:0;border:2px solid white;border-radius:50%;background:#f1e7f8;color:#684580;box-shadow:0 2px 5px #68458022;font:800 21px/1 system-ui;cursor:pointer}
.arcade-popup-close:focus-visible{outline:3px solid #9868c8;outline-offset:-3px}
html body dialog.arcade-popup>iframe{display:block;width:100%;height:100%;min-width:0;min-height:0;border:0}
@media(max-width:600px){
 html body dialog.v2-arcade.arcade-popup,html body.ui2 dialog#modal.arcade-inline{width:calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));border-radius:23px}
 html body dialog.arcade-popup[open],html body.ui2 dialog#modal.arcade-inline[open]{grid-template-rows:50px minmax(0,1fr)}
 .arcade-popup>:is(header,.arcade-inline-header){padding-left:14px}
}
@media(prefers-reduced-motion:no-preference){
 /* The window itself slides up in game-sheet.js; only the dimmed backdrop fades here. */
 html body dialog.arcade-popup[open]::backdrop{animation:arcade-backdrop-in .3s ease-out both}
 @keyframes arcade-backdrop-in{from{opacity:0}to{opacity:1}}
}

.arcade-popup h2{margin-right:auto}
.arcade-popup-hear{flex:none;width:44px;height:44px;padding:0;border:2px solid white;border-radius:50%;background:#fff0c4;font-size:21px;cursor:pointer}
.arcade-popup-hear[hidden]{display:none}
.arcade-popup-hear.needs-audio{box-shadow:0 0 0 3px #e5b557}

/* The in-page dumpling games use the same chrome and remaining play surface. */
html body.ui2 dialog#modal.arcade-inline{overflow:hidden!important;min-height:0!important}
html body.ui2 dialog#modal.arcade-inline>.arcade-inline-content{min-height:0;min-width:0;overflow:hidden;padding:12px;display:grid;grid-template-columns:minmax(0,1fr);place-items:center;container-type:size}
html body.ui2 dialog#modal.arcade-inline .arcade-inline-header{margin:0!important}
html body.ui2 dialog#modal.arcade-inline .arcade-inline-header h2{font-size:clamp(17px,2.2vw,23px)!important}
html body.ui2 dialog#modal.arcade-inline #dumpling-maze,html body.ui2 dialog#modal.arcade-inline #dumpling-shuffle{width:min(100%,740px);max-width:100%;min-width:0;margin:0;max-height:100%}
html body.ui2 dialog#modal.arcade-inline .maze-board{height:clamp(100px,40cqh,300px)}
html body.ui2 dialog#modal.arcade-inline .shuffle-board{width:min(100%,58cqh,510px);height:auto;aspect-ratio:1/1;min-height:0}
html body.ui2 dialog#modal.arcade-inline .shuffle-status,html body.ui2 dialog#modal.arcade-inline .maze-status{margin:3px 0 8px;min-height:0}
@media(max-height:650px){
 html body.ui2 dialog#modal.arcade-inline>.arcade-inline-content{padding:6px}
 html body.ui2 dialog#modal.arcade-inline .maze-prizes{min-height:65px}
 html body.ui2 dialog#modal.arcade-inline .maze-box-art{max-width:65px}
 html body.ui2 dialog#modal.arcade-inline .shuffle-note{font-size:12px;margin:4px 0}
}

html body.ui2 dialog#modal.arcade-inline .hunter-job{width:min(100%,600px);text-align:center}
html body.ui2 dialog#modal.arcade-inline .hunter-job .mission-picture{max-height:14cqh;width:auto;max-width:100%;object-fit:contain}
html body.ui2 dialog#modal.arcade-inline .hunter-job-target .toy{width:clamp(90px,24cqh,180px);height:clamp(90px,24cqh,180px)}
html body.ui2 dialog#modal.arcade-inline .hunter-match-choices .toy{width:clamp(64px,18cqh,120px);height:clamp(64px,18cqh,120px)}
@media(max-height:650px){
 html body.ui2 dialog#modal.arcade-inline .maze-board{height:27cqh}
 html body.ui2 dialog#modal.arcade-inline .maze-ready{margin-top:8px}
}
/* Game sheet grip (game-sheet.js): same little handle as the squishy viewer, centered at the top of the header. */
.arcade-popup>:is(header,.arcade-inline-header){position:relative;touch-action:none;cursor:grab}
.arcade-popup .game-sheet-grip{position:absolute;left:50%;top:3px;transform:translateX(-50%);width:72px;height:16px;padding:0;margin:0;border:0;background:none;display:grid;place-items:center;cursor:grab;z-index:2}
.arcade-popup .game-sheet-grip>span{width:46px;height:5px;border-radius:99px;background:#d4c0e3;pointer-events:none}
body.sq-calm .arcade-popup .game-sheet-grip{display:none}

/* The corner sound and close fit inside the title bar (Mac, 10/23): popup-unify's 56px circles were taller than the
   50-54px bar and hung down over every game. */
html body dialog.arcade-popup>:is(header,.arcade-inline-header) :is(.arcade-popup-close,.arcade-popup-hear){width:44px!important;height:44px!important;flex:0 0 44px!important;font-size:26px!important}
html body dialog.arcade-popup>:is(header,.arcade-inline-header) .arcade-popup-hear img.pu-ico{width:28px;height:28px}
html body dialog.arcade-popup>:is(header,.arcade-inline-header) .arcade-popup-hear svg{width:22px!important;height:22px!important}

/* Breaker mobile shell: one compact title, no second safe-area gutter inside. */
@media(max-width:640px){html body dialog.arcade-popup[data-arcade-game=breaker]{width:calc(100vw - 8px - env(safe-area-inset-left) - env(safe-area-inset-right));height:calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom));border-width:2px;border-radius:20px}html body dialog.arcade-popup[data-arcade-game=breaker][open]{grid-template-rows:48px minmax(0,1fr)}html body dialog.arcade-popup[data-arcade-game=breaker]>header{padding:2px 6px!important;gap:6px!important}html body dialog.arcade-popup[data-arcade-game=breaker]>header h2{font-size:17px}html body dialog.arcade-popup[data-arcade-game=breaker]>header .sq-activity-picture{width:30px;height:30px;flex:0 0 30px}}
@media(max-width:640px){html body dialog.arcade-popup[data-arcade-game=breaker] .game-sheet-grip{display:none!important}}

/* Match the desktop Breaker window to its board instead of blank side gutters. */
@media(min-width:641px){html body dialog.v2-arcade.arcade-popup[data-arcade-game=breaker]{width:min(752px,calc((92dvh - 140px)*1.066667),calc(100vw - 40px));}}

@media(max-width:640px){html body dialog.arcade-popup[data-arcade-game=scoop]{width:calc(100vw - 8px - env(safe-area-inset-left) - env(safe-area-inset-right));height:calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom));border-width:2px;border-radius:20px}html body dialog.arcade-popup[data-arcade-game=scoop][open]{grid-template-rows:48px minmax(0,1fr)}html body dialog.arcade-popup[data-arcade-game=scoop] .game-sheet-grip{display:none!important}}
