/* Keep the authored game canvas stable when mobile browsers inflate text.
   100% disables heuristic text inflation, not pinch/page zoom. The viewport
   remains zoomable; enlarged text in reading windows can still wrap/reflow. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}

@media(max-width:700px){
 /* A fixed pixel line box can crop glyphs after a font change or fallback. */
 html body .mobile-hud-layout.mobile-hud-layout .palace-person>span>strong{line-height:1.2!important}
 html body .mobile-hud-layout.mobile-hud-layout .palace-birth-inline{line-height:1.5!important}
 html body .mobile-hud-layout.mobile-hud-layout .palace-person-context{line-height:1.45!important}
 html body .mobile-hud-layout.mobile-hud-layout .palace-stats>span{line-height:1.4!important}
 html body .mobile-hud-layout.mobile-hud-layout .palace-stats b{line-height:1.25!important}
 html body .mobile-hud-layout.mobile-hud-layout .palace-authority strong{line-height:1.25!important}

 /* Reading windows grow internally; their header/footer remain reachable. */
 html body :is(#modal,.palace-sheet) :is(h2,h3,p,summary,label,dt,dd){overflow-wrap:anywhere;word-break:keep-all}
 html body :is(#modal,.palace-sheet) :is(.modal-top,.palace-sheet-body,.window-reading-body){min-width:0}
 html body :is(#modal,.palace-sheet) .modal-top{gap:12px!important;align-items:flex-start!important}
 html body :is(#modal,.palace-sheet) .modal-top h2{min-width:0;line-height:1.4!important}
 html body :is(#modal,.palace-sheet) .modal-top>button{flex:none;line-height:1.4!important}
 html body :is(#modal,.palace-sheet)[data-content="person"] .person-compact .character-details{grid-template-rows:minmax(44px,max-content) minmax(0,1fr)!important}
 html body :is(#modal,.palace-sheet) .person-detail-tabs{align-items:stretch!important}
 html body :is(#modal,.palace-sheet) .person-detail-tabs button{
  height:auto!important;max-height:none!important;min-height:44px!important;
  line-height:1.4!important;white-space:normal!important;overflow-wrap:anywhere;
 }
 html body :is(#modal,.palace-sheet) :is(.modal-actions,.crew-actions){flex-wrap:wrap}
 html body :is(#modal,.palace-sheet) :is(.palace-confirm,.modal-actions>button){
  min-width:0;max-width:100%;height:auto!important;min-height:44px;
  line-height:1.4!important;white-space:normal!important;overflow-wrap:anywhere;
 }
 html body :is(#modal,.palace-sheet) input:not([type=range]):not([type=checkbox]):not([type=radio]),
 html body :is(#modal,.palace-sheet) select{font-size:max(16px,1rem)}
}

/* Respect explicit system/WebView text enlargement. Only that mode gives the
   authored game surface natural height; ordinary portrait stays one screen. */
@media(max-width:700px) and (orientation:portrait){
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type{
  display:grid!important;grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:repeat(7,max-content)!important;
  align-content:start!important;gap:10px!important;padding:0 8px 12px!important;
  overflow-y:auto!important;overflow-x:hidden!important;scroll-padding-block:12px;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-header{
  position:relative!important;inset:auto!important;grid-row:1!important;
  height:auto!important;min-height:50px!important;grid-template-rows:auto auto!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-header>strong{white-space:normal!important;line-height:1.3!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-upper{
  position:relative!important;inset:auto!important;grid-row:2!important;height:auto!important;
  display:grid!important;grid-template-columns:minmax(0,1fr) 40px!important;
  grid-template-rows:repeat(3,max-content)!important;gap:8px!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-person{
  position:relative!important;inset:auto!important;grid-column:1!important;grid-row:1!important;
  width:100%!important;height:auto!important;min-height:104px!important;max-height:none!important;
  align-items:start!important;overflow:visible!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-person>span>strong{padding-right:0!important;min-height:0!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-person-context{white-space:normal!important;overflow:visible!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-birth-inline{white-space:normal!important;flex-wrap:wrap!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-stats{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:4px!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-stats>span{grid-template-rows:auto auto!important;min-height:0!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .room-guide{
  position:relative!important;inset:auto!important;grid-column:1!important;grid-row:2!important;
  width:100%!important;min-width:0!important;height:auto!important;min-height:44px!important;max-height:none!important;
  display:flex!important;justify-content:center!important;align-items:center!important;gap:8px!important;padding:8px!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .room-guide>i{
  width:auto!important;height:auto!important;writing-mode:horizontal-tb!important;line-height:1.4!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .room-guide>span{line-height:1.4!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-upper>.palace-faction-status{
  position:relative!important;inset:auto!important;grid-column:1/-1!important;grid-row:3!important;
  width:100%!important;max-width:none!important;height:auto!important;min-height:44px!important;
  grid-template-rows:auto auto!important;padding:6px!important;gap:5px!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-upper>.palace-authority{
  position:relative!important;inset:auto!important;grid-column:2!important;grid-row:2!important;
  width:40px!important;height:auto!important;max-height:none!important;min-height:44px!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-upper>.residence-regalia{position:relative!important;inset:auto!important;grid-column:2!important;grid-row:1!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .affairs-hud{
  position:relative!important;inset:auto!important;grid-row:3!important;width:100%!important;
  height:auto!important;min-height:44px!important;flex-wrap:wrap!important;justify-content:center!important;
  padding:8px!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .affairs-hud-values{width:100%;gap:6px!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .room-location{
  grid-row:4!important;height:auto!important;min-height:44px!important;padding:8px 0!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .room-name{line-height:1.3!important;overflow-wrap:anywhere}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-desk{
  grid-row:5!important;height:auto!important;min-height:510px!important;overflow:visible!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-card-deck{height:auto!important;min-height:400px!important;align-items:stretch!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-card-deck .palace-command:not([data-management]){
  height:auto!important;min-height:400px!important;max-height:none!important;
  grid-template-rows:minmax(110px,1fr) minmax(56px,max-content) minmax(26px,max-content) minmax(20px,max-content) minmax(36px,max-content)!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-command:not([data-management])>:is(strong,.palace-command-rate,.command-paths,.palace-command-growth){
  height:auto!important;max-height:none!important;line-height:1.35!important;overflow:visible!important;white-space:normal!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-command:not([data-management])>strong{align-self:center!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-rooms{
  grid-row:6!important;position:relative!important;inset:auto!important;height:auto!important;
  display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:auto auto!important;gap:8px!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-rooms>button{grid-row:auto!important;grid-column:auto!important;min-height:58px!important;height:auto!important;padding-block:10px!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-footer{
  grid-row:7!important;position:relative!important;inset:auto!important;height:auto!important;min-height:60px!important;
  display:flex!important;flex-direction:column!important;gap:8px!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-slots{width:100%!important;min-height:50px!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-footer>*{flex-shrink:0!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-finish{width:100%!important;min-height:48px!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type .palace-finish button{height:auto!important;min-height:48px!important;line-height:1.4!important;white-space:normal!important}
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type.is-lobby .room-lobby{
  position:relative!important;inset:auto!important;grid-row:5!important;min-height:560px!important;
 }
 html body .mobile-hud-layout.mobile-hud-layout.has-enlarged-type.is-room-result .palace-desk{min-height:620px!important}
}
