/* v0.28.9 — Mobile battle tools always fit, including continuous-wave count
   and autoplay. No scroll, clipping, or overlap with the battlefield.
   Desktop battle tool dimensions are intentionally unchanged. */
@media (pointer:coarse) and (orientation:landscape) and (max-width:1280px) {
  /* At normal landscape heights, retain a legible single-column tool rail. */
  body > .app-shell .battlefield-card > .battle-play-row {
    grid-template-columns:clamp(94px,11vw,122px) minmax(0,1fr)!important;
  }
  body > .app-shell .battlefield-card > .battle-play-row > .battle-utility-panel {
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:minmax(10px,.6fr) repeat(9,minmax(0,1fr))!important;
    align-content:stretch!important;
    justify-content:stretch!important;
    justify-items:stretch!important;
    align-items:stretch!important;
    gap:2px!important;
    height:100%!important;
    min-height:0!important;
    max-height:100%!important;
    width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    padding:3px!important;
    margin:0!important;
    -webkit-overflow-scrolling:auto!important;
    scrollbar-width:none!important;
  }
  body > .app-shell .battle-utility-panel > .utility-group-heading {
    display:flex!important;
    grid-column:auto!important;
    min-width:0!important;
    min-height:0!important;
    height:100%!important;
    max-height:100%!important;
    flex:none!important;
    justify-content:center!important;
    align-items:center!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
    line-height:1!important;
    font-size:clamp(9px,1vw,11px)!important;
  }
  body > .app-shell .battle-utility-panel > .utility-group-heading strong {
    font-size:inherit!important;
    white-space:nowrap!important;
    line-height:1!important;
  }
  body > .app-shell .battle-utility-panel > button.button,
  body > .app-shell .battle-utility-panel > #autoWaveBtn,
  body > .app-shell .battle-utility-panel > label.auto-wave-count {
    display:flex!important;
    visibility:visible!important;
    position:relative!important;
    flex:none!important;
    box-sizing:border-box!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:100%!important;
    min-height:0!important;
    max-height:100%!important;
    margin:0!important;
    overflow:hidden!important;
    border-radius:6px!important;
    align-items:center!important;
    justify-content:center!important;
    gap:2px!important;
    padding:1px 3px 1px 15px!important;
    text-align:center!important;
    white-space:nowrap!important;
    font-size:clamp(8px,.98vw,11px)!important;
    line-height:1.05!important;
    touch-action:manipulation!important;
  }
  body > .app-shell .battle-utility-panel > button.button > .utility-button-label,
  body > .app-shell .battle-utility-panel > button.button > .utility-button-label span {
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:0!important;
    width:auto!important;
    max-width:100%!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
    white-space:nowrap!important;
    overflow-wrap:normal!important;
    word-break:keep-all!important;
    font-size:inherit!important;
    line-height:1.08!important;
    letter-spacing:-.04em!important;
  }
  /* Preserve the user-requested top-left shortcuts while freeing label space. */
  body > .app-shell .battle-utility-panel > button.button > kbd.utility-hotkey,
  body > .app-shell .battle-utility-panel > #gameQuestsBtn > kbd.utility-hotkey,
  body > .app-shell .battle-utility-panel > #achievementBtn > kbd.utility-hotkey,
  body > .app-shell .battle-utility-panel > label.auto-wave-count > kbd.auto-count-hotkey {
    position:absolute!important;
    inset:auto!important;
    left:2px!important;
    top:2px!important;
    right:auto!important;
    bottom:auto!important;
    transform:none!important;
    display:inline-flex!important;
    flex:none!important;
    visibility:visible!important;
    width:11px!important;
    min-width:11px!important;
    max-width:11px!important;
    height:11px!important;
    min-height:11px!important;
    max-height:11px!important;
    font-size:7px!important;
    line-height:1!important;
    padding:0!important;
    margin:0!important;
    border-radius:2px!important;
    pointer-events:none!important;
  }
  /* Continuous-wave count is a real editable input, never a hidden footer. */
  body > .app-shell .battle-utility-panel > label.auto-wave-count {
    flex-wrap:nowrap!important;
    padding:1px 3px 1px 15px!important;
    white-space:nowrap!important;
    gap:2px!important;
  }
  body > .app-shell .battle-utility-panel > label.auto-wave-count > span {
    display:inline!important;
    position:static!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    font-size:clamp(7px,.84vw,9px)!important;
    white-space:nowrap!important;
  }
  body > .app-shell .battle-utility-panel > label.auto-wave-count::after {
    display:none!important;
    content:none!important;
  }
  body > .app-shell .battle-utility-panel > label.auto-wave-count > input#autoWaveCount {
    display:block!important;
    visibility:visible!important;
    position:static!important;
    flex:0 0 27px!important;
    width:27px!important;
    min-width:24px!important;
    max-width:27px!important;
    height:clamp(16px,2.6dvh,21px)!important;
    min-height:0!important;
    max-height:100%!important;
    box-sizing:border-box!important;
    text-align:center!important;
    padding:0!important;
    margin:0!important;
    font-size:12px!important;
    line-height:1!important;
    touch-action:manipulation!important;
    pointer-events:auto!important;
  }
  /* Short titles and badges retain their own corners within compact buttons. */
  body > .app-shell .battle-utility-panel > #gameQuestsBtn > #questCountBadge,
  body > .app-shell .battle-utility-panel > #achievementBtn > #achievementCountBadge {
    top:1px!important;
    right:1px!important;
    min-width:13px!important;
    height:12px!important;
    min-height:12px!important;
    max-height:12px!important;
    font-size:8px!important;
    line-height:10px!important;
    padding:0 2px!important;
  }
}

/* Compact two-column rail for exceptionally short landscape viewports.
   Wider rail allows 9 controls in 5 rows with usable touch height. */
@media (pointer:coarse) and (orientation:landscape) and (max-width:1280px) and (max-height:350px) {
  body > .app-shell .battlefield-card > .battle-play-row {
    grid-template-columns:clamp(126px,25vw,158px) minmax(0,1fr)!important;
  }
  body > .app-shell .battlefield-card > .battle-play-row > .battle-utility-panel {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-rows:minmax(10px,.5fr) repeat(5,minmax(0,1fr))!important;
    gap:2px!important;
  }
  body > .app-shell .battle-utility-panel > .utility-group-heading {grid-column:1/-1!important;}
  body > .app-shell .battle-utility-panel > button.button,
  body > .app-shell .battle-utility-panel > #autoWaveBtn,
  body > .app-shell .battle-utility-panel > label.auto-wave-count {padding-left:13px!important;padding-right:1px!important;font-size:clamp(7px,1.05vw,9px)!important;}
  body > .app-shell .battle-utility-panel > button.button > .utility-button-label,
  body > .app-shell .battle-utility-panel > button.button > .utility-button-label span {white-space:normal!important;line-height:1.03!important;}
  body > .app-shell .battle-utility-panel > label.auto-wave-count > span:last-of-type {display:none!important;}
  body > .app-shell .battle-utility-panel > label.auto-wave-count::after {display:inline!important;content:'회'!important;font-size:8px!important;color:#c9e6db!important;}
  body > .app-shell .battle-utility-panel > label.auto-wave-count > input#autoWaveCount {flex-basis:24px!important;width:24px!important;max-width:24px!important;font-size:10px!important;}
}
