/* ================================================================
   v141 — (1) 모바일 "2. 전투" 메뉴에 진형 선택을 항상 보이게 노출
          (2) 모바일 핸드 카드에서 이미지가 카드 이름을 가리는 현상 수정
          (3) 본진 박스에서 "전략가 배치" 아래 남는 여백 제거(박스 높이 축소)
   game.css 및 이전 모든 fix 파일보다 나중에 로드되는 최종 패치.
   ================================================================ */

/* ----------------------------------------------------------------
   (1) "2. 전투" 카드 안에 진형 선택 + 덱 선택 셀렉트 두 개를 세로로
   쌓아 넣기 위한 레이아웃. 기존 .battle-menu-card는 [라벨][셀렉트]
   [버튼] 3칸 그리드였는데, 셀렉트 자리에 진형·덱 두 개를 넣는다. */
@media (max-width:850px){
  .battle-menu-card .battle-menu-selects{
    display:flex!important;
    flex-direction:column!important;
    gap:5px!important;
    min-width:0!important;
  }
  .battle-menu-card .battle-menu-selects select{
    width:100%!important;
  }
}

/* ----------------------------------------------------------------
   (2) 실제 모바일 핸드 카드: 카드 총 높이가 화면 폭에 따라 계산되는
   변수(--v129-hand-card-height 등)와 이름줄·이미지·능력치줄의 높이가
   서로 안 맞아떨어지는 경우, 그림 영역이 자기 grid 행 밖으로 넘쳐
   이름줄 위로 겹쳐 보이는 문제가 있었다. 이름·이미지·능력치 세 구간의
   높이를 고정값으로 명확히 나누어(합이 카드 전체 높이와 항상 일치)
   겹침이 생기지 않게 한다. */
@media (max-width:850px){
  body.ui-mode-mobile:not(.prebattle) .mobile-hand-mount #hand.hand .card{
    height:142px!important;min-height:142px!important;max-height:142px!important;
    display:grid!important;
    grid-template-rows:20px minmax(0,1fr) 32px!important;
    overflow:hidden!important;
  }
  body.ui-mode-mobile:not(.prebattle) .mobile-hand-mount #hand.hand .card .cname,
  body.ui-mode-mobile:not(.prebattle) .mobile-hand-mount #hand.hand .card .card-title-area{
    height:20px!important;min-height:20px!important;max-height:20px!important;
    display:flex!important;align-items:center!important;
    overflow:hidden!important;white-space:nowrap!important;
    position:relative!important;z-index:2!important;
  }
  body.ui-mode-mobile:not(.prebattle) .mobile-hand-mount #hand.hand .card .card-name-text{
    overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;
  }
  body.ui-mode-mobile:not(.prebattle) .mobile-hand-mount #hand.hand .card .cimg{
    height:100%!important;min-height:0!important;max-height:none!important;
    overflow:hidden!important;position:relative!important;z-index:1!important;
  }
  body.ui-mode-mobile:not(.prebattle) .mobile-hand-mount #hand.hand .card .cstats,
  body.ui-mode-mobile:not(.prebattle) .mobile-hand-mount #hand.hand .card .card-stat-grid{
    height:32px!important;min-height:32px!important;max-height:32px!important;
    overflow:hidden!important;
  }
}

/* ----------------------------------------------------------------
   (3) 본진 박스: 정보(라이프·MP·AP·카드수·턴수·책사유무) 두 줄과
   "전략가 배치" 칸은 실제로 100px 안팎이면 충분한데, 박스 자체 높이가
   168px로 고정돼 있어 전략가 배치 칸 아래로 빈 여백이 남았다.
   박스 높이를 실제 콘텐츠에 맞춰 줄인다. */
@media (max-width:850px){
  body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .battle-hq,
  body.ui-mode-mobile:not(.prebattle) .enemy-hq-row .battle-hq{
    height:112px!important;min-height:112px!important;max-height:112px!important;
    overflow:visible!important;
  }
  body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .hq-advisor-slot,
  body.ui-mode-mobile:not(.prebattle) .enemy-hq-row .hq-advisor-slot{
    top:34px!important;height:58px!important;min-height:58px!important;
  }
}
