/* The wave and current alert share one fixed-height header during a battle.
   Keep alerts outside the canvas and the real actions in their existing dock. */
body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .world-area,
body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .world-area:has(> .battle-alert:not([hidden])) {
  --battle-heading-height: 66px;
  grid-template-rows: var(--battle-heading-height) minmax(0,1fr) auto;
}

body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .world-area > .stage-note {
  height: var(--battle-heading-height) !important;
  grid-template-rows: 18px minmax(0,1fr);
}

body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .world-area > .field-tools,
body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .world-area:has(> .battle-alert:not([hidden])) > .field-tools {
  grid-row: 3;
  max-height: none;
  overflow: visible;
}

body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .world-area:has(> .battle-alert:not([hidden])) > .stage-note > .battle-guide {
  visibility: hidden;
}

body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .world-area > .battle-alert {
  grid-row: 1;
  grid-column: 1;
  align-self: end;
  z-index: 6;
  height: 46px;
  min-height: 0;
  grid-template-columns: minmax(0,1fr) minmax(96px,32%);
  grid-auto-rows: minmax(44px,auto);
  align-items: center;
  gap: 0 7px;
  padding: 0 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .battle-alert > div:first-child,
body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .battle-alert .commander-response > div {
  max-height: 44px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .battle-alert strong {
  font-size: 12px;
  line-height: 15px;
}

body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .battle-alert small {
  font-size: 10px;
  line-height: 13px;
}

body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .battle-alert button {
  padding: 2px 5px;
  line-height: 14px;
  white-space: normal;
}

body[data-game=defense][data-field-dock=portrait][data-battle-phase=battle] .battle-alert[data-response-primary=true] .commander-response {
  grid-template-columns: minmax(0,1fr) minmax(96px,32%);
  gap: 7px;
  min-height: 44px;
  align-items: center;
}
