/* ═══════════════════════════════════════════════════════
   mobile.css — ATHENA 모바일 전용 UI 스타일시트
   mobile.js + config/mobile_ui.json 기반 디바이스 적응형
   CSS 커스텀 속성(--m-*)은 mobile.js가 런타임에 주입
   ═══════════════════════════════════════════════════════ */

/* ──────── CSS 커스텀 속성 기본값 ──────── */
:root {
  --m-container-pad: 0.75rem;
  --m-section-gap:   0.75rem;
  --m-card-pad:      0.6rem 0.75rem;
  --m-nav-height:    48px;
  --m-tab-height:    44px;
  --m-fs-base:       14px;
  --m-fs-small:      12px;
  --m-fs-heading:    16px;
  --m-fs-label:      11px;
}


/* ════════════════════════════════════════════
   MOBILE  (≤480px)
   ════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* ── 전역 레이아웃 ── */
  html[data-device="mobile"] body {
    font-size: var(--m-fs-base);
    -webkit-text-size-adjust: 100%;
    overscroll-behavior-y: auto;
  }
  html[data-device="mobile"] .container-fluid {
    padding: var(--m-container-pad) !important;
  }
  html[data-device="mobile"] main.col-12 {
    padding: 0.35rem !important;
  }

  /* ── 탑바 ── */
  html[data-device="mobile"] .topbar {
    padding: 0.35rem 0.5rem !important;
    margin-bottom: 0.5rem !important;
    border-radius: 0.5rem;
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.35rem !important;
  }
  html[data-device="mobile"] .topbar > .d-flex:first-child {
    flex-direction: column;
    gap: 0.35rem;
  }
  html[data-device="mobile"] .topbar-brand {
    font-size: 0.85rem;
    letter-spacing: 0.15em;
  }

  /* ── 탭 네비게이션 (하단 고정 바) ── */
  html[data-device="mobile"] #mainTabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    scrollbar-width: none;
    justify-content: flex-start;
    padding: 2px;
    gap: 1px;
  }
  html[data-device="mobile"] #mainTabs::-webkit-scrollbar { display: none; }
  html[data-device="mobile"] #mainTabs .nav-link {
    font-size: 0.72rem;
    padding: 0.3rem 0.625rem;
    white-space: nowrap;
    min-height: 2rem;
  }
  html[data-device="mobile"] .topbar > .d-flex:last-child {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.25rem !important;
  }

  /* API 상태, 티어 드롭다운 컴팩트 */
  html[data-device="mobile"] #global_status_text {
    max-width: 10rem !important;
    font-size: 0.65rem;
  }
  html[data-device="mobile"] .tier-dropdown-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }
  html[data-device="mobile"] .tier-dropdown-menu {
    width: calc(100vw - 1.5rem) !important;
    max-width: calc(100vw - 1.5rem);
  }

  /* ── 홈탭: 배너 (S-Tier Spotlight) ── */
  html[data-device="mobile"] .home-hero-banner {
    border-radius: 0.625rem;
    margin-bottom: 0.5rem;
  }
  html[data-device="mobile"] .home-banner-content {
    flex-direction: row;
    align-items: center;
    padding: 0.5rem 0.6rem;
    gap: 0.5rem;
  }
  html[data-device="mobile"] .home-banner-text {
    flex-shrink: 0;
  }
  html[data-device="mobile"] .home-banner-label {
    font-size: 0.4rem;
    letter-spacing: 0.12em;
    margin-bottom: 0;
  }
  html[data-device="mobile"] .home-banner-title {
    font-size: 0.82rem;
    margin-bottom: 0;
    line-height: 1.3;
  }
  html[data-device="mobile"] .home-banner-desc {
    display: none;
  }

  /* ── 홈탭: Spotlight 카드 (가로 스크롤, 컴팩트) ── */
  html[data-device="mobile"] .home-spotlight-heroes {
    justify-content: flex-start;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
  }
  html[data-device="mobile"] .home-spotlight-card {
    min-width: 2.6rem;
    flex: 0 0 auto;
    padding: 0.2rem 0.25rem 0.15rem;
    border-radius: 0.4rem;
    gap: 1px;
  }
  html[data-device="mobile"] .home-spotlight-img {
    width: 1.6rem;
    height: 1.6rem;
    border-width: 1px;
  }
  html[data-device="mobile"] .home-spotlight-name {
    font-size: 0.4rem;
    max-width: 2.5rem;
  }
  html[data-device="mobile"] .home-spotlight-role {
    display: none;
  }
  html[data-device="mobile"] .home-spotlight-score {
    font-size: 0.35rem;
  }
  html[data-device="mobile"] .home-spotlight-rank {
    font-size: 0.35rem;
    top: 1px;
    left: 2px;
  }
  /* Spotlight hover 효과 제거 (터치 환경) */
  html[data-device="mobile"] .home-spotlight-card:hover {
    transform: none;
    box-shadow: none;
  }

  /* ── 홈탭: 듀얼 그리드 → 단일 컬럼 ── */
  html[data-device="mobile"] .home-dual-grid {
    grid-template-columns: 1fr !important;
    gap: 0.5rem;
  }

  /* ── 홈탭: 티어 패널 ── */
  html[data-device="mobile"] .home-tier-panel {
    border-radius: 0.625rem;
    border-color: rgba(148, 163, 184, 0.08);
  }
  html[data-device="mobile"] .home-tier-tab-bar {
    padding: 0.35rem 0.5rem;
    gap: 0.25rem;
    flex-wrap: nowrap;
  }
  html[data-device="mobile"] .home-tier-sw {
    font-size: 0.62rem;
    padding: 0.25rem 0.5rem;
  }
  html[data-device="mobile"] .home-tier-tab-right {
    gap: 0.2rem;
  }
  html[data-device="mobile"] .home-tier-subtitle {
    font-size: 8px;
    padding: 1px 0.4rem 0;
    letter-spacing: 0.2px;
    display: none;
  }
  html[data-device="mobile"] .home-status-badge {
    font-size: 0.5rem;
  }
  html[data-device="mobile"] .home-dist-toggle-btn {
    padding: 0.15rem 0.35rem;
    font-size: 0.62rem;
  }

  /* ── 홈탭: 역할 필터 탭 ── */
  html[data-device="mobile"] .home-section-controls {
    flex-wrap: wrap;
    gap: 0.2rem;
  }
  html[data-device="mobile"] .home-role-tabs {
    gap: 1px;
    padding: 1px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  html[data-device="mobile"] .home-role-tabs::-webkit-scrollbar { display: none; }
  html[data-device="mobile"] .home-role-tab {
    font-size: 0.58rem;
    padding: 0.2rem 0.4rem;
    min-height: 1.5rem;
    white-space: nowrap;
  }

  /* ── 홈탭: 티어 바디 (ht-tier-row) ── */
  html[data-device="mobile"] .ht-col-header {
    display: none;
  }
  html[data-device="mobile"] .ht-tier-row {
    flex-direction: row;
    align-items: stretch;
    border-radius: 0.375rem;
    animation-duration: 0.2s;
  }
  html[data-device="mobile"] .ht-tier-row::before {
    width: 2px;
  }
  html[data-device="mobile"] .ht-tier-content {
    flex-direction: column;
    overflow: hidden;
    padding: 2px 3px;
  }
  html[data-device="mobile"] .ht-tier-badge {
    min-width: 1.5rem;
    flex-direction: column;
    justify-content: center;
    padding: 0.2rem 0;
    gap: 2px;
    border-radius: 0;
  }
  html[data-device="mobile"] .ht-tier-badge-letter {
    font-size: 0.75rem;
  }
  html[data-device="mobile"] .ht-role-group {
    padding: 1px 0;
    border-top: none;
    border-left: none !important;
  }
  html[data-device="mobile"] .ht-role-group.ht-role-empty {
    display: none;
  }
  html[data-device="mobile"] .ht-hero-list {
    gap: 2px;
    padding: 0;
  }

  /* ── 홈탭: 영웅 아이템 (ht-hero) ── */
  html[data-device="mobile"] .ht-hero {
    width: 2.5rem;
    padding: 0.15rem 0.1rem;
    border-radius: 0.3rem;
  }
  html[data-device="mobile"] .ht-hero-img {
    width: 1.6rem;
    height: 1.6rem;
    border-width: 1.5px;
  }
  html[data-device="mobile"] .ht-hero-name {
    font-size: 0.4rem;
    max-width: 2.3rem;
    margin-top: 0.1rem;
  }
  html[data-device="mobile"] .ht-hero-arch {
    font-size: 5px;
    padding: 0px 3px;
    border-radius: 2px;
  }
  html[data-device="mobile"] .ht-hero-sub {
    font-size: 5px;
    padding: 0px 3px;
  }
  /* 영웅 hover 효과 경감 (터치 환경) */
  html[data-device="mobile"] .ht-hero:hover {
    transform: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  }
  html[data-device="mobile"] .ht-hero:hover .ht-hero-img {
    transform: none;
  }

  /* ── 홈탭: 맵 티어 아이템 ── */
  html[data-device="mobile"] .ht-map {
    padding: 0.1rem 0.15rem;
  }
  html[data-device="mobile"] .ht-map-img {
    width: 2.2rem;
    height: 1.3rem;
    border-radius: 0.15rem;
  }
  html[data-device="mobile"] .ht-map-name {
    font-size: 0.4rem;
    max-width: 2.5rem;
  }
  html[data-device="mobile"] .ht-map-mode-badge {
    font-size: 5px;
    padding: 0px 3px;
  }

  /* ── 홈탭: 지표 차트 (mc-*) ── */
  html[data-device="mobile"] #home_metrics_container {
    margin: 0;
  }
  html[data-device="mobile"] .mc-header {
    padding: 0.2rem 0.35rem;
    gap: 0.2rem;
  }
  html[data-device="mobile"] .mc-tabs {
    padding: 1px;
    gap: 1px;
  }
  html[data-device="mobile"] .mc-tab {
    font-size: 0.55rem;
    padding: 0.15rem 0.35rem;
  }
  html[data-device="mobile"] .mc-count {
    font-size: 0.5rem;
  }
  html[data-device="mobile"] .mc-scroll {
    max-height: 14rem;
  }
  /* mc-row 모바일 컴팩트 */
  html[data-device="mobile"] .mc-row {
    padding: 0.15rem 0.4rem;
    gap: 0.3rem;
  }
  html[data-device="mobile"] .mc-rank {
    font-size: 0.5rem;
    min-width: 0.875rem;
  }
  html[data-device="mobile"] .mc-row-icon {
    width: 1.15rem;
    height: 1.15rem;
  }
  html[data-device="mobile"] .mc-row-icon-map {
    width: 1.6rem;
    height: 1rem;
  }
  html[data-device="mobile"] .mc-row-mid {
    min-width: 4rem;
    gap: 0.2rem;
  }
  html[data-device="mobile"] .mc-row-name {
    font-size: 0.58rem;
  }
  html[data-device="mobile"] .mc-row-bar-wrap {
    height: 0.25rem;
  }
  html[data-device="mobile"] .mc-row-val {
    font-size: 0.55rem;
    min-width: 2.2rem;
  }
  html[data-device="mobile"] .mc-badges {
    gap: 0.15rem;
  }
  html[data-device="mobile"] .mc-badge {
    font-size: 0.5rem;
    padding: 0 0.25rem;
  }

  /* ── 홈탭: 페이지 스크롤 활성화 (내부 스크롤 → 자연 흐름) ── */
  html[data-device="mobile"] #home {
    min-height: auto;
    height: auto;
    overflow: visible;
  }
  html[data-device="mobile"] .home-dual-grid {
    overflow: visible;
  }
  html[data-device="mobile"] .home-section {
    overflow: visible;
  }
  html[data-device="mobile"] .home-tier-panel {
    flex: none;
    overflow: visible;
    min-height: auto;
  }
  html[data-device="mobile"] .home-tier-pane {
    flex: none;
    overflow: visible;
    min-height: auto;
  }
  html[data-device="mobile"] .home-tier-body {
    overflow-y: visible;
    flex: none;
    padding: 0.2rem 0.2rem 0.25rem;
    gap: 3px;
  }
  html[data-device="mobile"] .hd-card {
    overflow: visible;
  }

  /* ── 홈탭: 티어표 아래 지표도 세로 배치 ── */
  html[data-device="mobile"] .hd-row-map {
    gap: 0.35rem;
    padding-bottom: 0.25rem;
  }
  html[data-device="mobile"] .hd-row-map > .hd-card:first-child {
    border-right: none;
  }
  html[data-device="mobile"] .hd-row-map > .hd-card:last-child {
    contain: none;
    border-top: 1px solid rgba(148, 163, 184, 0.06);
    padding-top: 0.3rem;
    margin-top: 0;
  }
  html[data-device="mobile"] .hd-row-map > .hd-card:last-child .mc-scroll {
    max-height: 16rem;
    overflow-y: auto;
    scrollbar-width: none;
  }
  html[data-device="mobile"] .hd-row-map > .hd-card:last-child .mc-scroll::-webkit-scrollbar {
    display: none;
  }

  /* ── 홈탭: 맵 분포 차트 ── */
  html[data-device="mobile"] #home_map_dist_container {
    padding: 0 0.25rem;
  }

  /* ── 플롯 컨테이너 ── */
  html[data-device="mobile"] .js-plotly-plot {
    max-width: 100% !important;
  }
  html[data-device="mobile"] .svg-container {
    max-width: 100% !important;
  }

  /* ── 툴팁: 터치 환경에서 기존 hover 툴팁 비활성 ── */
  html[data-device="mobile"] .custom-tooltip,
  html[data-device="mobile"] #tier-tooltip {
    display: none !important;
  }

  /* ── 히어로 디테일 패널 ── */
  html[data-device="mobile"] .hero-detail-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── 카드/섹션 공통 ── */
  html[data-device="mobile"] .home-section {
    margin-bottom: 0.5rem;
    border-radius: 0.625rem;
    border-color: rgba(148, 163, 184, 0.08);
  }
  html[data-device="mobile"] .home-section-header {
    padding: 0.35rem 0.5rem;
    gap: 0.25rem;
  }
  html[data-device="mobile"] .home-section-title {
    font-size: 0.78rem;
  }
  html[data-device="mobile"] .home-section-desc {
    font-size: 0.58rem;
    display: none;
  }
  html[data-device="mobile"] .home-section-icon {
    font-size: 0.85rem;
  }
  html[data-device="mobile"] .tab-section-body {
    padding: 0.35rem 0.4rem;
  }

  /* ── 팀 빌더 ── */
  html[data-device="mobile"] .team-builder-grid {
    grid-template-columns: 1fr !important;
    gap: var(--m-section-gap);
  }

  /* ── 텍스트 말줄임 ── */
  html[data-device="mobile"] .hero-name-cell,
  html[data-device="mobile"] .map-name-cell {
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ═══════════════════════════════════════════
     NEW: 영웅 탭 — 히어로 그리드 / 디테일 배너 / 선택 그리드
     ═══════════════════════════════════════════ */

  /* ── 영웅 1x2 그리드 → 단일 컬럼 ── */
  html[data-device="mobile"] .hero-grid-1x2 {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
    gap: 0.35rem;
  }
  html[data-device="mobile"] .hero-grid-cell {
    grid-row: auto;
    display: flex;
    flex-direction: column;
    min-height: 16rem;
  }
  html[data-device="mobile"] .hero-grid-cell-header {
    flex-wrap: wrap;
    gap: 0.2rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.6rem;
    min-height: 1.35rem;
  }
  html[data-device="mobile"] .hero-tab-extra {
    flex-basis: 100%;
    gap: 0.25rem;
    font-size: 0.6rem;
  }

  /* ── 영웅 이너 탭 (추이/카운터/시너지) ── */
  html[data-device="mobile"] .hero-inner-tabs {
    gap: 1px;
  }
  html[data-device="mobile"] .hero-inner-tab {
    font-size: 0.62rem;
    padding: 0.2rem 0.4rem;
    min-height: 1.75rem;
    display: inline-flex;
    align-items: center;
  }

  /* ── 히어로 스코어 칩 (메타점수/승률/etc) ── */
  html[data-device="mobile"] .hero-score-summary {
    margin-left: 0;
    margin-top: 0.25rem;
    flex-wrap: wrap;
    gap: 0.2rem;
    width: 100%;
  }
  html[data-device="mobile"] .score-chip {
    font-size: 0.55rem;
    padding: 0.1rem 0.25rem;
  }

  /* ── 영웅 매치업 요약 (상성/시너지) ── */
  html[data-device="mobile"] .hero-matchup-summary {
    margin-top: 0.25rem;
  }
  html[data-device="mobile"] .matchup-row {
    gap: 0.3rem 0.5rem;
  }
  html[data-device="mobile"] .matchup-group {
    gap: 0.2rem;
  }
  html[data-device="mobile"] .matchup-group-label {
    font-size: 0.55rem;
  }
  html[data-device="mobile"] .matchup-chip {
    padding: 0.1rem 0.25rem 0.1rem 0.1rem;
    gap: 0.15rem;
  }
  html[data-device="mobile"] .matchup-chip-icon {
    width: 0.95rem;
    height: 0.95rem;
  }
  html[data-device="mobile"] .matchup-chip-name {
    font-size: 0.5rem;
  }
  html[data-device="mobile"] .matchup-chip:hover {
    transform: none;
  }

  /* ── 디테일 배너 (영웅/맵 공통) ── */
  html[data-device="mobile"] .detail-banner {
    border-radius: 0.5rem;
  }
  html[data-device="mobile"] .detail-banner-content {
    padding: 0.5rem 0.625rem;
    gap: 0.4rem;
    flex-direction: column;
    align-items: flex-start;
  }
  html[data-device="mobile"] .detail-banner .hero-detail-header {
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  html[data-device="mobile"] .detail-banner .hero-detail-header h2 {
    font-size: 0.95rem;
  }
  html[data-device="mobile"] .detail-banner .hero-detail-image {
    width: 2.25rem;
    height: 2.25rem;
  }
  html[data-device="mobile"] .hero-detail-role-icon {
    width: 1.25rem;
    height: 1.25rem;
  }
  html[data-device="mobile"] .hero-detail-role-icon svg {
    width: 18px;
    height: 18px;
  }
  html[data-device="mobile"] .hero-strip-stats {
    margin-left: 0.5rem;
  }
  html[data-device="mobile"] .hero-banner-stats {
    display: none;
  }
  html[data-device="mobile"] .hero-detail-tier-badge {
    font-size: 0.55rem;
  }
  html[data-device="mobile"] .detail-back-btn {
    font-size: 0.68rem;
    padding: 0.2rem 0.5rem;
  }

  /* ── 영웅 선택 그리드 (아이콘 축소) ── */
  html[data-device="mobile"] .hero-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(2.75rem, 1fr));
    gap: 0.2rem;
  }
  html[data-device="mobile"] .hero-select-icon {
    width: 2.5rem;
    height: 2.5rem;
  }
  html[data-device="mobile"] .hero-select-name {
    font-size: 0.4rem;
  }
  html[data-device="mobile"] .hero-select-btn:hover .hero-select-icon {
    transform: none;
  }

  /* ── 영웅 디테일 버튼 (목록에서 선택) ── */
  html[data-device="mobile"] .hero-detail-buttons {
    flex-direction: column;
  }
  html[data-device="mobile"] .hero-detail-btn {
    flex: 1 1 100%;
    min-width: 0;
    font-size: 0.7rem;
    padding: 0.4rem;
  }
  html[data-device="mobile"] .hero-detail-icon {
    width: 1.75rem;
    height: 1.75rem;
  }
  html[data-device="mobile"] .hero-detail-name {
    font-size: 0.6rem;
  }

  /* ── 아케타입/서브롤 팝업 (모바일: 화면 중앙 고정) ── */
  html[data-device="mobile"] .archetype-hover-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: min(14rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    z-index: 200;
    font-size: 0.7rem;
  }
  html[data-device="mobile"] .archetype-hover-title {
    font-size: 0.75rem;
  }

  /* ═══════════════════════════════════════════
     NEW: 맵 탭 — 맵 선택 그리드 / 맵 상세 / 카드 그리드
     ═══════════════════════════════════════════ */

  /* ── 맵 선택 그리드 (아이콘 축소) ── */
  html[data-device="mobile"] .map-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr));
    gap: 0.2rem;
  }
  html[data-device="mobile"] .map-select-icon {
    width: 3rem;
    height: auto;
    aspect-ratio: 16/9;
  }
  html[data-device="mobile"] .map-select-name {
    font-size: 0.4rem;
  }
  html[data-device="mobile"] .map-select-btn:hover .map-select-icon {
    transform: none;
  }
  /* ── 맵 그리드 카드 (영웅 그리드 통일 디자인) ── */
  html[data-device="mobile"] .map-grid {
    grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
    gap: 6px;
  }
  html[data-device="mobile"] .map-grid-icon {
    border-radius: 6px;
  }
  html[data-device="mobile"] .map-grid-name {
    font-size: 8px;
  }
  html[data-device="mobile"] .map-grid-card:hover .map-grid-icon {
    transform: none;
  }

  /* ── 맵 카드 그리드 → 2열 ── */
  html[data-device="mobile"] .map-card-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.3rem;
  }

  /* ── 맵 디테일 배너 ── */
  html[data-device="mobile"] #map_detail_banner .detail-banner-content {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0.625rem;
  }
  html[data-device="mobile"] #map_detail_banner [style*="width:13.75rem"] {
    width: 100% !important;
    flex: none !important;
  }

  /* ── 맵 상세 레이아웃 (차트 + 테이블) ── */
  html[data-device="mobile"] #map_detail_view .detail-charts-wrap > .flex-lg-row {
    flex-direction: column !important;
  }
  html[data-device="mobile"] #map_detail_view .detail-charts-wrap > .flex-lg-row > div {
    flex: none;
    width: 100%;
  }

  /* ── 맵 필터 맵 버튼 ── */
  html[data-device="mobile"] .map-btn-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
  }
  html[data-device="mobile"] .map-btn-name {
    font-size: 0.5rem;
    max-width: 100%;
  }
  html[data-device="mobile"] .map-list-flex {
    gap: 0.25rem;
    padding: 0.25rem;
    max-height: 8rem;
    overflow-y: auto;
  }

  /* ── 선택된 맵 미리보기 ── */
  html[data-device="mobile"] .selected-map-img-wrapper {
    max-width: 100%;
    height: auto;
    min-height: 5rem;
  }

  /* ═══════════════════════════════════════════
     NEW: 팀 빌더 탭 — 팀 구성 / 대전 미리보기 / 카드
     ═══════════════════════════════════════════ */

  /* ── 팀 셋업 헤더 ── */
  html[data-device="mobile"] .team-setup-content {
    padding: 0.625rem 0.75rem;
    gap: 0.5rem;
    flex-direction: column;
    align-items: stretch;
  }
  html[data-device="mobile"] .team-setup-title {
    font-size: 0.95rem;
  }
  html[data-device="mobile"] .team-setup-desc {
    font-size: 0.68rem;
  }
  html[data-device="mobile"] .team-setup-label {
    font-size: 0.55rem;
    letter-spacing: 0.1rem;
  }
  html[data-device="mobile"] .team-setup-left {
    min-width: 0;
  }
  html[data-device="mobile"] .team-setup-right {
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
  }
  html[data-device="mobile"] .team-setup-field {
    width: 100%;
  }
  html[data-device="mobile"] .team-setup-input {
    font-size: 0.72rem;
    padding: 0.3rem 0.5rem;
    width: 100%;
  }

  /* ── 팀 탑 로우 (맵 선택 + 팀 구성) → 단일 컬럼 ── */
  html[data-device="mobile"] .team-top-row {
    grid-template-columns: 1fr !important;
    gap: 0.5rem;
  }

  /* ── 팀 맵 셀렉터 ── */
  html[data-device="mobile"] .team-map-selector .form-check {
    flex: 0 0 calc((100% - 0.25rem) / 2) !important;
    max-width: calc((100% - 0.25rem) / 2);
  }

  /* ── 대전 미리보기 (VS 화면) ── */
  html[data-device="mobile"] .team-battle-preview {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.625rem 0.5rem;
    min-height: auto;
  }
  html[data-device="mobile"] .team-battle-blue,
  html[data-device="mobile"] .team-battle-red {
    align-items: stretch;
    padding: 0;
    gap: 0.3rem;
  }
  html[data-device="mobile"] .team-battle-map {
    order: -1;
  }
  html[data-device="mobile"] .team-preview-icons-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
  }

  /* ── 배틀 영웅 카드 ── */
  html[data-device="mobile"] .battle-hero-card {
    min-width: 0;
    gap: 0.35rem;
    padding: 0.25rem 0.4rem;
  }
  html[data-device="mobile"] .battle-hero-icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.375rem;
  }
  html[data-device="mobile"] .battle-hero-name {
    font-size: 0.7rem;
  }
  html[data-device="mobile"] .battle-hero-score {
    font-size: 0.58rem;
  }
  html[data-device="mobile"] .battle-hero-card.blue {
    flex-direction: row;
    text-align: left;
    border-left: none;
    border-bottom: 2px solid rgba(56, 189, 248, 0.5);
  }
  html[data-device="mobile"] .battle-hero-card.red {
    border-right: none;
    border-bottom: 2px solid rgba(239, 68, 68, 0.5);
  }

  /* ── 팀 액션 바 ── */
  html[data-device="mobile"] .team-action-bar {
    padding: 0.4rem 0.5rem;
    gap: 0.35rem;
  }
  html[data-device="mobile"] .team-action-left,
  html[data-device="mobile"] .team-action-right,
  html[data-device="mobile"] .team-action-center {
    width: 100%;
    justify-content: center;
  }
  html[data-device="mobile"] .team-action-btn {
    flex: 1;
    font-size: 0.65rem;
    padding: 0.3rem 0.4rem;
    text-align: center;
  }

  /* ── 팀 VS 그리드 ── */
  html[data-device="mobile"] .team-vs-grid {
    gap: 0.4rem !important;
  }
  html[data-device="mobile"] .team-vs-center {
    padding: 0.25rem 0;
    gap: 0.25rem;
  }
  html[data-device="mobile"] .vs-text {
    font-size: 1.25rem;
  }
  html[data-device="mobile"] .score-diff {
    font-size: 0.68rem;
    padding: 0.1rem 0.375rem;
  }

  /* ── 팀 카드 (역할/영웅 칩) ── */
  html[data-device="mobile"] .team-header {
    padding: 0.3rem;
    font-size: 0.68rem;
    letter-spacing: 0.02rem;
  }
  html[data-device="mobile"] .team-body {
    padding: 0.3rem;
  }
  html[data-device="mobile"] .role-block {
    padding: 0.25rem;
    margin-bottom: 0.2rem;
  }
  html[data-device="mobile"] .role-title {
    font-size: 0.6rem;
    margin-bottom: 0.2rem;
    padding-bottom: 0.15rem;
  }
  html[data-device="mobile"] .hero-chip {
    padding: 0.1rem;
    gap: 0;
  }
  html[data-device="mobile"] .hero-chip-icon {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.2rem;
  }
  html[data-device="mobile"] .rec-badge {
    width: 0.75rem;
    height: 0.75rem;
    min-width: 0.75rem;
    font-size: 0.5rem;
  }
  html[data-device="mobile"] .rec-panel-row {
    padding: 0.25rem 0.375rem;
  }
  html[data-device="mobile"] .rec-panel-icon {
    width: 1.375rem;
    height: 1.375rem;
  }
  html[data-device="mobile"] .rec-panel-name {
    font-size: 0.65rem;
  }
  html[data-device="mobile"] .rec-panel-score {
    font-size: 0.62rem;
    min-width: 2.25rem;
  }
  html[data-device="mobile"] .rec-tag {
    font-size: 0.5rem;
    padding: 0.05rem 0.2rem;
  }

  /* ── 팀 가중치 슬라이더 ── */
  html[data-device="mobile"] #team_weight_body > div {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  /* ── 역할 선택/추천 버튼 ── */
  html[data-device="mobile"] #my_role_select {
    font-size: 0.62rem !important;
    padding: 0.1rem 0.75rem 0.1rem 0.2rem !important;
  }
  html[data-device="mobile"] #recommend_hero_btn {
    font-size: 0.62rem !important;
    padding: 0.15rem 0.4rem !important;
  }

  /* ═══════════════════════════════════════════
     NEW: 통계 탭 — 차트 높이 / 카드 / 3D 시각화
     ═══════════════════════════════════════════ */

  /* ── 통계 탭 전역 ── */
  html[data-device="mobile"] #stat .col-md-6 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  html[data-device="mobile"] #stat .card-body {
    padding: 0.4rem;
  }
  html[data-device="mobile"] #stat .card-header {
    padding: 0.4rem 0.5rem;
  }
  html[data-device="mobile"] #stat .fw-bold {
    font-size: 0.72rem;
  }
  html[data-device="mobile"] #stat .small.text-muted {
    font-size: 0.58rem;
  }
  html[data-device="mobile"] #stat .card-header .btn-sm {
    font-size: 0.6rem;
    padding: 0.15rem 0.35rem;
  }

  /* ── 3D 차트 높이 축소 ── */
  html[data-device="mobile"] #plot_svd_tier_hero_3d,
  html[data-device="mobile"] #plot_svd_map_hero_3d,
  html[data-device="mobile"] #plot_svd_hero_map_3d,
  html[data-device="mobile"] #plot_hero_clustering_3d,
  html[data-device="mobile"] #plot_synergy_network {
    height: 14rem !important;
  }
  html[data-device="mobile"] #plot_archetype_heatmap {
    height: 14rem !important;
  }
  html[data-device="mobile"] #plot_archetype_radar,
  html[data-device="mobile"] #plot_archetype_affinity {
    height: 12rem !important;
  }

  /* ── 메트릭스 차트 높이 ── */
  html[data-device="mobile"] #home_metrics_body > div > div:first-child > div,
  html[data-device="mobile"] #hero_map_metrics_body > div > div:first-child > div,
  html[data-device="mobile"] #map_metrics_body > div > div:first-child > div {
    height: 12rem !important;
  }

  /* ── 예측 그리드 ── */
  html[data-device="mobile"] .prediction-grid {
    grid-template-columns: 1fr !important;
    gap: 0.3rem;
  }

  /* ── 테이블 ── */
  html[data-device="mobile"] .table-wrap table {
    font-size: 0.65rem;
  }
  html[data-device="mobile"] .table-wrap th,
  html[data-device="mobile"] .table-wrap td {
    padding: 0.2rem 0.25rem;
  }

  /* ═══════════════════════════════════════════
     NEW: 카운터/시너지 바 차트 — 모바일 최적화
     ═══════════════════════════════════════════ */

  /* ── 카운터 수직 바 ── */
  html[data-device="mobile"] .counter-vbar-col {
    min-width: 0;
    max-width: none;
    padding: 0.125rem 0.0625rem;
    gap: 0;
  }
  html[data-device="mobile"] .counter-vbar-col:hover {
    transform: none;
    box-shadow: none;
  }
  html[data-device="mobile"] .counter-vbar-sub-label {
    font-size: 0.45rem;
    margin-left: 0.2rem;
  }

  /* ── 시너지 듀얼 컨테이너 ── */
  html[data-device="mobile"] .synergy-duo-container {
    padding: 0.0625rem 0.125rem;
  }
  html[data-device="mobile"] .synergy-vbar-section-label {
    font-size: 0.5rem;
    padding: 0.1rem 0.25rem;
  }
  html[data-device="mobile"] .synergy-vbar-row-wrap {
    gap: 1px;
    padding: 0.0625rem;
  }

  /* ── 시너지 수직 바 ── */
  html[data-device="mobile"] .synergy-vbar-col {
    min-width: 0;
    max-width: none;
    padding: 0.125rem 0.0625rem;
  }
  html[data-device="mobile"] .synergy-vbar-col:hover {
    transform: none;
  }
  html[data-device="mobile"] .synergy-vbar-icon,
  html[data-device="mobile"] .synergy-vbar-fb {
    width: 0.875rem;
    height: 0.875rem;
  }
  html[data-device="mobile"] .synergy-vbar-name {
    font-size: 0.375rem;
    max-width: 2.25rem;
  }
  html[data-device="mobile"] .synergy-vbar-val {
    font-size: 0.375rem;
  }
  html[data-device="mobile"] .synergy-vbar-track {
    width: 0.5rem;
  }
  html[data-device="mobile"] .synergy-vbar-map-label {
    font-size: 0.45rem;
    margin-left: 0.2rem;
  }

  /* ── 역할별 뷰 (BY_ROLE) → 세로 스택 ── */
  html[data-device="mobile"] .synergy-byrole-wrap {
    flex-direction: column;
  }
  html[data-device="mobile"] .synergy-byrole-col {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  html[data-device="mobile"] .synergy-byrole-col:last-child {
    border-bottom: none;
  }
  html[data-device="mobile"] .synergy-byrole-header {
    font-size: 0.6rem;
    padding: 0.2rem 0 0.15rem;
  }

  /* ── 카운터 사이드 패널 ── */
  html[data-device="mobile"] .counter-side-panel {
    max-width: none;
    max-height: 8rem !important;
    border-left: none;
    border-top: 1px solid rgba(148, 163, 184, 0.06);
  }

  /* ── 산점도 필터 바 ── */
  html[data-device="mobile"] .counter-scatter-filter-bar {
    top: 0.25rem;
    right: 0.25rem;
  }
  html[data-device="mobile"] .counter-scatter-filter-bar .home-role-tab {
    font-size: 0.55rem;
    padding: 0.15rem 0.3rem;
  }

  /* ═══════════════════════════════════════════
     NEW: 모달/팝업 — 모바일 최적화
     ═══════════════════════════════════════════ */

  /* ── 모달 전역 ── */
  html[data-device="mobile"] .modal-dialog.modal-xl,
  html[data-device="mobile"] .modal-dialog.modal-lg {
    max-width: calc(100vw - 0.5rem) !important;
    margin: 0.25rem auto !important;
  }
  html[data-device="mobile"] .modal-header {
    padding: 0.5rem 0.625rem;
  }
  html[data-device="mobile"] .modal-header .modal-title {
    font-size: 0.82rem;
  }
  html[data-device="mobile"] .modal-body {
    padding: 0.4rem !important;
  }
  html[data-device="mobile"] .modal-footer {
    padding: 0.4rem 0.625rem;
    flex-wrap: wrap;
    gap: 0.2rem;
  }
  html[data-device="mobile"] .modal-footer .btn {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }

  /* ── 영웅 모달: 스택 레이아웃 ── */
  html[data-device="mobile"] .hm-grid {
    flex-direction: column;
  }
  html[data-device="mobile"] .hm-left,
  html[data-device="mobile"] .hm-right {
    flex: none;
  }
  html[data-device="mobile"] .hm-left-bot {
    flex-direction: column;
  }

  /* ── 스코어 테이블 → 단일 컬럼 ── */
  html[data-device="mobile"] .st-col {
    flex: 1 1 100%;
  }
  html[data-device="mobile"] .st-col-icon {
    font-size: 0.55rem;
  }
  html[data-device="mobile"] .st-col-title {
    font-size: 0.6rem;
  }

  /* ── 영웅 모달 차트 높이 ── */
  html[data-device="mobile"] #heroModalTrend {
    height: 10rem !important;
  }
  html[data-device="mobile"] #heroModalSvd {
    height: 10rem !important;
  }
  html[data-device="mobile"] #heroModalScores {
    flex-wrap: wrap !important;
    gap: 0.2rem !important;
  }
  html[data-device="mobile"] .hero-modal-table {
    font-size: 0.65rem;
  }

  /* ── 맵 모달 차트 ── */
  html[data-device="mobile"] #mapModalTrend {
    height: 10rem !important;
  }

  /* ── 인포 툴팁 (ℹ️ 아이콘) ── */
  html[data-device="mobile"] .counter-info-tooltip {
    width: min(16rem, calc(100vw - 1.5rem)) !important;
    font-size: 0.65rem;
  }
  html[data-device="mobile"] .counter-info-title {
    font-size: 0.72rem;
  }
  html[data-device="mobile"] .counter-info-item .item-key {
    font-size: 0.62rem;
  }
  html[data-device="mobile"] .counter-info-item .item-desc {
    font-size: 0.58rem;
  }

  /* ── 티어 드롭다운 내부 ── */
  html[data-device="mobile"] .tier-dropdown-header {
    padding: 0.35rem 0.5rem;
  }
  html[data-device="mobile"] .tier-dropdown-title {
    font-size: 0.72rem;
  }
  html[data-device="mobile"] .tier-list {
    gap: 0.2rem;
    padding: 0.25rem !important;
  }
  html[data-device="mobile"] .tier-rank-pill {
    font-size: 0.6rem;
    padding: 0.2rem 0.375rem;
    gap: 0.25rem;
  }
  html[data-device="mobile"] .tier-rank-icon-img {
    width: 0.875rem;
    height: 0.875rem;
  }
  html[data-device="mobile"] .tier-plot-wrap {
    margin: 0.25rem 0;
  }
  html[data-device="mobile"] #plot_tier_distribution {
    height: 5rem !important;
  }
  html[data-device="mobile"] .tier-apply-btn {
    font-size: 0.7rem;
    padding: 0.35rem 0.75rem;
  }

  /* ── 필터 패널 (사이드바 대체) ── */
  html[data-device="mobile"] .filter-panel {
    padding: 0.4rem 0.5rem;
    border-radius: 0.5rem;
  }
  html[data-device="mobile"] .panel-title {
    font-size: 0.65rem;
    letter-spacing: 1px;
  }

  /* ── 홈 스탯 카드 ── */
  html[data-device="mobile"] .home-stat-card {
    padding: 0.4rem 0.5rem;
    gap: 0.35rem;
  }

  /* ── 추이 비교 영역 ── */
  html[data-device="mobile"] #trend_compare_area {
    flex-wrap: wrap;
    gap: 0.2rem !important;
  }
  html[data-device="mobile"] #trend_compare_btn {
    font-size: 0.55rem;
    padding: 0.15rem 0.3rem;
  }
  html[data-device="mobile"] .trend-compare-dropdown {
    width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
    left: 0 !important;
    right: auto !important;
  }
  html[data-device="mobile"] #trend_metric_toggles .home-role-tab {
    font-size: 0.55rem;
    padding: 0.15rem 0.3rem;
  }

  /* ── 결과 카드 (팀 시뮬레이션) ── */
  html[data-device="mobile"] .result-card {
    font-size: 0.7rem;
  }
  html[data-device="mobile"] .separator-text {
    font-size: 0.78rem;
  }

  /* ── 로그 모달 페이지네이션 ── */
  html[data-device="mobile"] .modal-footer .me-auto {
    width: 100%;
    justify-content: center;
    margin-bottom: 0.25rem;
  }

  /* ═══════════════════════════════════════════
     데이터 테이블 (ht-data-table) — 가로 스크롤 래퍼
     ═══════════════════════════════════════════ */

  /* 테이블 래퍼에 가로 스크롤 허용 */
  html[data-device="mobile"] .ht-data-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  /* 기본 헤더/로우: 고정폭 열 축소 */
  html[data-device="mobile"] .ht-dt-header,
  html[data-device="mobile"] .ht-dt-row {
    grid-template-columns: 1.25rem 7rem 1fr 2.5rem 2.5rem 2.5rem 2.75rem;
    padding: 0.25rem 0.4rem;
    gap: 0.0625rem;
    min-width: 22rem;
  }
  html[data-device="mobile"] .ht-dt-header span {
    font-size: 0.5rem;
    letter-spacing: 0.03rem;
  }
  html[data-device="mobile"] .ht-dt-hero-img {
    width: 1.25rem;
    height: 1.25rem;
  }
  html[data-device="mobile"] .ht-dt-hero-name {
    font-size: 0.6rem;
  }
  html[data-device="mobile"] .ht-dt-rank {
    font-size: 0.55rem;
  }
  html[data-device="mobile"] .ht-dt-val {
    font-size: 0.55rem;
  }
  html[data-device="mobile"] .ht-dt-hero-role-label {
    font-size: 0.45rem;
    padding: 0.03rem 0.2rem;
  }

  /* 맵 변형 (5열) */
  html[data-device="mobile"] .ht-dt-header-map,
  html[data-device="mobile"] .ht-dt-row-map {
    grid-template-columns: 1.25rem minmax(0, 6rem) 1fr 2.5rem 2.5rem !important;
    min-width: 18rem;
  }
  /* 상세 변형 (7열) */
  html[data-device="mobile"] .ht-dt-header-detail,
  html[data-device="mobile"] .ht-dt-row-detail {
    grid-template-columns: 1.25rem 6rem 1fr 2.25rem 2.25rem 2.25rem 2.25rem !important;
    min-width: 22rem;
  }
  /* 6열 변형 (9열) */
  html[data-device="mobile"] .ht-dt-header-detail.hd-6col,
  html[data-device="mobile"] .ht-dt-row-detail.hd-6col {
    grid-template-columns: 1.25rem 5rem 1fr 2rem 2rem 2rem 2rem 2rem 2.25rem !important;
    min-width: 24rem;
  }
  /* 4열 변형 (7열) */
  html[data-device="mobile"] .ht-dt-header-detail.hd-4col,
  html[data-device="mobile"] .ht-dt-row-detail.hd-4col {
    grid-template-columns: 1.25rem minmax(0, 5.5rem) minmax(0, 1fr) 2.75rem 2.75rem 2.75rem 2.75rem !important;
    min-width: 22rem;
  }
  /* 추세 열 포함 (8열) */
  html[data-device="mobile"] .ht-dt-header-detail.hd-has-trend,
  html[data-device="mobile"] .ht-dt-row-detail.hd-has-trend {
    grid-template-columns: 1.25rem 5.5rem 1fr 2.25rem 2.25rem 2.25rem 2.25rem 2.25rem !important;
    min-width: 23rem;
  }
  html[data-device="mobile"] .ht-dt-val-hdr {
    font-size: 8px;
    letter-spacing: 0.5px;
  }
  html[data-device="mobile"] .ht-dt-map-img {
    width: 1.5rem;
    height: 0.9375rem;
  }
  html[data-device="mobile"] .ht-dt-delta {
    font-size: 8px;
  }
  html[data-device="mobile"] .ht-dt-trend-arrow {
    font-size: 7px;
  }

  /* ═══════════════════════════════════════════
     추천 플로팅 패널
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .rec-float-panel {
    width: calc(100vw - 1rem) !important;
    left: 0.5rem !important;
    top: auto !important;
    bottom: 0.5rem !important;
    max-height: 55vh;
  }
  html[data-device="mobile"] .rec-float-header {
    padding: 0.4rem 0.625rem;
    font-size: 0.72rem;
  }
  html[data-device="mobile"] .rec-float-body {
    padding: 0.35rem;
    max-height: 45vh;
  }

  /* ═══════════════════════════════════════════
     선택된 맵 이미지 (팀 빌더)
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .selected-map-img-wrapper img {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
  }
  html[data-device="mobile"] .selected-map-img-wrapper {
    min-height: 6rem;
  }
  html[data-device="mobile"] .team-battle-map .selected-map-img-wrapper img {
    width: 100% !important;
    height: auto !important;
  }

  /* ═══════════════════════════════════════════
     영웅/맵 탭 배너
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .hero-tab-banner-content,
  html[data-device="mobile"] .map-tab-banner-content {
    padding: 0.5rem 0.625rem;
    gap: 0.35rem;
    flex-direction: column;
    align-items: flex-start;
  }
  html[data-device="mobile"] .hero-tab-banner-left,
  html[data-device="mobile"] .map-tab-banner-left {
    min-width: 0;
  }
  html[data-device="mobile"] .hero-tab-banner-title,
  html[data-device="mobile"] .map-tab-banner-title {
    font-size: 0.95rem;
  }
  html[data-device="mobile"] .hero-tab-banner-desc,
  html[data-device="mobile"] .map-tab-banner-desc {
    font-size: 0.62rem;
    display: none;
  }
  html[data-device="mobile"] .hero-tab-banner-label,
  html[data-device="mobile"] .map-tab-banner-label {
    font-size: 0.5rem;
  }

  /* ═══════════════════════════════════════════
     상세 섹션 헤더/액션
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .hd-section-head {
    padding: 0.35rem 0.5rem;
    font-size: 0.55rem;
    gap: 0.25rem;
    min-height: 1.5rem;
    flex-wrap: nowrap;
  }
  html[data-device="mobile"] .hd-section-label {
    font-size: 0.62rem;
  }
  html[data-device="mobile"] .hd-section-icon {
    font-size: 0.62rem;
  }
  /* info 아이콘 숨김 (모바일에서 툴팁 사용 불가) */
  html[data-device="mobile"] .hd-section-head .counter-info-icon {
    display: none;
  }
  /* 홈 역할필터 탭 — 인라인 축소 */
  html[data-device="mobile"] .hd-section-head .mc-tabs {
    position: static !important;
    transform: none !important;
    padding: 0 !important;
    gap: 1px;
  }
  html[data-device="mobile"] .hd-section-head .mc-tab {
    font-size: 0.52rem !important;
    padding: 0.12rem 0.3rem !important;
  }
  html[data-device="mobile"] .hd-section-actions {
    margin-left: auto;
    width: auto;
    justify-content: flex-end;
    gap: 0.15rem;
    margin-top: 0;
  }
  html[data-device="mobile"] .hd-btn-sm {
    font-size: 0.5rem;
    padding: 0.12rem 0.35rem;
  }

  /* ═══════════════════════════════════════════
     통계탭 — 분포 그리드 / biplot
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .stat-biplot-compare {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.4rem;
  }
  html[data-device="mobile"] .stat-biplot-panel {
    padding: 0.4rem;
  }
  html[data-device="mobile"] .stat-biplot-title {
    font-size: 0.68rem;
  }
  html[data-device="mobile"] .stat-dist-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.4rem;
  }
  html[data-device="mobile"] .stat-dist-panel {
    padding: 0.4rem;
  }

  /* ═══════════════════════════════════════════
     모드 디테일 그리드
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .mode-detail-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
  }
  html[data-device="mobile"] .mode-detail-card {
    padding: 4px 6px;
    gap: 4px;
  }

  /* ═══════════════════════════════════════════
     추이 기간 토글
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .trend-period-toggle {
    gap: 1px;
  }
  html[data-device="mobile"] .trend-period-btn {
    font-size: 0.55rem;
    padding: 0.15rem 0.35rem;
  }
  html[data-device="mobile"] .hero-trend-container {
    padding: 0.3rem 0.4rem;
  }
  html[data-device="mobile"] .hero-trend-dual-row {
    flex-direction: column;
    gap: 0.35rem;
  }

  /* ═══════════════════════════════════════════
     영웅 스트립 (상세) — 모바일 스택
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .hero-strip-body,
  html[data-device="mobile"] .map-strip-body {
    grid-template-columns: 1fr !important;
    min-height: auto;
  }
  html[data-device="mobile"] .hero-strip-attrs-section,
  html[data-device="mobile"] .map-strip-attrs-section {
    flex: 0 0 auto !important;
    width: 100%;
  }
  html[data-device="mobile"] .hero-strip-mid-section {
    flex-wrap: wrap;
    min-width: 0;
  }
  html[data-device="mobile"] .hero-strip-mid-section .hero-strip-cell {
    flex: 1 1 100%;
    min-width: 0;
  }
  html[data-device="mobile"] .hero-strip-section {
    border-left: none !important;
    border-top: 1px solid rgba(148,163,184,0.06);
  }
  html[data-device="mobile"] .hero-strip-section:first-child {
    border-top: none;
  }
  html[data-device="mobile"] .hero-strip-charts-section {
    border-left: none;
    border-top: 1px solid rgba(148,163,184,0.08);
  }
  html[data-device="mobile"] .hero-strip-header {
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
  }
  html[data-device="mobile"] .hero-strip-name {
    font-size: 0.82rem;
  }
  html[data-device="mobile"] .hero-strip .hero-detail-image {
    width: 2.5rem;
    height: 2.5rem;
  }
  html[data-device="mobile"] .hero-strip-stier-row {
    display: none;
  }
  html[data-device="mobile"] .hero-strip-chart-cell {
    min-height: 9rem;
  }
  html[data-device="mobile"] .hero-strip-section-label {
    font-size: 0.52rem;
    padding: 0.25rem 0.4rem 0.1rem;
  }
  html[data-device="mobile"] .hero-strip-bipolar-row {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  /* ═══════════════════════════════════════════
     mc-row (지표 행) / md-row (맵 분포 행)
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .mc-row,
  html[data-device="mobile"] .mc-row-mid {
    min-width: 0 !important;
  }
  html[data-device="mobile"] .mc-row::before {
    display: none;
  }
  html[data-device="mobile"] .mc-bar-glow {
    display: none;
  }
  html[data-device="mobile"] .md-row,
  html[data-device="mobile"] .md-row-left {
    min-width: 0 !important;
  }

  /* ═══════════════════════════════════════════
     카운터 수식 그리드
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .counter-info-formula-grid {
    font-size: 0.55rem;
    overflow-x: auto;
  }

  /* ═══════════════════════════════════════════
     영웅 모달 카드
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] .hero-modal-card {
    padding: 0.35rem;
  }

  /* ═══════════════════════════════════════════
     글로벌 overflow 방지 (안전장치)
     ═══════════════════════════════════════════ */
  html[data-device="mobile"] body {
    overflow-x: hidden;
  }
  html[data-device="mobile"] .tab-pane {
    overflow-x: hidden;
  }
  html[data-device="mobile"] .tab-content {
    overflow-x: hidden;
    height: auto !important;
    overflow-y: visible !important;
  }
  html[data-device="mobile"] .tab-pane.active {
    overflow-y: visible;
  }
}


/* ════════════════════════════════════════════
   SMALL MOBILE (≤360px) — 더 극단적 축소
   ════════════════════════════════════════════ */
@media (max-width: 360px) {
  html[data-device="mobile"] .home-spotlight-card {
    min-width: 2.75rem;
    padding: 0.25rem 0.3rem 0.2rem;
  }
  html[data-device="mobile"] .home-spotlight-img {
    width: 1.625rem;
    height: 1.625rem;
  }
  html[data-device="mobile"] .home-spotlight-name {
    font-size: 0.4rem;
    max-width: 2.25rem;
  }
  html[data-device="mobile"] .ht-hero {
    width: 2.25rem;
    padding: 0.125rem 0;
  }
  html[data-device="mobile"] .ht-hero-img {
    width: 1.375rem;
    height: 1.375rem;
  }
  html[data-device="mobile"] .ht-hero-name {
    font-size: 0.3rem;
    max-width: 2rem;
  }
  html[data-device="mobile"] .ht-tier-badge {
    min-width: 1.625rem;
  }
  html[data-device="mobile"] .ht-tier-badge-letter {
    font-size: 0.7rem;
  }
  html[data-device="mobile"] .home-banner-title {
    font-size: 0.88rem;
  }
  html[data-device="mobile"] #mainTabs .nav-link {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
  }
  html[data-device="mobile"] .home-role-tab {
    font-size: 0.58rem;
    padding: 0.2rem 0.35rem;
  }

  /* ── NEW: 영웅 선택/맵 선택 더 축소 ── */
  html[data-device="mobile"] .hero-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(2.25rem, 1fr));
  }
  html[data-device="mobile"] .hero-select-icon {
    width: 2rem;
    height: 2rem;
  }
  html[data-device="mobile"] .map-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(2.75rem, 1fr));
  }
  html[data-device="mobile"] .map-select-icon {
    width: 2.5rem;
  }
  html[data-device="mobile"] .map-grid {
    grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr));
    gap: 4px;
  }
  html[data-device="mobile"] .map-grid-name {
    font-size: 7px;
  }

  /* ── NEW: 디테일 배너 더 축소 ── */
  html[data-device="mobile"] .detail-banner .hero-detail-image {
    width: 1.875rem;
    height: 1.875rem;
  }
  html[data-device="mobile"] .detail-banner .hero-detail-header h2 {
    font-size: 0.85rem;
  }

  /* ── NEW: 팀 빌더 더 축소 ── */
  html[data-device="mobile"] .battle-hero-icon {
    width: 1.5rem;
    height: 1.5rem;
  }
  html[data-device="mobile"] .battle-hero-name {
    font-size: 0.62rem;
  }
  html[data-device="mobile"] .team-setup-title {
    font-size: 0.85rem;
  }
  html[data-device="mobile"] .team-action-btn {
    font-size: 0.58rem;
    padding: 0.25rem 0.3rem;
  }

  /* ── NEW: 시너지/카운터 바 더 축소 ── */
  html[data-device="mobile"] .synergy-vbar-icon,
  html[data-device="mobile"] .synergy-vbar-fb {
    width: 0.75rem;
    height: 0.75rem;
  }
  html[data-device="mobile"] .synergy-vbar-name {
    font-size: 0.3rem;
    max-width: 1.75rem;
  }

  /* ── NEW: 차트 높이 더 축소 ── */
  html[data-device="mobile"] #plot_svd_tier_hero_3d,
  html[data-device="mobile"] #plot_svd_map_hero_3d,
  html[data-device="mobile"] #plot_svd_hero_map_3d,
  html[data-device="mobile"] #plot_hero_clustering_3d,
  html[data-device="mobile"] #plot_synergy_network {
    height: 11rem !important;
  }
  html[data-device="mobile"] #plot_archetype_heatmap {
    height: 11rem !important;
  }
  html[data-device="mobile"] #plot_archetype_radar,
  html[data-device="mobile"] #plot_archetype_affinity {
    height: 9.5rem !important;
  }

  /* ── NEW: 모달 더 축소 ── */
  html[data-device="mobile"] .hero-inner-tab {
    font-size: 0.55rem;
    padding: 0.15rem 0.3rem;
  }
  html[data-device="mobile"] .score-chip {
    font-size: 0.48rem;
  }
  html[data-device="mobile"] .matchup-chip-name {
    font-size: 0.42rem;
  }
  html[data-device="mobile"] .matchup-chip-icon {
    width: 0.75rem;
    height: 0.75rem;
  }

  /* ── NEW: 데이터 테이블 더 축소 ── */
  html[data-device="mobile"] .ht-dt-header,
  html[data-device="mobile"] .ht-dt-row {
    grid-template-columns: 1rem 5.5rem 1fr 2rem 2rem 2rem 2.25rem;
    padding: 0.2rem 0.3rem;
  }
  html[data-device="mobile"] .ht-dt-hero-name {
    font-size: 0.52rem;
  }
  html[data-device="mobile"] .ht-dt-hero-img {
    width: 1rem;
    height: 1rem;
  }
  html[data-device="mobile"] .ht-dt-val {
    font-size: 0.48rem;
  }

  /* ── NEW: 영웅 스트립 더 축소 ── */
  html[data-device="mobile"] .hero-strip .hero-detail-image {
    width: 2rem;
    height: 2rem;
  }
  html[data-device="mobile"] .hero-strip-name {
    font-size: 0.75rem;
  }
}


/* ════════════════════════════════════════════
   TABLET  (481px – 768px)
   ════════════════════════════════════════════ */
@media (min-width: 481px) and (max-width: 768px) {

  html[data-device="tablet"] body {
    font-size: var(--m-fs-base);
  }
  html[data-device="tablet"] .container-fluid {
    padding: var(--m-container-pad) !important;
  }

  /* ── 홈탭: 배너 ── */
  html[data-device="tablet"] .home-banner-content {
    padding: 0.625rem 0.75rem;
    gap: 0.5rem;
  }
  html[data-device="tablet"] .home-banner-title {
    font-size: 1.2rem;
  }

  /* ── 홈탭: 듀얼 그리드 유지하되 간격 축소 ── */
  html[data-device="tablet"] .home-dual-grid {
    gap: 0.5rem;
  }

  /* ── 홈탭: 역할탭 ── */
  html[data-device="tablet"] .home-role-tab {
    font-size: 0.7rem;
    padding: 0.3rem 0.625rem;
  }

  /* ── 홈탭: 티어 아이템 ── */
  html[data-device="tablet"] .ht-hero {
    width: 3.25rem;
  }
  html[data-device="tablet"] .ht-hero-img {
    width: 2rem;
    height: 2rem;
  }
  html[data-device="tablet"] .ht-hero-name {
    font-size: 0.45rem;
  }

  /* ── 카드/섹션 ── */
  html[data-device="tablet"] .card,
  html[data-device="tablet"] .detail-section {
    padding: var(--m-card-pad);
    margin-bottom: var(--m-section-gap);
  }

  /* ── 히어로 디테일 ── */
  html[data-device="tablet"] .hero-detail-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── 맵 그리드 ── */
  html[data-device="tablet"] .map-card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* ═══════════════════════════════════════════
     NEW: 태블릿 — 영웅 탭 최적화
     ═══════════════════════════════════════════ */

  /* ── 영웅 1x2 그리드 → 단일 컬럼 ── */
  html[data-device="tablet"] .hero-grid-1x2 {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
    gap: 0.5rem;
  }
  html[data-device="tablet"] .hero-grid-cell {
    grid-row: auto;
    display: flex;
    flex-direction: column;
    min-height: 18rem;
  }
  html[data-device="tablet"] .hero-grid-cell-header {
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.4rem 0.625rem;
  }
  html[data-device="tablet"] .hero-inner-tab {
    font-size: 0.68rem;
    padding: 0.25rem 0.5rem;
    min-height: 2rem;
  }
  html[data-device="tablet"] .hero-tab-extra {
    flex-basis: 100%;
  }

  /* ── 영웅 선택 그리드 ── */
  html[data-device="tablet"] .hero-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr));
    gap: 0.25rem;
  }
  html[data-device="tablet"] .map-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
    gap: 0.25rem;
  }
  html[data-device="tablet"] .map-grid {
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    gap: 6px;
  }

  /* ── 디테일 배너 ── */
  html[data-device="tablet"] .detail-banner-content {
    padding: 0.625rem 0.75rem;
    gap: 0.5rem;
  }
  html[data-device="tablet"] .detail-banner .hero-detail-image {
    width: 2.75rem;
    height: 2.75rem;
  }

  /* ── 스코어 칩 ── */
  html[data-device="tablet"] .hero-score-summary {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  html[data-device="tablet"] .matchup-row {
    gap: 0.4rem 0.75rem;
  }

  /* ═══════════════════════════════════════════
     NEW: 태블릿 — 팀 빌더 최적화
     ═══════════════════════════════════════════ */

  html[data-device="tablet"] .team-top-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  html[data-device="tablet"] .team-setup-content {
    padding: 0.875rem 1rem;
    gap: 0.75rem;
  }
  html[data-device="tablet"] .team-battle-preview {
    padding: 0.75rem;
  }
  html[data-device="tablet"] .battle-hero-card {
    min-width: 7rem;
  }

  /* ═══════════════════════════════════════════
     NEW: 태블릿 — 통계 탭 최적화
     ═══════════════════════════════════════════ */

  html[data-device="tablet"] #stat .col-md-6 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  html[data-device="tablet"] #plot_svd_tier_hero_3d,
  html[data-device="tablet"] #plot_svd_map_hero_3d,
  html[data-device="tablet"] #plot_svd_hero_map_3d,
  html[data-device="tablet"] #plot_hero_clustering_3d,
  html[data-device="tablet"] #plot_synergy_network {
    height: 16rem !important;
  }

  /* ═══════════════════════════════════════════
     NEW: 태블릿 — 카운터/시너지 ── */

  html[data-device="tablet"] .synergy-vbar-icon,
  html[data-device="tablet"] .synergy-vbar-fb {
    width: 1rem;
    height: 1rem;
  }
  html[data-device="tablet"] .synergy-vbar-name {
    font-size: 0.4rem;
    max-width: 2.5rem;
  }
  html[data-device="tablet"] .counter-side-panel {
    max-height: 10rem !important;
  }

  /* ═══════════════════════════════════════════
     NEW: 태블릿 — 모달 ── */

  html[data-device="tablet"] .modal-dialog.modal-xl,
  html[data-device="tablet"] .modal-dialog.modal-lg {
    max-width: calc(100vw - 1rem) !important;
  }
  html[data-device="tablet"] .hm-grid {
    flex-direction: column;
  }
  html[data-device="tablet"] .hm-left,
  html[data-device="tablet"] .hm-right {
    flex: none;
  }
}


/* ════════════════════════════════════════════
   터치 디바이스 공통  (coarse pointer)
   ════════════════════════════════════════════ */
@media (pointer: coarse) {

  /* 터치 타겟 최소 크기 */
  html[data-device="mobile"] button,
  html[data-device="mobile"] .nav-link,
  html[data-device="mobile"] .tier-rank-pill,
  html[data-device="mobile"] .btn {
    min-height: 36px;
  }

  /* 스크롤 성능 */
  html[data-device="mobile"] .home-tier-body,
  html[data-device="mobile"] .home-spotlight-heroes,
  html[data-device="mobile"] .mc-scroll,
  html[data-device="mobile"] #mainTabs,
  html[data-device="mobile"] .synergy-vbar-row-wrap,
  html[data-device="mobile"] .map-list-flex {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* 롱프레스 하이라이트 제거 */
  html[data-device="mobile"] * {
    -webkit-tap-highlight-color: transparent;
  }

  /* 터치 영웅/맵 아이템: active 상태 피드백 */
  html[data-device="mobile"] .ht-hero:active,
  html[data-device="mobile"] .ht-map:active,
  html[data-device="mobile"] .home-spotlight-card:active,
  html[data-device="mobile"] .hero-select-btn:active,
  html[data-device="mobile"] .map-select-btn:active,
  html[data-device="mobile"] .map-grid-card:active,
  html[data-device="mobile"] .battle-hero-card:active,
  html[data-device="mobile"] .matchup-chip:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }

  /* 터치 카운터/시너지 바 active 피드백 */
  html[data-device="mobile"] .counter-vbar-col:active,
  html[data-device="mobile"] .synergy-vbar-col:active {
    transform: scale(0.92);
    transition: transform 0.1s ease;
  }

  /* 태블릿: 최소 터치 타겟 */
  html[data-device="tablet"] button,
  html[data-device="tablet"] .nav-link,
  html[data-device="tablet"] .btn {
    min-height: 38px;
  }
}


/* ════════════════════════════════════════════
   가로 모드 보정
   ════════════════════════════════════════════ */
@media (max-height: 480px) and (orientation: landscape) {
  html[data-device="mobile"] .home-hero-banner {
    display: none;
  }
  html[data-device="mobile"] .home-tier-body {
    max-height: 60vh;
  }
  html[data-device="mobile"] .hero-grid-cell {
    min-height: 12rem;
  }
  html[data-device="mobile"] .team-battle-preview {
    grid-template-columns: 1fr auto 1fr;
    min-height: auto;
  }
}


/* ════════════════════════════════════════════
   애니메이션 절약 모드
   ════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  html[data-device="mobile"] *,
  html[data-device="mobile"] *::before,
  html[data-device="mobile"] *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
