/* Mobile is a bounded app: only the reading/puzzle area scrolls.
   Ads remain in normal document flow, outside the app and its 160px gaps. */
.mobile-work-title{display:none}.mobile-story-visual{display:none}
@media(max-width:850px){
 html,body{min-width:0;overflow-anchor:none;scroll-behavior:auto}body{padding:0;background:var(--cream)}
 .app-shell{display:flex;flex-direction:column;width:100%;max-width:650px;height:var(--app-height,100svh);min-height:0;margin:0 auto;padding:0;overflow:hidden}
 /* Beat-specific legacy rules also use two classes. Keep the desktop panel
    out of the mobile flex layout even on important lines and both endings. */
 .app-shell>.scene-panel{display:none}
 .game-panel{flex:1;display:flex;flex-direction:column;width:100%;height:100%;min-height:0;overflow:hidden;padding:0;border:0;border-radius:0;box-shadow:none}
 .game-panel>.site-breadcrumb{order:0;flex-shrink:0;padding:7px 14px 0;font-size:9px;line-height:1.5}
 .game-header{order:1;flex-shrink:0;min-height:58px;padding:7px 14px 9px;gap:8px}
 .mobile-work-title{display:block;font-size:11px;color:var(--green);font-family:serif;letter-spacing:.05em}.label-overline{display:none}.chapter-label strong{font-size:12px;line-height:1.5}.small-button{min-width:40px;min-height:40px;padding:6px 9px;font-size:17px}.small-button span{display:none}
 .header-progress{order:2;flex-shrink:0;height:3px}
 .game-panel .toast{order:3;position:static;flex-shrink:0;width:auto;margin:0;padding:6px 12px;border:0;border-radius:0;font-size:12px;line-height:1.5;box-shadow:none;pointer-events:none}
 .view-area{order:4;flex:1 1 0;min-width:0;min-height:0;overflow-y:auto;overflow-x:hidden;padding:14px 16px 20px;-webkit-overflow-scrolling:touch;overscroll-behavior-y:contain;scroll-padding-block:12px;touch-action:pan-y}
 .view-section{animation:none;min-width:0}.section-heading{margin-bottom:12px;padding-bottom:7px}.section-heading>.small-kicker{display:none}.section-heading h2{font-size:18px;line-height:1.6}
 .story-content{min-height:0;gap:12px}.is-dialogue-reading .story-content>.narration:not([data-current-line]),.is-dialogue-reading .story-content>.dialogue:not([data-current-line]){display:none}
 .dialogue{max-width:100%;width:auto}.speech{padding:12px 14px;font-size:15px;line-height:1.85}.narration{padding:12px 14px;font-size:15px;line-height:1.9}.speaker{font-size:12px}.story-content .achievement{margin:0;font-size:12px}.view-section>.sub-hint{display:none}
 .mobile-story-visual:not([hidden]){position:relative;display:block;width:100%;height:140px;margin:0 0 14px;overflow:hidden;border:1px solid #d4c4a5;border-radius:12px;background:#163e31}
 .mobile-story-visual .scene-artwork{position:static;display:block;inset:auto;height:100%;width:100%;max-height:none;margin:0;background:#163e31}
 .mobile-story-visual .scene-artwork:after{display:none}.mobile-story-visual .scene-illustration{display:block;width:100%;height:100%;max-height:none;object-fit:cover;object-position:center 35%}
 .mobile-art-expand{position:absolute;right:8px;bottom:8px;min-height:36px;padding:6px 10px;border:1px solid #e9d2a088;border-radius:7px;background:#133d31eb;color:#fff8e9;font-size:11px}
 .mobile-story-intro{height:100%;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:14px 18px;text-align:center;color:#fff5df;background:radial-gradient(ellipse at 20% 20%,#3a6147,#113d2f)}.mobile-story-intro span{color:#d4b271;font-size:9px;letter-spacing:.2em}.mobile-story-intro p{width:100%;font-family:serif;font-size:clamp(13px,4vw,17px);line-height:1.8;letter-spacing:.025em;margin:8px 0 0;text-align:center;overflow-wrap:anywhere}
 .game-controls{order:5;position:relative;flex:0 0 auto;left:auto;right:auto;top:auto;bottom:auto;width:100%;max-width:none;margin:0;transform:none;will-change:auto;box-shadow:0 -2px 12px #00000008;background:var(--paper)}
 .game-controls .story-actions{padding:8px 14px;border-top:1px solid var(--line)}.game-controls .btn{min-height:46px;font-size:14px}
 .game-controls .bottom-nav{position:static;padding:5px 8px max(5px,env(safe-area-inset-bottom));gap:4px;box-shadow:none}.nav-button{min-height:48px;padding:3px 1px;font-size:10px;line-height:1.35}.nav-symbol{font-size:20px;line-height:1.25}
 .scene-puzzle{position:static;inset:auto;width:100%;min-width:0;max-height:none;overflow:visible;margin:0 0 18px;padding:0;border:0;border-radius:0;box-shadow:none;background:transparent;color:var(--ink)}
 .scene-puzzle .chapter-module{max-width:100%}.chapter-module .ch1-mug-viewport{height:min(68vw,280px)}.chapter-module .ch1-face{min-height:42px}
 .chapter-module form input,.chapter-module input{font-size:18px;min-height:48px;scroll-margin-block:12px}.chapter-module form{min-width:0}.chapter-module .ch3-turn,.chapter-module .ch4-edit{min-height:44px}
 .inventory-item{min-height:100px}.item-label{font-size:11px}.detail-card{min-height:0;padding:14px}.item-actions .btn-mini{min-height:42px}.intro-copy{font-size:12px;line-height:1.8}
 .modal-dialog{position:fixed;width:min(480px,calc(100vw - 24px));max-height:calc(var(--app-height,100svh) - 24px);margin:auto;border-radius:14px}.modal-head{padding:11px 14px}.close-button{width:42px;height:42px}.modal-body{padding:14px;max-height:calc(var(--app-height,100svh) - 95px);overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
 .is-keyboard-open .site-breadcrumb{display:none}.is-keyboard-open .game-header{min-height:58px;padding-block:5px}.is-keyboard-open .small-button{min-height:34px}.is-keyboard-open .bottom-nav{padding-block:3px}.is-keyboard-open .nav-button{min-height:38px}.is-keyboard-open .nav-symbol{font-size:17px}
 .answer-result{margin:0;padding:22px 14px}.completion-card{padding-top:0}.completion-card h3{font-size:21px}
}
@media(max-width:850px) and (max-height:600px){.mobile-story-visual:not([hidden]){height:95px}.game-header{min-height:50px}.view-area{padding-top:10px}}

/* After the final line the game becomes a document: no small inner viewport,
   no game controls, and no scroll trapping while reading the thanks/credits. */
@media(max-width:850px){
 .is-complete .app-shell{height:auto;min-height:var(--app-height,100svh);overflow:visible}
 .is-complete .game-panel{flex:none;height:auto;min-height:var(--app-height,100svh);overflow:visible}
 .is-complete .view-area{flex:none;min-height:0;overflow:visible;overscroll-behavior-y:auto;padding:24px 20px 36px}
 .is-complete .game-controls{display:none}
 .is-complete .header-controls .small-button{font-size:13px;min-height:44px}
 .is-complete .header-controls .small-button span{display:inline}
 .is-complete .section-heading{margin-bottom:24px;padding-bottom:14px}
 .is-complete .section-heading h2{font-size:21px;line-height:1.7}
 .is-complete .completion-card>h3{font-size:24px;line-height:1.75;margin:12px 0 24px}
 .is-complete .completion-card p{font-size:15px;line-height:2}
 .is-complete .completion-card .completion-note{font-size:12px}
 .is-complete .completion-card .small-kicker{font-size:10px}
 .is-complete .completion-card .completion-keepsake{font-size:18px}
 .is-complete .completion-image{width:100%;margin:24px auto}
 .is-complete .completion-share .btn{min-height:50px;font-size:15px}
 .is-complete .ending-travel-grid{grid-template-columns:minmax(0,1fr)}
 .is-complete .ending-travel-link{padding:18px}
 .is-complete .ending-travel-link p,.is-complete .completion-travel-intro{font-size:14px}
 .is-complete .completion-credits .credit-role,.is-complete .completion-credits .credit-publisher{font-size:13px}
}
