/* Dialogs own their viewport. The encounter stage keeps its independent layout. */
dialog.page-shell[open],dialog:has(.daily-panel.page-shell)[open] {
  box-sizing:border-box;position:fixed;inset:0;margin:auto;
  width:min(900px,96vw);height:min(690px,calc(100dvh - 78px));max-height:calc(100dvh - 78px);
  padding:0;overflow:clip;border:1px solid #8a7555;border-radius:8px;
  color:#f2e6cd;background:linear-gradient(118deg,#222c2e,#131c20 68%,#20282a);
  box-shadow:0 18px 70px #000b,inset 0 0 0 3px #101719;
}
dialog.page-shell[open],.daily-panel.page-shell {display:grid;grid-template-rows:auto minmax(0,1fr) auto}
dialog:has(.daily-panel.page-shell)>div,.daily-panel.page-shell {height:100%;max-height:none;box-sizing:border-box;padding:0;overflow:clip}
.page-shell>.page-header {position:relative;inset:auto;display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0;padding:10px 18px;text-align:start;border-bottom:1px solid #796a50;background:#172024}
.page-header h1,.page-header h2 {flex:1;margin:0;font:650 clamp(17px,2.5vw,25px)/1.15 system-ui;color:#f7ead3}
.page-header .eyebrow {display:none}
.page-header p {order:4;flex-basis:100%;margin:0;font:inherit;font-size:13px}
.page-shell .page-header button {position:static;margin:0;min-height:34px;width:auto}
.page-window {overflow:clip;min-height:0;position:relative;overscroll-behavior:contain;text-align:start}
.page-flow {display:flow-root;padding:12px clamp(12px,3vw,30px);box-sizing:border-box}
.page-flow .product-body {padding:0;overflow:visible}
.page-flow :is(.combat-log,.daily-scroll,.deck-grid,.product-list,.choices,.product-catalog) {overflow:visible;max-height:none}
.page-shell>.page-footer {display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:6px 16px;min-height:44px;box-sizing:border-box;border-top:1px solid #726044;background:#141c1e}
.page-footer button,.page-header button {font:600 14px/1.15 system-ui}
.page-shell .page-footer>button,.page-shell .page-header .text-button {margin:0;min-height:34px;width:auto;padding:6px 14px}
.page-nav {display:flex;align-items:center;gap:6px;margin-inline-end:auto}
.page-nav[hidden]{display:none}
.page-shell .page-turn {display:grid;place-items:center;margin:0;width:36px;height:34px;min-height:0;padding:0;color:#ead9b9;border:1px solid #816d50;border-radius:4px;background:#253034;font:24px/1 system-ui}
.page-turn:disabled{opacity:.38}.page-count {font:600 13px/1 system-ui;color:#dbcba9;white-space:nowrap;font-variant-numeric:tabular-nums}
.page-flow .product-menu {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));gap:8px}
.page-flow .menu-illustration {height:clamp(100px,22dvh,195px);border-radius:4px;width:100%;object-fit:cover}
.page-flow .product-difficulty:has(input:checked) {background:#38372b;border-color:#c9a464}
.page-shell[data-page-screen=shop] .deck-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr));gap:10px}
.page-flow .shop-offer {padding:10px;border:1px solid #695a43;border-radius:5px;background:linear-gradient(135deg,#2b3333,#172023);min-width:0}
.page-flow .shop-offer button {margin:4px;min-height:34px}
.page-flow img {max-width:100%}
@media(max-height:520px) {
  dialog.page-shell[open],dialog:has(.daily-panel.page-shell)[open]{height:calc(100dvh - 58px);max-height:calc(100dvh - 58px);width:min(940px,98vw)}
  .page-shell>.page-header {padding:4px 12px;gap:5px}.page-header p {order:0;flex:1 1 25%;font-size:12px}
  .page-shell>.page-footer {min-height:38px;padding:2px 10px}.page-flow {padding:7px 12px}
  .page-flow .menu-illustration {height:70px}.page-flow .room-illustration {height:52px}
}
dialog.page-shell[open],dialog:has(.daily-panel.page-shell)[open]{inset-block:env(safe-area-inset-top,0px) calc(var(--ad-space,50px) + env(safe-area-inset-bottom,0px));max-height:calc(100dvh - var(--ad-space,50px) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 8px)}
.page-shell .shop-offer .offer-art {width:100%;height:clamp(44px,10dvh,86px);object-fit:cover}
.page-shell .shop-offer b {display:block;color:#f6dfb2}.page-shell .shop-offer p{margin:5px 0;font-size:14px;line-height:1.4}
.page-shell .page-flow .product-json {height:90px;min-height:0;resize:none}
@media(min-width:650px){
  .page-shell[data-page-screen=main] .product-body {display:grid;grid-template-columns:1fr 1fr;gap:8px 22px;align-content:center}
  .page-shell[data-page-screen=main] .menu-illustration{grid-column:1;grid-row:1/5;height:100%;min-height:150px}
  .page-shell[data-page-screen=main] .product-menu {grid-template-columns:1fr}
  .page-shell[data-page-screen=main] .product-body>:not(img){grid-column:2}
}
.page-shell[data-page-screen=main][open],.page-shell[data-page-screen=pause][open],.page-shell[data-page-screen=detail][open]{height:min(470px,calc(100dvh - var(--ad-space,50px) - 16px))}
.page-shell[data-page-screen=main] .product-body {align-items:center}
.page-shell[data-page-screen=shop]>.page-header {background:linear-gradient(90deg,#161c1bf0,#171b17cd),url('../assets/catalog/events/shop.webp') center 44%/cover}
.page-shell[data-page-screen=shop] .room-illustration {display:none}
.page-shell[data-page-screen=shop] .deck-grid {margin:0}
.page-shell .page-flow .product-difficulty:has(.character-thumbnail) {grid-template-columns:20px 44px minmax(0,1fr);align-items:center;gap:3px 8px;padding:8px}
.page-shell .product-difficulty:has(.character-thumbnail) input {grid-column:1;grid-row:1/3}
.page-shell .product-difficulty .character-thumbnail {grid-column:2;grid-row:1/3;width:44px;height:50px;object-fit:contain}
.page-shell .product-difficulty:has(.character-thumbnail) :is(strong,span) {grid-column:3}
@media(min-width:650px) {
 .page-shell[data-page-screen=new] fieldset{display:grid;grid-template-columns:1fr 1fr;gap:6px}
 .page-shell[data-page-screen=main] .product-body {grid-template-rows:auto auto auto auto;gap:4px 20px}
 .page-shell[data-page-screen=main] .product-body>p {margin:4px 0}
 .page-shell[data-page-screen=main] .menu-illustration {height:clamp(130px,27dvh,260px);min-height:0;align-self:stretch}
}
@media(max-height:520px) {
 .page-shell[data-page-screen=main] .product-menu {grid-template-columns:1fr 1fr}
 .page-shell[data-page-screen=main] .menu-illustration {height:130px}
 .page-shell .shop-offer {padding:6px}
 .page-shell .shop-offer button {padding:3px 5px}
}
.page-shell .crystal-board{display:grid;width:min(484px,100%);margin:auto;grid-template-columns:repeat(11,minmax(0,1fr))}
.page-shell .crystal-board button{width:100%;aspect-ratio:1;min-width:0;min-height:0;margin:0;padding:0}
@media(max-width:649px) and (min-height:560px) {
 .page-shell[data-page-screen=main][open],.page-shell[data-page-screen=pause][open]{height:min(650px,calc(100dvh - 78px))}
}
.page-shell[data-page-screen=shop] .deck-grid {align-items:stretch}
.page-flow .shop-offer {display:grid;grid-template-columns:auto 1fr;align-content:start;grid-template-rows:auto auto 1fr auto}
.page-flow .shop-offer>:not(button){grid-column:1/-1}
.page-flow .shop-offer button{align-self:end;justify-self:start}
.page-shell .page-flow .reward-cards {flex-wrap:wrap;justify-content:center;overflow:visible}
.page-shell .page-flow .deck-grid {margin-top:0}
@media(max-height:520px) {
 .page-shell .page-flow .deck-grid .card {width:138px;height:178px;justify-self:center}
 .page-shell .page-flow .deck-grid .card-name {height:auto;padding:0;font:600 12px/1.15 system-ui}
 .page-shell .page-flow .deck-grid .card-art {height:44%;margin:0}
 .page-shell .page-flow .deck-grid .card-description {font:11px/1.2 system-ui;min-height:0;padding:0}
 .page-shell .compact-reward .reward-cards .card-art {height:50px!important;aspect-ratio:auto}
}
.page-shell[data-page-screen=map]>.page-window {overflow-y:auto;overflow-x:hidden;touch-action:pan-y;scrollbar-color:#927c56 #182126}
.page-shell[data-page-screen=map] .route-map {touch-action:pan-y}
/* The visible button is also the touch target, including on compact landscape. */
dialog.page-shell[open]>.page-footer,.daily-panel.page-shell>.page-footer {padding:6px 10px;gap:8px;flex-wrap:wrap}
dialog.page-shell[open]>.page-footer>button,.daily-panel.page-shell>.page-footer>button {
 box-sizing:border-box;min-height:48px;min-width:76px;max-width:100%;padding:8px 14px;
 font:650 16px/1.25 system-ui,sans-serif;letter-spacing:.02em;white-space:normal
}
dialog.page-shell[open]>.page-footer>.product-primary {min-width:clamp(104px,28vw,160px);background:linear-gradient(#f4d297,#c5985f);color:#302417;border:1px solid #e0bd81;box-shadow:inset 0 0 0 2px #ab804b}
.page-shell[data-page-screen=confirm][open] {height:fit-content;grid-template-rows:auto auto auto}
.page-shell[data-page-screen=confirm] .page-window {min-height:90px}
.page-shell[data-page-screen=confirm] .page-footer>button {flex:1}
.page-shell[data-page-screen=confirm] .page-footer>[data-product-action=cancel-confirm]{order:-1}
.page-shell[data-page-screen=confirm] .page-footer>[data-product-action=confirm]{background:#703d33;color:#fff1de;border:1px solid #be8670}
.page-shell .page-nav .page-turn {min-width:44px;height:44px}
.page-shell .page-header button {min-width:44px;min-height:44px}
.page-shell[data-page-screen=map] .node-icon {
  position:relative;background:#1a2226;border:1px solid #46545a;box-shadow:inset 0 0 0 2px #151b1f;
}
.map-modal .map-node:not(.available,.current,.visited) .node-icon svg {filter:grayscale(1) brightness(.68)}
.page-shell[data-page-screen=map] .available .node-icon {
  background:radial-gradient(circle at 42% 32%,#946b36,#50361e 75%);border:2px solid #ffe2a3;
  box-shadow:inset 0 0 0 2px #684722,0 0 0 2px #735532,0 0 13px #edac526b;
}
.map-modal .map-node.available .node-icon svg {filter:brightness(1.23)}
.map-modal .map-node.available :is(strong,small) {color:#ffe3a1}
.page-shell[data-page-screen=map] .visited:not(.current) .node-icon {
  background:#293b38;border-color:#77998c;box-shadow:inset 0 0 0 2px #1c2929;
}
.map-modal .visited:not(.current) .node-icon svg {filter:saturate(.45)}
.map-modal .visited:not(.current) .node-icon::after {
  content:"";position:absolute;right:-2px;bottom:-1px;width:14px;height:14px;border-radius:50%;background:#a6c5ae;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='m3 7 2.5 2.5L11 4' fill='none' stroke='%231b332b' stroke-width='2'/%3E%3C/svg%3E");box-shadow:0 0 0 1px #192422;
}
.page-shell[data-page-screen=map] .current .node-icon {
  background:#293b46;border:2px solid #aacae0;box-shadow:inset 0 0 0 2px #213039;
}
.map-modal .map-node.current :is(strong,small) {color:#c4deeb}
.map-node .node-icon .emblem {width:26px;height:26px}
.page-shell .page-header .emblem {width:24px;height:24px;flex:none}
dialog.page-shell[data-page-screen=confirm][open]{width:min(460px,94vw)}
.page-shell .page-flow .shop-offer button,.page-shell .event-flavor summary {min-height:44px;font:600 14px/1.25 system-ui;padding:7px}
.page-shell .page-flow .choices>button b {font:650 16px/1.3 system-ui}
.page-shell .page-flow .choices>button span {font:400 14px/1.45 system-ui}
.page-shell .page-flow .choices>button {min-height:48px;overflow-wrap:anywhere}
@media (orientation:landscape) and (max-height:520px) {
 .page-shell[data-page-screen=shop] .deck-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
 .page-shell .page-flow .shop-offer {grid-template-columns:76px minmax(0,1fr);grid-template-rows:auto auto 1fr;align-content:start;gap:3px 8px}
 .page-shell .page-flow .shop-offer>img {grid-column:1;grid-row:1/3;width:58px;height:54px;object-fit:contain}
 .page-shell .page-flow .shop-offer>b,.page-shell .page-flow .shop-offer>p,.page-shell .page-flow .shop-offer>span {grid-column:2;margin:0}
 .page-shell .page-flow .shop-offer>button {margin:0;padding:5px;white-space:normal}
}
@media (orientation:landscape) and (max-height:520px) {
 .page-shell[data-page-screen=event] .room-illustration {display:none}
 .page-shell[data-page-screen=event]>.page-header {background:linear-gradient(90deg,#182024e6,#182024b3),var(--event-art,none) center/cover}
 .page-shell[data-page-screen=event] .choices {max-width:none;grid-template-columns:repeat(auto-fit,minmax(min(175px,100%),1fr));gap:8px;margin:6px 0}
 .page-shell[data-page-screen=event] .choices>button {padding:9px;gap:4px}
}
.page-shell .page-flow :is(.deck-grid,.reward-cards):has(.offer-option){display:grid;grid-template-columns:repeat(auto-fit,minmax(min(238px,100%),1fr));align-items:start;gap:9px;margin:0;padding:0;max-width:none}
.page-shell .page-flow .offer-option {box-sizing:border-box;display:flex;width:100%;min-width:0;min-height:62px;align-items:flex-start;gap:10px;margin:0;padding:10px;text-align:start;color:#e9dcc1;background:linear-gradient(115deg,#2d3737,#1d272a);border:1px solid #75674e;border-radius:5px;letter-spacing:normal;white-space:normal}
.page-shell .offer-thumb {width:64px;height:52px;object-fit:cover;border-radius:3px;flex:none}
.page-shell .offer-copy {display:grid;gap:3px;font:14px/1.4 system-ui;overflow-wrap:anywhere}
.page-shell .offer-copy strong {font:650 16px/1.2 system-ui;color:#f6e1b8}
.page-shell .offer-copy small {font:13px/1.3 system-ui;color:#d6bd91}
.page-shell .offer-option[aria-pressed=true]{background:#453d2b;border-color:#e4ba72;outline:2px solid #e4ba72!important;outline-offset:-2px}
.page-shell .belt-options {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));gap:10px}
.page-shell .belt-options article {display:grid;grid-template-columns:46px 1fr;gap:4px 10px;align-content:start;background:#232e30;border:1px solid #73674f;padding:10px;border-radius:5px}
.page-shell .belt-options .item-art {width:46px;height:52px;object-fit:contain;grid-row:1/3}
.page-shell .belt-options p {margin:0;font:14px/1.45 system-ui}
.page-shell .belt-options button {grid-column:2;justify-self:start;min-height:44px;font:600 15px/1.2 system-ui;margin:3px 0 0;padding:7px 14px}
.page-shell:is([data-page-screen=confirmDeckChange],[data-page-screen=confirmRemove]) .page-footer>[data-action=close]{order:-1}
.page-shell:is([data-page-screen=confirmDeckChange],[data-page-screen=confirmRemove]) .page-footer>.primary{background:#754137;color:#fff0dc;border:1px solid #c88c73}
.page-shell .trade-review{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));gap:10px}
.page-shell .trade-review article{display:grid;grid-template-columns:46px 1fr;gap:4px 10px;padding:10px;border:1px solid #7b6a50;border-radius:5px;background:#252e2f}
.trade-review small{grid-column:1/-1;color:#d8bb89;font:600 14px/1.3 system-ui}
.trade-review .item-art{grid-row:2/4;width:46px;height:50px;object-fit:contain}
.trade-review p{margin:0;font:14px/1.45 system-ui}
.page-shell[data-page-screen=confirmTrade] .page-footer>[data-action=close]{order:-1}
#overlay-root .modal.page-shell:has(.compact-reward){padding:0}
.page-shell .page-header .reward-receipt{margin:0;padding:3px 5px;background:transparent;font:14px/1.35 system-ui}
.page-shell .page-flow .compact-reward>button {min-height:44px;font:600 15px/1.2 system-ui}
@media (max-height:520px){
 .page-shell .page-flow .compact-reward {margin:4px 0}
 .page-shell .compact-reward>.item-art {width:46px;height:46px;float:left;margin-right:8px}
 .page-shell .compact-reward::after {content:"";display:block;clear:both}
}
/* Keep the rules and rarity inside the parchment on illustrated deck cards. */
.page-shell .deck-grid .card:not(.compact-reward .card) .card-description{inset:69% 9% auto;height:19%;margin:0;padding:0;min-height:0;display:grid;align-content:center;text-align:center;line-height:1.15}
.page-shell .deck-grid .card:not(.compact-reward .card) .card-bottom{inset:88% 9% auto;height:6%;display:flex;align-items:center;justify-content:center;padding:0;margin:0;line-height:1;letter-spacing:.025em}
.page-shell .deck-grid .card:not(.compact-reward .card) .card-cost,.card-peek .card .card-cost{display:flex;align-items:center;justify-content:center;padding:0;line-height:1;color:#38200a;text-shadow:0 1px #ffe0a2}
