body[data-game=defense] .field-tools{flex-wrap:wrap!important}.fusion-receipt{flex:0 0 100%;min-width:0;width:100%;white-space:normal;border:1px solid #5b7387;border-radius:8px;background:#1d3146;color:#e5f3ee}.fusion-receipt[hidden]{display:none!important}.fusion-receipt>summary{min-height:44px;padding:9px 10px;font-size:11px;line-height:1.5;cursor:pointer;font-weight:700;overflow-wrap:anywhere}.fusion-receipt[open]>summary{color:#ffe1a1;border-bottom:1px solid #526b7b}.fusion-receipt-body{padding:10px;max-height:205px;overflow-y:auto;overscroll-behavior:contain;font-size:11px;line-height:1.6}.fusion-receipt-body>strong{display:block;color:#c4f3da;font-size:12px}.fusion-receipt-body dl{margin:8px 0;display:grid;gap:4px}.fusion-receipt-body dl>div{display:flex;flex-wrap:wrap;justify-content:space-between;gap:2px 10px}.fusion-receipt-body dt{color:#b9c9d3}.fusion-receipt-body dd{margin:0;color:#e3edeb}.fusion-receipt-body [data-loss=true] dd{color:#ffd29c}.fusion-receipt-body p{color:#b5c5ca;font-size:10px;margin:8px 0}.fusion-receipt-body button{min-height:44px;width:100%;background:#346252;border:1px solid #81bda2;border-radius:6px;color:#e1ffee;font-weight:700;font-size:12px;padding:8px}
@media(max-height:600px) and (min-width:650px){.fusion-receipt>summary{font-size:10px;padding:6px 8px}.fusion-receipt-body{max-height:130px}.landscape-field-dock:has(.fusion-receipt[open]){max-height:100%;overflow-y:auto;overscroll-behavior:contain;flex-shrink:1}}
.fusion-receipt-badge{position:absolute;right:30px;top:8px;border:1px solid #a3b88d;border-radius:5px;padding:3px 5px;font-size:9px;color:#e4f6c7;background:#304a40;white-space:nowrap}.fusion-receipt-badge[hidden]{display:none}.tactical-panel:has(.fusion-receipt-badge:not([hidden]))>summary{padding-right:92px!important}.tactical-content>.fusion-receipt{width:100%;margin-bottom:9px;box-sizing:border-box}.tactical-content>.fusion-receipt .fusion-receipt-body{max-height:205px}

body[data-game=defense] .world-area:has(.empty-cell-controls:not([hidden])){grid-template-rows:auto auto minmax(0,1fr) auto}

/* narrow-height-gap93: reuse the existing portrait controls at short phone sizes. */
@media(max-width:649px) and (max-height:600px) {
  body[data-game=defense] .shell {grid-template-columns:minmax(0,1fr);grid-template-rows:50px 48px minmax(0,1fr) 54px;padding:8px;gap:7px}
  body[data-game=defense] .top {grid-column:1;grid-row:1}
  body[data-game=defense] .top .brand {font-size:21px}
  body[data-game=defense] .top .edition {font-size:8px;letter-spacing:1px}
  body[data-game=defense] .top .game-purpose {display:none}
  body[data-game=defense] .top-actions .quiet {font-size:11px;min-height:42px;padding:8px 10px}
  body[data-game=defense] .stats {grid-column:1;grid-row:2}
  body[data-game=defense] .stat {min-width:0;padding:3px 12px}
  body[data-game=defense] .stat b {font-size:20px}
  body[data-game=defense] .stat small {font-size:9px}
  body[data-game=defense] .layout,
  body[data-game=defense][data-inspection-open=true] .layout {grid-row:3;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 44px;gap:7px}
  body[data-game=defense] .world-area {border-radius:12px;grid-template-rows:auto auto minmax(0,1fr) 50px}
  body[data-game=defense] .side {position:relative;overflow:visible;z-index:8}
  body[data-game=defense] .tactical-panel {display:block;flex:initial}
  body[data-game=defense] .tactical-panel>summary {height:44px;min-height:44px;cursor:pointer;padding-right:32px}
  body[data-game=defense] .tactical-panel>summary::after {display:block}
  body[data-game=defense] .tactical-content {
    position:absolute;bottom:calc(100% + 7px);left:0;right:0;max-height:min(55dvh,390px);
    border:1px solid #698499;border-radius:12px;background:#17283d;
    box-shadow:0 -10px 35px #0008;padding:10px;
  }
  body[data-game=defense] .tactical-panel:not([open]) .tactical-content {display:none}
  body[data-game=defense] .world-area .stage-note,
  body[data-game=defense][data-battle-phase=battle] .world-area .stage-note {grid-template-columns:minmax(0,1fr);padding:6px 10px;gap:2px;min-height:56px}
  body[data-game=defense] .world-area .battle-guide,
  body[data-game=defense][data-battle-phase=battle] .world-area .stage-note>.battle-guide {grid-column:1;grid-row:2;height:28px;min-height:28px}
  body[data-game=defense] .world-area .stage-note>#phase {grid-column:1;grid-row:1}
  body[data-game=defense] .wave-stage {padding:6px 10px}
  body[data-game=defense] .wave-heading strong {font-size:12px}
  body[data-game=defense] .wave-stage[data-phase=prepare] .wave-heading {grid-column:1/-1}
  body[data-game=defense] .wave-preview {grid-row:2;grid-column:1/-1;justify-content:flex-start;max-width:none}
  /* The next enemy occupies row 2 on portrait phones. Keep the following
     instruction and the earned receipt below it, never in the same cells. */
  body[data-game=defense] .wave-stage[data-phase=prepare] .wave-hint {grid-row:3}
  body[data-game=defense] .wave-stage[data-phase=prepare] .wave-next {grid-row:4}
  body[data-game=defense] .wave-stage[data-round-result=true] .round-card {grid-row:3}

  body[data-game=defense] .wave-hint {grid-row:3;font-size:10px}
  body[data-game=defense] .wave-next {display:none}
  .fusion-switch {gap:7px}
  #autoMergeState {font-size:10px;max-width:150px}
  body[data-game=defense] .field-tools #autoMerge {min-width:98px;font-size:10px}
  body[data-game=defense] footer.actions {grid-row:4;gap:6px}
  body[data-game=defense] footer .main-btn,
  body[data-game=defense] footer .quiet {font-size:13px;min-height:50px;padding:8px}
}


@media(max-width:649px) and (max-height:600px){body[data-game=defense] .shell{grid-template-rows:36px 38px minmax(0,1fr) 48px;gap:5px;padding:6px}body[data-game=defense] .world-area .stage-note{min-height:42px;height:42px;padding:4px 8px}body[data-game=defense] .world-area .battle-guide{height:22px;min-height:22px}body[data-game=defense] .world-area .battle-guide #coach{font-size:10px}body[data-game=defense] .stat b{font-size:18px}body[data-game=defense] .wave-stage .wave-hint,body[data-game=defense] .wave-stage .round-card,body[data-game=defense] .wave-stage .wave-route{display:none}body[data-game=defense] .wave-stage{padding:4px 8px;gap:3px}body[data-game=defense] footer .main-btn,body[data-game=defense] footer .quiet{min-height:44px;padding:6px;font-size:12px}body[data-game=defense] .world-area:has(.empty-cell-controls:not([hidden])){grid-template-rows:auto auto minmax(0,1fr) auto}}

@media(max-width:649px) and (max-height:600px){body[data-game=defense] .field-tools .fusion-switch{flex:1 1 0;min-width:0}body[data-game=defense] .field-tools #autoMergeState{min-width:0;max-width:90px;flex:1}}
