/* ================================================================
   v132 — 모바일 하단 고정 UI(아군 본진 · 핸드 · 전투 버튼) 정리
   - game.css / mobile_preview.css 뒤에 로드되는 최종 패치 파일이므로
     기존 규칙과 동일하거나 더 깊은 선택자로 항상 우선 적용된다.
   - body.ui-mode-mobile 클래스는 "실제 모바일 화면"과 "PC의 모바일
     미리보기" 모드 모두에서 공통으로 붙으므로, 두 경우를 한 번에 다룬다.
   ================================================================ */

:root{
  /* JS(v132_mobile_dock_fix.js)가 실측 후 정확한 값으로 덮어씀. 아래는
     JS 실행 전 첫 렌더링에서 겹침이 보이지 않도록 하는 안전한 기본값. */
  --dock-action-h:58px;
  --dock-hq-h:176px;
  --dock-hand-h:174px;
  --dock-total-h:calc(var(--dock-action-h) + var(--dock-hq-h) + var(--dock-hand-h));
}

/* ----------------------------------------------------------------
   1) 하단 고정 스택 순서를 [버튼] → [아군 본진] → [핸드] 순으로 재배치
      (아래에서 위로). 아군 본진이 항복/셔플/턴종료 버튼 바로 위에 오도록.
   ---------------------------------------------------------------- */
body.ui-mode-mobile:not(.prebattle) .bottom-hud{
  bottom:0!important;
}
body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount{
  bottom:var(--dock-action-h)!important;
  height:var(--dock-hq-h)!important;
  min-height:var(--dock-hq-h)!important;
  max-height:var(--dock-hq-h)!important;
  padding:6px 6px 8px!important;
  overflow:visible!important;
}
body.ui-mode-mobile:not(.prebattle) .mobile-hand-mount{
  bottom:calc(var(--dock-action-h) + var(--dock-hq-h))!important;
}

/* 본진/핸드/버튼 높이 합만큼 전투 화면 하단 여백을 확보해
   본진 박스가 전투 1열 카드를 가리지 않도록 한다 (실측값 기반). */
body.ui-mode-mobile:not(.prebattle) .app,
body.ui-mode-mobile:not(.prebattle){
  padding-bottom:calc(var(--dock-total-h) + env(safe-area-inset-bottom,0px) + 10px)!important;
}

/* ----------------------------------------------------------------
   2) 아군/적군 본진 박스 높이를 넉넉하게 키워 확대된 글씨가 잘리지 않게 함
   ---------------------------------------------------------------- */
body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .ally-hq-row,
body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .battle-hq,
body.ui-mode-mobile:not(.prebattle) .enemy-hq-row,
body.ui-mode-mobile:not(.prebattle) .enemy-hq-row .battle-hq{
  height:168px!important;
  min-height:168px!important;
  max-height:168px!important;
  overflow:visible!important;
}

/* ----------------------------------------------------------------
   3) 라이프 · MP · 행동력(AP) · 카드 수 · 턴 수 · 책사 유무 —
      아군·적군 본진 모두 글씨/아이콘 크기 확대 (3칸 × 2줄 그리드 정리)
   ---------------------------------------------------------------- */
body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .battle-hq .hq-info-overlay,
body.ui-mode-mobile:not(.prebattle) .enemy-hq-row .battle-hq .hq-info-overlay{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  grid-template-rows:repeat(2,minmax(0,1fr))!important;
  gap:5px 7px!important;
  align-content:center!important;
}
body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .battle-hq .hq-stat-chip,
body.ui-mode-mobile:not(.prebattle) .enemy-hq-row .battle-hq .hq-stat-chip{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:4px!important;
  width:auto!important;
  height:auto!important;
  min-height:24px!important;
  padding:4px 6px!important;
  font-size:12px!important;
  border-radius:6px!important;
}
body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .battle-hq .hq-stat-chip .hq-stat-icon,
body.ui-mode-mobile:not(.prebattle) .enemy-hq-row .battle-hq .hq-stat-chip .hq-stat-icon{
  font-size:15px!important;
  line-height:1!important;
  flex:none!important;
}
body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .battle-hq .hq-stat-chip .hq-stat-value,
body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .battle-hq .hq-stat-chip b,
body.ui-mode-mobile:not(.prebattle) .enemy-hq-row .battle-hq .hq-stat-chip .hq-stat-value,
body.ui-mode-mobile:not(.prebattle) .enemy-hq-row .battle-hq .hq-stat-chip b{
  font-size:16px!important;
  font-weight:900!important;
  line-height:1.1!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
/* 책사 유무 칩은 항상 노출 (일부 기존 규칙이 skill 칩을 숨기던 것을 되돌림) */
body.ui-mode-mobile:not(.prebattle) .mobile-ally-hq-mount .battle-hq .hq-stat-chip.skill,
body.ui-mode-mobile:not(.prebattle) .enemy-hq-row .battle-hq .hq-stat-chip.skill{
  display:flex!important;
}

/* ----------------------------------------------------------------
   4) 항복 · 셔플 · 턴종료 버튼 글씨 크게
   ---------------------------------------------------------------- */
body.ui-mode-mobile:not(.prebattle) .bottom-hud .hud-actions .btn{
  font-size:16px!important;
  font-weight:950!important;
  letter-spacing:-0.02em!important;
}
