/* A phone inspector shares the available height with the board. It never
   covers the field with an absolute sheet, and every original control remains
   inside the same scrollable inspector. Intro and result overlays are unchanged. */
body[data-game=defense][data-field-dock=portrait][data-inspection-open=true] .layout {
  grid-template-rows:minmax(0,1fr) min(25dvh,200px);
}
body[data-game=defense][data-field-dock=portrait] .side {min-height:0}
body[data-game=defense][data-field-dock=portrait] .tactical-panel {
  height:100%;min-height:0;display:block;overflow:hidden;
}
body[data-game=defense][data-field-dock=portrait] .tactical-panel>summary {flex-shrink:0}
body[data-game=defense][data-field-dock=portrait] .tactical-content {
  position:static;inset:auto;min-height:0;
  height:calc(min(25dvh,200px) - 46px);max-height:calc(min(25dvh,200px) - 46px);
  display:flex;flex-direction:column;align-items:stretch;gap:8px;
  overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;
  box-shadow:none;border:0;border-top:1px solid #48617a;border-radius:0;
}
body[data-game=defense][data-field-dock=portrait] .tactical-content>* {flex:0 0 auto}
body[data-game=defense][data-field-dock=portrait] .tactical-panel[data-unit-selected=true] .unit-info {order:-3}
body[data-game=defense][data-field-dock=portrait] .tactical-panel[data-unit-selected=true] .empty-cell-controls {order:-2}
body[data-game=defense][data-field-dock=portrait][data-merge-preview=true] .tactical-content {
  height:calc(min(25dvh,200px) - 56px);max-height:calc(min(25dvh,200px) - 56px);
}
body[data-game=defense][data-field-dock=portrait] .tactical-panel:not([open]) .tactical-content {display:none}
body[data-game=defense][data-field-dock=portrait] .unit-overview {
  grid-template-columns:44px minmax(0,1fr);gap:8px;
}
body[data-game=defense][data-field-dock=portrait] .unit-overview #unitPortrait {
  width:44px;height:60px;
}
body[data-game=defense][data-field-dock=portrait] .world-area {
  grid-template-rows:54px minmax(0,1fr) 44px;
}
body[data-game=defense][data-field-dock=portrait] .world-area>.stage-note {
  height:54px!important;min-height:0!important;
  grid-template-rows:18px 30px;gap:0;padding:2px 8px!important;
}
body[data-game=defense][data-field-dock=portrait] .world-area>.field-tools {
  min-height:44px;padding:0 6px;
}
/* Keep the existing countdown, instruction and charge bar visible together. */
body[data-game=defense][data-field-dock=portrait] .stage-note .battle-guide[data-warning=true] {
  justify-content:flex-start;
}
body[data-game=defense][data-field-dock=portrait] .stage-note .battle-guide .boss-signal {
  display:grid;grid-template-columns:minmax(0,1fr);gap:0;padding:0 0 3px;
}
body[data-game=defense][data-field-dock=portrait] .stage-note .battle-guide .boss-signal strong {
  font-size:10px;line-height:12px;
}
body[data-game=defense][data-field-dock=portrait] .stage-note .battle-guide .boss-signal small {
  font-size:9.5px;line-height:12px;
}
/* A long, expanded fusion receipt must not consume the entire adjacent
   inspector after rotating from the phone layout. Both areas can scroll. */
body[data-game=defense][data-field-dock=wide] .side>.tactical-panel {min-height:200px}
body[data-game=defense][data-field-dock=wide] .side>.landscape-field-dock {
  min-height:0;max-height:calc(100% - 208px);overflow-y:auto;flex-shrink:1;
}
body[data-game=defense][data-field-dock=landscape] .side>.tactical-panel {min-height:132px}
body[data-game=defense][data-field-dock=landscape] .side>.landscape-field-dock {
  min-height:0;max-height:calc(100% - 140px);overflow-y:auto;flex-shrink:1;
}
