/* =====================================================================
   v219 — 전투필드 4건 보정
   1) 전투열(라인) 박스가 화면 오른쪽으로 잘리는 문제 방지
   2) 핸드 · 전투필드 카드 5% 축소
   3) EN 원형 배지: "N EN" → 숫자만
   4) 카드 등급 배지: 등급별 색상 구분
   5) 하단 공격/방어/체력: 문구 제거, 숫자만 표시
   ===================================================================== */

/* ---------- 1) 전투열 우측 잘림 방지 ---------- */
/* v216이 강제한 minmax(760px,1fr) 최소폭이 실제 창 폭보다 넓을 때
   .boardwrap의 overflow-x:hidden(v200)과 맞물려 오른쪽이 통째로
   화면 밖으로 밀려나 보이지 않는 현상이 원인. 최소폭을 카드 축소분에
   맞춰 줄이고, 혹시 남는 초과분은 잘리지 않고 스크롤되도록 안전장치를 둔다. */
@media (min-width:851px){
  body.unified-left-layout:not(.ui-mode-mobile-preview) .app,
  body.unified-left-layout:not(.ui-mode-mobile-preview) .app[style]{
    grid-template-columns:382px minmax(716px,1fr)!important;
  }
}
@media (min-width:851px) and (max-height:900px){
  body.unified-left-layout:not(.ui-mode-mobile-preview) .app,
  body.unified-left-layout:not(.ui-mode-mobile-preview) .app[style]{
    grid-template-columns:382px minmax(716px,1fr)!important;
  }
}
body.unified-left-layout:not(.ui-mode-mobile-preview) .battle-panel,
body.unified-left-layout:not(.ui-mode-mobile-preview) .boardwrap{
  overflow-x:auto!important;
}

/* ---------- 2) 핸드 · 전투필드 카드 5% 축소 ---------- */
/* v216이 정의한 카드 크기 변수(--v216-card-w 등)를 그대로 재정의하면
   핸드·전투열·본진 5칸 등 이를 참조하는 모든 규칙에 자동 반영된다. */
@media (min-width:851px){
  body.unified-left-layout:not(.ui-mode-mobile-preview){
    --v216-card-w:112.86px;
    --v216-card-h:175.56px;
    --v216-hand-h:351.12px;
    --v216-hand-w:338.58px;
    --v216-hand-section-h:389.12px;
    --v216-formation-w:705.66px;
    --v216-five-card-w:588.3px;
    --v216-four-card-w:469.44px;
    --v216-three-card-w:350.58px;
    --v216-two-card-w:231.72px;
    --v216-lane-h:188.1px;
  }
}

/* ---------- 3) EN 원형 배지: 숫자만 ---------- */
#hand.hand .card .card-ap-icon::before,
.battlefield-layout .unit .unit-bottom-icons>span:last-child::before,
.collection-card-icons .collection-en-icon::before,
.collection-card-icons>span:last-child::before{
  content:attr(data-en)!important;
}

/* ---------- 4) 카드 등급 배지: 등급별 색상 ---------- */
#hand.hand .card .card-title-grade.grade-SSS,
.battlefield-layout .unit .field-grade.grade-SSS,
.collection-card-title>em.grade-SSS{border-color:var(--grade-sss)!important;color:var(--grade-sss)!important}
#hand.hand .card .card-title-grade.grade-SS,
.battlefield-layout .unit .field-grade.grade-SS,
.collection-card-title>em.grade-SS{border-color:var(--grade-ss)!important;color:var(--grade-ss)!important}
#hand.hand .card .card-title-grade.grade-S,
.battlefield-layout .unit .field-grade.grade-S,
.collection-card-title>em.grade-S{border-color:var(--grade-s)!important;color:var(--grade-s)!important}
#hand.hand .card .card-title-grade.grade-RR,
.battlefield-layout .unit .field-grade.grade-RR,
.collection-card-title>em.grade-RR{border-color:var(--grade-rr)!important;color:var(--grade-rr)!important}
#hand.hand .card .card-title-grade.grade-R,
.battlefield-layout .unit .field-grade.grade-R,
.collection-card-title>em.grade-R{border-color:var(--grade-r)!important;color:var(--grade-r)!important}
#hand.hand .card .card-title-grade.grade-U,
.battlefield-layout .unit .field-grade.grade-U,
.collection-card-title>em.grade-U{border-color:var(--grade-u)!important;color:var(--grade-u)!important}
#hand.hand .card .card-title-grade.grade-C,
.battlefield-layout .unit .field-grade.grade-C,
.collection-card-title>em.grade-C{border-color:var(--grade-c)!important;color:var(--grade-c)!important}

/* ---------- 5) 하단 공격/방어/체력: 문구 제거, 숫자만 ---------- */
/* v216이 ::before로 "공격"/"방어"/"체력" 글자를 넣던 규칙(더 높은 우선순위로
   v218의 아이콘 시도를 계속 이겨왔음)을 동일 선택자+!important로 무력화. */
body.unified-left-layout:not(.ui-mode-mobile-preview) #hand.hand .card .card-stat-cell::before,
body.unified-left-layout:not(.ui-mode-mobile-preview) .battlefield-layout .unit .stats span::before,
#hand.hand .card .card-stat-cell::before,
.battlefield-layout .unit .stats span::before{
  content:none!important;
  display:none!important;
}
body.unified-left-layout:not(.ui-mode-mobile-preview) #hand.hand .card .card-stat-cell,
body.unified-left-layout:not(.ui-mode-mobile-preview) .battlefield-layout .unit .stats span{
  grid-template-rows:1fr!important;
}
