/* A folio-sized night: two comfortable thumb corners and an open middle.
   The host applies tablet-ui from touch capabilities, not viewport width alone.
   Narrow split views retain the existing phone layout. Load this sheet last. */
/* Safari's visible window can be shorter than its layout viewport. Keep the
   world and its controls on the same measured surface, including split view. */
html{width:100%;height:100%;overflow:hidden}
body{
 width:var(--play-width,100vw);height:var(--play-height,100dvh);
 min-height:0;max-height:var(--play-height,100dvh);overflow:hidden;
}
body{position:fixed;inset:var(--play-top,0px) auto auto var(--play-left,0px)}
/* Layout containment makes fixed HUD descendants follow this measured box.
   Avoid paint containment so the illustrated edges and shadows can breathe. */
body.compact-ui{contain:layout}
#scene{inset:0 auto auto 0;width:var(--play-width,100vw);height:var(--play-height,100dvh)}
body.compact-ui #game-controls{position:fixed;inset:auto 0 0}
body.compact-ui .overlay{bottom:auto;height:var(--play-height,100dvh)}
body.compact-ui #moonfair.mf-dialog{
 max-height:calc(var(--play-height,100dvh) - var(--mf-safe-top,0px) - var(--mf-safe-bottom,0px) - var(--mf-window-gap,16px));
}
body.compact-ui #moonfair.mf-dialog.is-fitted{
 height:calc(var(--play-height,100dvh) - var(--mf-safe-top,0px) - var(--mf-safe-bottom,0px) - var(--mf-window-gap,16px));
}
/* Keep the real actions and illustrated controls; keycaps belong to keyboards. */
body.touch-ui kbd,body.compact-ui kbd,
body.touch-ui .keyboard-instructions,body.compact-ui .keyboard-instructions,
body.touch-ui .move-help,body.compact-ui .move-help{display:none!important}

/* Paper still scrolls. Only the instruments that own a drag or a held press
   reserve the finger, so a dip cannot turn into a page pan or a long-press menu. */
body.touch-ui .activity-studio :is(.lantern-canvas,.apple-board,.dance-board,[data-studio-action="bob"]),
body.touch-ui .autumn-extras .ae-gesture,
body.touch-ui #moonfair :is(.mf-stick,.mf-action){
 touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;
}
body.touch-ui :is(#activity-panel,#quest-dialog,#shop-counter,#moonfair){overscroll-behavior:contain;scroll-padding-block:16px}
body.touch-ui #shop-counter :is(button,summary),
body.touch-ui :is(.activity-studio,.autumn-extras) :is(button,summary){min-height:48px}
body.touch-ui .activity-studio .lantern-colors button{width:48px;min-width:48px;height:48px}
body.touch-ui #shop-counter .sc-stitch-star{width:48px;height:48px;min-width:48px}
/* Retain recipe numbers and material labels; only keyboard shortcuts disappear. */
body.touch-ui #shop-counter .sc-control-help .sc-key-help,
body.touch-ui #shop-counter .sc-stir-button>small,
body.touch-ui .activity-studio .dance-controls button>small,
body.touch-ui #moonfair .mf-action>small{display:none}
body.touch-ui #moonfair .mf-action::after{content:'Tap';font:10px/1.3 system-ui,sans-serif;color:#c5d3bc}
body.touch-ui #moonfair .mf-action-guard::after{content:'Hold'}
/* The fitted arena's compact mast must not shrink its invitation hit area.
   A 44px row also fits short split-screen views without stealing the play rail. */
body.touch-ui #moonfair.mf-dialog.is-fitted .mf-connection{min-height:44px}
body.touch-ui #moonfair.mf-dialog.is-fitted .mf-connection .mf-text-button{min-width:72px;min-height:44px;flex:none}

@media (min-width:700px) and (min-height:540px){
 body.tablet-ui{
  --tablet-edge:clamp(16px,2.2vw,28px);
  --tablet-hud-top:calc(86px + var(--safe-top,0px));
  --tablet-dialog-gap:20px;
  --controls-h:164px;
 }

 /* Keep the illustrated satchel, lantern letter and More/Less in one quiet rail. */
 body.tablet-ui.curio-world.compact-ui>header{
  height:calc(76px + var(--safe-top,0px));
  padding:calc(10px + var(--safe-top,0px)) calc(var(--tablet-edge) + var(--safe-right,0px)) 10px calc(var(--tablet-edge) + var(--safe-left,0px));
  flex-direction:row;align-items:center;gap:18px;
 }
 body.tablet-ui.curio-world.compact-ui>header .brand{max-width:230px;flex:0 1 auto;font-size:13px;letter-spacing:1.6px;gap:10px}
 body.tablet-ui.curio-world.compact-ui>header .brandmark{width:38px;height:44px;min-width:38px;font-size:32px}
 body.tablet-ui.curio-world.compact-ui .top-buttons{gap:9px;flex:none;width:auto}
 body.tablet-ui.curio-world.compact-ui .top-buttons #open-satchel{min-width:112px;height:52px;padding-inline:6px 12px}
 body.tablet-ui.curio-world.compact-ui #open-satchel .curio-bag-art{width:40px;height:40px}
 body.tablet-ui.curio-world.compact-ui .top-buttons :is(#sound,#toggle-mobile-view){width:48px;min-width:48px;height:48px}
 body.tablet-ui.curio-world.compact-ui .top-buttons #pause{height:48px;min-width:78px;width:auto;padding-inline:12px}

 /* Touch controls float over the corners; the full-width footer paints no panel. */
 body.tablet-ui.prestige-hud.compact-ui .bottom,
 body.tablet-ui.prestige-hud.compact-ui.simple-controls .bottom{
  position:fixed;inset:auto 0 0;height:calc(var(--controls-h) + var(--safe-bottom,0px));min-height:0;
  display:block;margin:0;padding:0;border:0;background:none;box-shadow:none;pointer-events:none;
 }
 body.tablet-ui.prestige-hud.compact-ui #touch,
 body.tablet-ui.prestige-hud.compact-ui.simple-controls #touch{
  position:absolute;left:calc(var(--tablet-edge) + var(--safe-left,0px));right:auto;
  bottom:calc(16px + var(--safe-bottom,0px));width:148px;display:block;margin:0;pointer-events:auto;
 }
 body.tablet-ui.prestige-hud.compact-ui #touch #thumbstick{width:128px;height:128px;margin:0 auto}
 body.tablet-ui.prestige-hud.compact-ui #touch .pad-caption{font-size:11px;line-height:1.3;margin:0 0 5px}
 body.tablet-ui.prestige-hud.compact-ui #touch>small{display:none}
 body.tablet-ui.prestige-hud.compact-ui:not(.using-stick) #touch{width:160px}
 body.tablet-ui.prestige-hud.compact-ui #touch .direction-pad{grid-template-columns:repeat(3,48px);grid-template-rows:repeat(2,48px);gap:5px;justify-content:center}
 body.tablet-ui.prestige-hud.compact-ui #touch .direction-pad button{width:48px;min-width:48px;height:48px;font-size:26px}
 body.tablet-ui.prestige-hud.compact-ui .actions,
 body.tablet-ui.prestige-hud.compact-ui.simple-controls .actions{
  position:absolute;right:calc(var(--tablet-edge) + var(--safe-right,0px));left:auto;
  bottom:calc(20px + var(--safe-bottom,0px));display:grid;width:344px;max-width:calc(var(--play-width,100vw) - 218px - var(--safe-left,0px) - var(--safe-right,0px));
  grid-template-columns:88px minmax(0,1fr) minmax(0,1fr);grid-template-rows:52px 52px;
  gap:8px;align-items:stretch;margin:0;pointer-events:auto;
 }
 body.tablet-ui.prestige-hud.compact-ui .actions button,
 body.tablet-ui.prestige-hud.compact-ui.simple-controls .actions button{
  width:auto;min-width:0;height:52px;min-height:48px;flex-basis:auto;padding:7px 8px;gap:5px;
  flex-direction:row;justify-content:center;align-items:center;
 }
 body.tablet-ui.prestige-hud.compact-ui .actions button>i{display:block;flex:none}
 body.tablet-ui.prestige-hud.compact-ui .actions button>i .field-icon{width:23px;height:25px}
 body.tablet-ui.prestige-hud.compact-ui .actions button>span{font-size:14px;line-height:1.15;min-width:0;overflow-wrap:anywhere}
 body.tablet-ui.prestige-hud.compact-ui .actions button[data-action=scare]{grid-column:1!important;grid-row:1/3!important;height:112px!important;flex-direction:column}
 body.tablet-ui.prestige-hud.compact-ui .actions button[data-action=scare]>i .field-icon{width:32px;height:34px}
 body.tablet-ui.prestige-hud.compact-ui .actions button[data-action=scare]>span{font-size:22px}
 body.tablet-ui.prestige-hud.compact-ui .actions button[data-action=jump]{grid-column:2!important;grid-row:1!important}
 body.tablet-ui.prestige-hud.compact-ui .actions button[data-action=crouch]{grid-column:3!important;grid-row:1!important}
 body.tablet-ui.prestige-hud.compact-ui .actions button[data-action=dance]{grid-column:3!important;grid-row:2!important}
 body.tablet-ui.prestige-hud.compact-ui .actions #nearby-action{grid-column:2!important;grid-row:2!important;width:auto;height:52px;flex-direction:row}
 body.tablet-ui.prestige-hud.compact-ui .actions #nearby-action>small{display:none}
 /* Less keeps its meaning: three essential actions, smaller corners, no extra HUD. */
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui{--controls-h:148px}
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui #touch #thumbstick{width:116px;height:116px}
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui .actions,
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui.simple-controls .actions{width:300px;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:52px 48px}
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui .actions button[data-action=scare]{grid-column:1!important;grid-row:1!important;height:52px!important;flex-direction:row}
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui .actions button[data-action=scare]>i .field-icon{width:25px;height:27px}
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui .actions button[data-action=scare]>span{font-size:19px}
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui .actions #nearby-action{grid-column:1/-1!important;grid-row:2!important;height:48px}

 /* The same paper essence label, with legible numbers instead of a phone-sized card. */
 body.tablet-ui.prestige-hud.compact-ui .status{top:var(--tablet-hud-top);left:calc(var(--tablet-edge) + var(--safe-left,0px));width:218px;padding:12px 14px 9px}
 body.tablet-ui.prestige-hud.compact-ui .status h2{font-size:19px}
 body.tablet-ui.prestige-hud.compact-ui .status #essence-number{font-size:18px}
 body.tablet-ui.prestige-hud.compact-ui .status .survival-readout{font-size:10px}
 body.tablet-ui.prestige-hud.compact-ui .status .survival-readout strong{font-size:11px}
 body.tablet-ui.prestige-hud.compact-ui .status .stats strong{font-size:17px}
 body.tablet-ui.prestige-hud.compact-ui .status .stats small{font-size:8px}
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui .status{width:178px;padding:9px 11px 8px}
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui .status h2{font-size:15px}
 body.tablet-ui.mobile-clear-view.prestige-hud.compact-ui .status #essence-number{font-size:17px}
 body.tablet-ui.prestige-hud.compact-ui #coven-hud{top:var(--tablet-hud-top);right:calc(var(--tablet-edge) + var(--safe-right,0px))}
 body.tablet-ui.mobile-clear-view.compact-ui.in-forest #coven-hud{top:var(--tablet-hud-top);bottom:auto}
 body.tablet-ui.compact-ui #spook-wheel{right:calc(var(--tablet-edge) + var(--safe-right,0px));max-height:calc(var(--play-height,100dvh) - 270px - var(--safe-top,0px) - var(--safe-bottom,0px));width:276px;overscroll-behavior:contain}
 body.tablet-ui.compact-ui #coven-hud-heading button{min-height:44px;min-width:44px}
 body.tablet-ui.prestige-hud.compact-ui #prompt{left:50%;bottom:calc(var(--controls-h) + 12px + var(--safe-bottom,0px));max-width:min(460px,calc(var(--play-width,100vw) - 48px));min-height:48px;font-size:14px}
 body.tablet-ui.prestige-hud.compact-ui #toast{left:50%;bottom:calc(var(--controls-h) + 66px + var(--safe-bottom,0px));max-width:min(500px,calc(var(--play-width,100vw) - 48px));font-size:14px}
 body.tablet-ui .first-night-guide{top:var(--tablet-hud-top);bottom:auto;width:280px;max-width:calc(var(--play-width,100vw) - 490px - var(--safe-left,0px) - var(--safe-right,0px))}
 body.tablet-ui .first-night-guide-dismiss{min-width:44px;width:44px;min-height:44px}

 /* A lesson rests beside the view. It never stretches across the whole sky. */
 body.tablet-ui.compact-ui.in-tutorial #tutorial-guide{
  top:var(--tablet-hud-top);left:auto;right:calc(var(--tablet-edge) + var(--safe-right,0px));bottom:auto;
  width:330px;max-width:calc(var(--play-width,100vw) - 48px);max-height:calc(var(--play-height,100dvh) - 272px - var(--safe-top,0px) - var(--safe-bottom,0px));
  padding:17px 20px;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;scroll-padding-block:14px;
 }
 body.tablet-ui.in-tutorial #tutorial-title{font-size:29px;line-height:1.1;margin:10px 0}
 body.tablet-ui.in-tutorial #tutorial-hint{font-size:14px;line-height:1.5}
 body.tablet-ui.in-tutorial #tutorial-next{min-height:48px;font-size:14px}
 body.tablet-ui #tutorial-stations .tutorial-other-games{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
 body.tablet-ui #tutorial-stations button{min-height:48px}
 body.tablet-ui.prestige-hud.compact-ui .journal.pu-journal-open,
 body.tablet-ui.prestige-hud.compact-ui.in-coven .journal.pu-journal-open{
  top:var(--tablet-hud-top);left:auto;right:calc(var(--tablet-edge) + var(--safe-right,0px));bottom:auto;
  width:360px;max-width:calc(var(--play-width,100vw) - 48px);max-height:calc(var(--play-height,100dvh) - 116px - var(--safe-top,0px) - var(--safe-bottom,0px));
  padding:18px 22px 20px 27px;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;
 }

 /* Rituals get a real painted playboard, while all their controls remain scrollable. */
 body.tablet-ui.curio-world.compact-ui #activity-panel,
 body.tablet-ui.compact-ui #quest-dialog{
  position:fixed;top:var(--tablet-hud-top);bottom:auto;left:50%;right:auto;transform:translateX(-50%);
  width:min(640px,calc(var(--play-width,100vw) - 2 * var(--tablet-edge) - var(--safe-left,0px) - var(--safe-right,0px)));
  max-width:none;max-height:calc(var(--play-height,100dvh) - 108px - var(--safe-top,0px) - var(--safe-bottom,0px));
  padding:24px 28px;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;scroll-padding-block:16px;
 }
 body.tablet-ui.compact-ui :is(#activity-panel,#quest-dialog) h2{font-size:36px;line-height:1.12}
 body.tablet-ui #activity-description{max-width:46ch;margin-inline:auto!important}
 body.tablet-ui #activity-status{font-size:14px;line-height:1.5}
 body.tablet-ui :is(#leave-activity,#close-quest-dialog){min-width:48px;min-height:48px;right:12px;top:8px}
 body.tablet-ui #quest-dialog :is(p,#quest-dialog-text,#quest-dialog-goal){font-size:14px;line-height:1.65}
 body.tablet-ui #quest-dialog-action{min-height:50px}
 body.tablet-ui .activity-studio :is(.carving-board,.apple-board,.dance-board){width:min(100%,520px);max-width:none;max-height:none;height:auto;min-height:0;margin-inline:auto}
 body.tablet-ui .activity-studio .carving-board{aspect-ratio:16/9}
 body.tablet-ui .activity-studio .apple-board{aspect-ratio:460/300}
 body.tablet-ui .activity-studio .dance-board{aspect-ratio:460/240}
 body.tablet-ui .autumn-extras .ae-ritual{padding:16px 18px}
 body.tablet-ui .autumn-extras .ae-polish-board{width:min(100%,290px)}
 body.tablet-ui .autumn-extras :is(.ae-sky,.ae-orchard-card){height:clamp(235px,29dvh,310px)}
 body.tablet-ui .autumn-extras .ae-cider-stage{height:145px}
 body.tablet-ui :is(.activity-studio,.autumn-extras) :is(button,summary){min-height:48px}

 /* Native books and counters keep their own page furniture and painted borders. */
 body.tablet-ui :is(#settings-dialog,#feedback-dialog,#coven-dialog,#autumn-almanac,#shop-counter,#curio-satchel){
  max-height:calc(var(--play-height,100dvh) - 2 * var(--tablet-dialog-gap) - var(--safe-top,0px) - var(--safe-bottom,0px));
  overscroll-behavior:contain;touch-action:pan-y;scroll-padding-block:24px;
 }
 body.tablet-ui #settings-dialog.curio-console{width:min(660px,calc(var(--play-width,100vw) - 48px - var(--safe-left,0px) - var(--safe-right,0px)));padding:30px 34px 25px}
 body.tablet-ui #feedback-dialog{width:min(640px,calc(var(--play-width,100vw) - 48px - var(--safe-left,0px) - var(--safe-right,0px)))}
 body.tablet-ui #coven-dialog.curio-post-office{width:min(620px,calc(var(--play-width,100vw) - 48px - var(--safe-left,0px) - var(--safe-right,0px)))}
 body.tablet-ui #autumn-almanac{top:calc(var(--tablet-dialog-gap) + var(--safe-top,0px));width:min(980px,calc(var(--play-width,100vw) - 48px - var(--safe-left,0px) - var(--safe-right,0px)))}
 body.tablet-ui #shop-counter.sc-market{width:min(1100px,calc(var(--play-width,100vw) - 48px - var(--safe-left,0px) - var(--safe-right,0px)))}
 body.tablet-ui #shop-counter .sc-paper{padding:24px 30px 20px}
 body.tablet-ui #shop-counter .sc-shop-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}
 body.tablet-ui #shop-counter .sc-card-description{font-size:12px;line-height:1.6;min-height:0}
 body.tablet-ui #shop-counter .sc-visit{min-height:48px;font-size:12px!important}
 body.tablet-ui #shop-counter :is(.sc-primary,.sc-seal-button,.sc-bottle-button){min-height:50px}
 body.tablet-ui #shop-counter .sc-stitch-board{width:min(100%,680px)}
 body.tablet-ui #progress-overlay .progress-modal.curio-cabinet{
  width:min(1000px,calc(var(--play-width,100vw) - 48px - var(--safe-left,0px) - var(--safe-right,0px)));max-width:none;
  max-height:calc(var(--play-height,100dvh) - 40px - var(--safe-top,0px) - var(--safe-bottom,0px));padding:26px 30px 22px;overflow:auto;scroll-padding-top:90px;
 }
 body.tablet-ui #progress-overlay .curio-tab{min-height:58px;font-size:14px;gap:10px}
 body.tablet-ui :is(#settings-dialog,#coven-dialog,#progress-overlay,#feedback-dialog) :is(input[type=text],input[type=url],select,textarea){font-size:16px}
 body.tablet-ui #night-post{width:min(820px,calc(var(--play-width,100vw) - 48px - var(--safe-left,0px) - var(--safe-right,0px)));height:min(880px,calc(var(--play-height,100dvh) - 40px - var(--safe-top,0px) - var(--safe-bottom,0px)))}
 body.tablet-ui #night-post .np-message{font-size:14px;line-height:1.75}
 body.tablet-ui #overlay .modal{max-height:calc(var(--play-height,100dvh) - 40px - var(--safe-top,0px) - var(--safe-bottom,0px));overflow:auto}
 body.tablet-ui #overlay .modal.curio-entry{width:min(1060px,calc(var(--play-width,100vw) - 48px - var(--safe-left,0px) - var(--safe-right,0px)));height:auto;overflow:auto}

 /* The fully opened satchel becomes three loose rows of illustrated objects.
    Early first-night stages keep their deliberately small selection. */
 body.tablet-ui #curio-satchel.curio-satchel{width:min(1000px,calc(var(--play-width,100vw) - 40px - var(--safe-left,0px) - var(--safe-right,0px)));padding:8px 22px 20px;overflow:auto}
 body.tablet-ui #curio-satchel .curio-satchel-top{position:sticky;top:-8px;background:linear-gradient(#163036f5,#173137eb 75%,transparent)}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-satchel-orbit{height:auto;min-height:0;margin-top:0;padding-bottom:8px}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-satchel-heading{position:relative;left:auto;top:auto;transform:none;width:100%;min-height:0;padding:12px 0 26px;margin:0 auto}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-satchel-heading>.curio-bag-art{width:96px;height:72px}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-satchel-heading h2{font-size:42px}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-almanac-bookmark{width:310px;max-width:100%;margin:17px auto 0}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-satchel-pockets{position:relative;inset:auto;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:26px 20px;padding:0 0 18px}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] button.curio-pocket{position:relative;left:auto;top:auto;translate:none;transform:none;width:100%;min-height:164px;margin:0;padding:0 0 10px;grid-column:auto;justify-self:auto}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-pocket-art{width:138px;height:104px}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-pocket-copy strong{font-size:25px}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-pocket-copy small{font-size:11px;max-width:190px}

 /* Only placement changes here: the forest owns its hourglass and danger signals. */
 body.tablet-ui.prestige-hud.compact-ui #forest-watch{top:var(--tablet-hud-top);left:calc(var(--tablet-edge) + var(--safe-left,0px));right:auto;width:360px;max-width:calc(var(--play-width,100vw) - 400px - var(--safe-left,0px) - var(--safe-right,0px))}
 body.tablet-ui.compact-ui .forest-controls{right:calc(var(--tablet-edge) + var(--safe-right,0px));bottom:calc(20px + var(--safe-bottom,0px));width:344px;max-width:none;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:none;gap:8px}
 body.tablet-ui.compact-ui .forest-controls :is(.fr-cast,.fr-dodge,.fr-burst){grid-column:auto;grid-row:auto;min-height:88px;padding:10px 7px;flex-direction:column;justify-content:center;gap:5px}
 body.tablet-ui.compact-ui .forest-controls button strong{font-size:15px}
 body.tablet-ui.mobile-clear-view.compact-ui .forest-controls :is(.fr-cast,.fr-dodge,.fr-burst){min-height:76px}
}

@media (min-width:700px) and (max-width:900px) and (min-height:540px){
 body.tablet-ui.curio-world.compact-ui>header .brand{max-width:180px;font-size:12px;letter-spacing:1.1px}
 body.tablet-ui.curio-world.compact-ui .top-buttons{gap:7px}
 body.tablet-ui .first-night-guide{max-width:260px;top:auto;bottom:calc(var(--controls-h) + 16px + var(--safe-bottom,0px))}
 body.tablet-ui.compact-ui.in-tutorial #tutorial-guide{width:310px}
 body.tablet-ui #progress-overlay .progress-modal.curio-cabinet{padding-inline:24px}
 body.tablet-ui #progress-overlay .curio-tab{font-size:12px;gap:7px}
}

@media (min-width:960px) and (min-height:540px) and (orientation:landscape){
 body.tablet-ui #shop-counter .sc-shop-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
}

@media (min-width:700px) and (min-height:540px) and (max-height:850px){
 body.tablet-ui.curio-world.compact-ui #activity-panel{padding:19px 26px}
 body.tablet-ui .activity-studio :is(.carving-board,.apple-board,.dance-board){width:min(100%,460px)}
 body.tablet-ui .autumn-extras :is(.ae-sky,.ae-orchard-card){height:235px}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-satchel-heading{padding-block:10px 20px}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-satchel-heading>.curio-bag-art{display:none}
 body.tablet-ui #curio-satchel[data-first-night-stage="3"] .curio-pocket-art{width:126px;height:95px}
}

body.touch-ui .mf-keyboard-help{display:none}
/* Native dialogs live above the measured body. Keep their top edge visible
   when the iPad browser or software keyboard shortens the visible window. */
body.compact-ui dialog[open]{
 inset-block-start:calc(12px + var(--safe-top,0px));inset-block-end:auto;
 margin-block:0;
 max-height:calc(var(--play-height,100dvh) - 24px - var(--safe-top,0px) - var(--safe-bottom,0px));
}
body.compact-ui #moonfair.mf-dialog.is-fitted[open]{
 inset-block-start:calc(var(--mf-safe-top,0px) + var(--mf-window-gap,16px) * .5);
 max-height:calc(var(--play-height,100dvh) - var(--mf-safe-top,0px) - var(--mf-safe-bottom,0px) - var(--mf-window-gap,16px));
}

/* Modal dialogs escape body containment into the browser's top layer. Their
   visual origin must follow the same keyboard/browser pan, exactly once. */
body.compact-ui dialog:modal{translate:var(--play-left,0px) var(--play-top,0px)}

/* A short phone has two useful thumb corners and very little vertical space. */
@media (min-width:500px) and (max-height:550px) and (orientation:landscape){
 body.compact-ui #activity-panel{width:min(860px,calc(var(--play-width,100vw) - 24px));top:calc(56px + var(--safe-top,0px));max-height:calc(var(--play-height,100dvh) - 68px - var(--safe-top,0px) - var(--safe-bottom,0px));padding:10px 14px}
 body.compact-ui #activity-panel #activity-title{font-size:24px;line-height:1.1;margin:0 0 7px;padding-right:150px}
 body.compact-ui #activity-panel #activity-reward{position:absolute;top:14px;right:65px;margin:0;font-size:11px!important;line-height:1.2!important}
 body.compact-ui #activity-panel #activity-note{font-size:11px!important;line-height:1.3!important;margin:4px 0 0!important}
 body.compact-ui #activity-panel #leave-activity{top:6px;right:8px;width:44px;height:44px;min-height:44px;padding:0}
}
