/* Safe areas include the notch and the home indicator in either orientation. */
/* Portrait stories scroll as one document, starting below the iPhone status bar. */
@media(max-width:700px) and (orientation:portrait){
 dialog#campaign-story[open]{inset:0;margin:0;width:100%;height:100dvh;max-height:100dvh;box-sizing:border-box;padding:calc(env(safe-area-inset-top,0px) + 14px) max(14px,env(safe-area-inset-right,0px)) calc(env(safe-area-inset-bottom,0px) + 20px) max(14px,env(safe-area-inset-left,0px));overflow-x:hidden;overflow-y:auto;scroll-padding-top:calc(env(safe-area-inset-top,0px) + 14px)}
 #campaign-story .story-layout{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;min-height:0;height:auto;gap:14px}
 #campaign-story #story-art{flex:none;width:100%;max-height:none;margin:0}
 #campaign-story #story-art #story-model{display:block;width:100%;height:auto;max-height:none;touch-action:pan-y;animation:none;transform:none}
 #campaign-story .story-copy{flex:none;max-height:none;overflow:visible}
 #campaign-story #story-text{max-height:none;overflow:visible}
}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
button,summary{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
#board{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;touch-action:none}
body.battle-screen{height:100vh;height:100dvh}
body.battle-screen>main{padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
dialog:not(#field-story){max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 24px);overscroll-behavior:contain}
#field-story .scene-heading{top:max(10px,env(safe-area-inset-top));left:max(18px,env(safe-area-inset-left));right:max(18px,env(safe-area-inset-right))}
#field-story .scene-caption{bottom:max(8px,env(safe-area-inset-bottom));width:min(900px,calc(100% - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px) - 24px))}
.scene-navigation{flex-wrap:wrap}.scene-navigation small{flex:1}
#opening-talk{position:absolute;z-index:6;left:10px;bottom:10px;width:min(340px,calc(100% - 20px));padding:12px 14px;border:1px solid #c0a57499;border-radius:9px;background:#182e27f5;box-shadow:0 3px 16px #0006;font:13px/1.4 system-ui;color:#ecdfc2}
#opening-talk strong{color:#e3bd79}#opening-talk p{margin:6px 0 9px}#opening-talk>div{display:flex;justify-content:space-between;gap:8px}#opening-talk button{font-size:12px;min-height:36px;padding:6px 12px}
@media(pointer:coarse){
 #field-camera-controls button,#chapter-four-bottom button,.chapter-four-layout #game>.hud button{min-height:44px}
 #field-camera-controls{top:6px;right:6px}
 #field-zoom{min-height:36px;margin:5px 0}
 #chapter-four-bottom{flex-wrap:wrap;gap:4px;padding:4px 6px}
 #chapter-four-tools{flex-wrap:wrap;gap:4px}
 #chapter-four-bottom #start,#chapter-four-bottom #pause{min-width:115px}
 #chapter-four-bottom #section-options{flex-basis:100%}
 #chapter-four-bottom #section-options select{font-size:16px}
 #chapter-four-weapon{max-width:150px;overflow:hidden;text-overflow:ellipsis}
 #battle-controls button,#battle-controls select{min-height:44px}
 select,input:not([type=range]):not([type=checkbox]){font-size:16px}
 .chapter-four-layout #game>.hud{height:auto;min-height:46px}
 #opening-talk{max-width:300px}
}
@media(max-width:540px){.scene-navigation small{display:none}.scene-navigation{gap:6px}.scene-navigation button{min-height:44px;padding:8px 11px}#chapter-four-wave-actions{margin-left:auto}}
@media(max-height:500px) and (pointer:coarse){
 .scene-heading h2{font-size:17px;margin-top:2px}.scene-heading small{font-size:9px}
 .scene-caption{padding:7px 12px}#scene-line{font-size:15px;min-height:22px;margin:2px 0 5px}
 .scene-navigation button{min-height:36px;padding:5px 12px}.scene-progress{margin-top:5px}
 .scene-heading button{min-height:36px}.scene-navigation small{font-size:10px}
 #opening-talk{font-size:12px;width:300px;padding:8px 12px;bottom:6px}#opening-talk p{margin:4px 0}
 #chapter-four-bottom{max-height:35dvh;overflow:auto}
}

