/* 화면 크기별 조정 — 휴대폰(≤760px) · 태블릿(761~1100px). 맨 마지막에 읽는다 */

/* ---------- 태블릿 ---------- */
@media (max-width: 1100px) {
  .fn2-split { gap: 14px; }
  .pc2-cards { grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); }
  .bm { padding: 14px 16px; }
  .bm-body { grid-template-columns: 1fr; }
  .bm-side { flex-direction: row; flex-wrap: wrap; } .bm-side > .bm-card { flex: 1 1 280px; }
  .bm.bm-full { padding: 14px 16px; }
  .sq2-mine { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
  .sx-cands { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
}

/* ---------- 휴대폰 ---------- */
@media (max-width: 760px) {
  /* 타이틀: 로고 · 이어하기 · 메뉴가 화면 위로 밀려 안 보이던 문제 → 위에서부터 쌓고 스크롤 */
  #screen-title.t2 .title-layout { position: absolute; inset: 0; display: block; overflow-y: auto; padding: 28px 18px 40px; -webkit-overflow-scrolling: touch; }
  #screen-title.t2 .logo-main { font-size: 56px; }
  #screen-title.t2 .logo-sub { font-size: 11.5px; letter-spacing: .2em; }
  #screen-title.t2 .t2-cont { margin-top: 22px; }
  #screen-title.t2 .main-menu { margin-top: 12px; gap: 6px; }
  #screen-title.t2 .main-menu button { padding: 12px 16px; } #screen-title.t2 .main-menu button b { font-size: 18px; }
  #screen-title.t2 .t2-sub .t2-mini { min-width: 0; padding: 9px 10px; } #screen-title.t2 .t2-sub .t2-mini span { display: none; }
  #screen-title.t2 .t2-info { font-size: 11px; gap: 6px; }
  #screen-title.t2 .winners-strip, #screen-title.t2 .ceremony-cap { display: none; }
  body.on-title .mu { bottom: calc(var(--footer-h, 34px) + 14px); }
  .t2-resume { padding: 12px; gap: 10px; } .t2-logo { width: 44px; height: 44px; } .t2-rt b { font-size: 16px; }

  /* 이사회 회의실 */
  .bm, .bm.bm-full { padding: 10px; gap: 10px; }
  .bm-hd { padding: 10px 12px; gap: 10px; } .bm-hd > div:nth-child(2) b { font-size: 16px; } .bm-hd .bm-logo { width: 32px; height: 32px; }
  .bm-trust small { display: none; } .bm-trust b { font-size: 18px; }
  .bm-table { padding: 10px 12px; } .bm-av { width: 38px; height: 38px; font-size: 11px; } .bm-seat b { font-size: 13px; } .bm-seat small { display: none; } .bm-mood { margin-left: 2px; }
  .bm-room { min-height: 0; } .bm-log { max-height: 46vh; padding: 12px; } .bm-say p { max-width: 92%; font-size: 13.5px; padding: 9px 12px; }
  .bm-act { grid-template-columns: 1fr; padding: 10px 12px 14px; } .bm-opt { padding: 10px 12px; }
  .bm-side { flex-direction: column; }

  /* 재정 */
  .fn2-top { grid-template-columns: 1fr 1fr; gap: 8px; } .fn2-hero { grid-column: 1 / -1; }
  .fn2-split { grid-template-columns: 1fr; }
  .fn2-row { grid-template-columns: 88px 1fr auto 34px; gap: 6px; font-size: 12.5px; }
  .fn2-led { grid-template-columns: 48px 1fr auto; } .fn2-sp span { display: none; }

  /* 팀 훈련: 7일 격자가 화면 밖으로 넘치던 문제 */
  .tr2-head { gap: 10px; } .tr2-tools { width: 100%; } .tr2-tools .tr-preset { flex: 1; min-width: 0; } .tr2-auto { white-space: nowrap; padding: 7px 11px; font-size: 13px; }
  .tr2-board { padding: 12px 10px; }
  .tr2-pal { gap: 5px; } .tr2-pal button { padding: 5px 8px; font-size: 12px; gap: 5px; } .tr2-pal button small { display: none; }
  .tr2-grid { grid-template-columns: 26px repeat(7, minmax(0, 1fr)); gap: 3px; }
  .tr2-slot { font-size: 10px; writing-mode: vertical-rl; justify-content: center; }
  .tr2-day small { font-size: 9.5px; } .tr2-day i { display: none; } .tr2-day b { font-size: 12px; }
  .tr2-cell { height: 42px; font-size: 10.5px; padding: 0 1px; border-radius: 6px; word-break: keep-all; line-height: 1.15; }

  /* 개인 훈련 카드 */
  .pc2-cards { grid-template-columns: 1fr; gap: 10px; }
  .pc2-card { padding: 12px; } .pc2-row { grid-template-columns: 64px 1fr; gap: 8px; }
  .pc2-chips button { padding: 4px 8px; font-size: 11.5px; } .pc2-int button { padding: 5px 8px; font-size: 12px; }
  .pc2-grid { min-width: 0; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); } .pc2-ch img { width: 42px; height: 42px; }

  /* 솔랭 · 코치 · 기타 */
  .sq2-mine { grid-template-columns: 1fr 1fr; gap: 8px; } .sq2-p { padding: 10px; } .sq2-top .pl-ph { display: none; } .sq2-rank b { font-size: 18px; }
  .sq2-p .pc2-slot img { width: 32px; height: 32px; } .sq2-p .pc2-slot small { display: none; }
  .cf-table th:nth-child(6), .cf-table td:nth-child(6) { display: none; }
  .sx-st { grid-template-columns: repeat(2, 1fr); }
  .pc-pane[data-tab="car"], .pc-pane[data-tab="cup"] { padding: 14px; }
  .pc-row { grid-template-columns: 12px 36px 1fr auto; gap: 8px; } .pc-main b { font-size: 13.5px; } .pc-side b { font-size: 12.5px; }
  .pc-case { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .bm-banner { flex-direction: column; align-items: stretch; }
}

/* 격자 칸이 내용 폭 때문에 화면보다 넓어지지 않게 (grid 기본 min-width: auto) */
.tr2-main > *, .pc2-cards > *, .sq2-mine > *, .bm-body > *, .bm-side > *, .fn2-top > *, .fn2-mid > *, .fn2-bot > *, .sx-cands > * { min-width: 0; }
.pc2-slot > div, .pc2-slot span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .sq2-mine { grid-template-columns: 1fr; } .tr2-head > div:first-child { min-width: 0; } }
.bm-card { min-width: 0; max-width: 100%; box-sizing: border-box; } .bm-side { min-width: 0; max-width: 100%; }
.pc2-who > div:nth-child(2) { min-width: 0; } .pc2-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .bm-body { grid-template-columns: minmax(0, 1fr); } .bm-side { width: 100%; } }
@media (max-width: 760px) {
  .bm .bm-side { display: flex; flex-direction: column; flex-wrap: nowrap; } .bm .bm-side > .bm-card { flex: none; width: auto; }
  .bm .bm-room { grid-template-rows: auto auto auto; } .bm .bm-log { min-height: 180px; max-height: 50vh; }
}

/* ---------- 밴픽 · 전술 · 라커룸: 휴대폰 (0.3.1) ----------
   예전에는 데스크톱 4열(블루 · 챔피언 · 레드 · 코치)을 그대로 줄여 레드 팀이 화면 밖으로 밀리고 챔피언이 한 줄에 2개만 보였다 */
@media (max-width: 760px) {
  .d2, .d2:not(.d3):not(.l4) { display: block; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
  .d2-main, .t3-main, .l4-main { min-height: auto; } .d2-main > *, .t3-main > *, .l4-main > * { min-height: auto; }
  .d3:not(.l4) { grid-template-rows: auto auto auto; } .l4 { grid-template-rows: auto auto; }
  .d2-top { padding: 6px 44px 6px 8px; min-height: 56px; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .d2-tm { gap: 4px; } .d2-tm b, .d2-tm small { display: none; } .d2-tm .team-logo img, .d2-tm .team-badge { width: 28px; height: 28px; }
  .d2-sc { font-size: 20px; margin: 0 2px; }
  .d2-mid { padding: 0 4px; min-width: 0; } .d2-ev { font-size: 10.5px; }
  .d2-ph { font-size: 13px; gap: 6px; flex-wrap: wrap; } .d2-ph b { font-size: 11.5px; padding: 0 6px; }
  .d2 .dr-timer { font-size: 18px; min-width: 26px; }
  .d2-steps i { width: 7px; } .d2-exit { right: 6px; width: 28px; height: 28px; }
  .d2-bans { padding: 6px 8px; gap: 4px; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .d2-bside { gap: 3px; } .d2-ban { width: 26px; height: 26px; border-radius: 5px; } .d2-ban.gap { margin-right: 4px; } .d2-bside.r .d2-ban.gap { margin-left: 4px; }
  .d2-lock { padding: 0 4px; font-size: 10px; } .d2-lock b { font-size: 13px; }
  /* 본문: 블루 | 레드를 위에 나란히, 챔피언 목록 · 코치 노트는 아래 전체 폭 */
  .d2-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-rows: auto; }
  .d2-team { padding: 8px; gap: 5px; border-right: 0; border-bottom: 1px solid var(--line); }
  .d2-team.b { grid-column: 1; grid-row: 1; border-right: 1px solid var(--line); } .d2-team.r { grid-column: 2; grid-row: 1; }
  .d2-team h4 { font-size: 12px; }
  .d2-slot { flex: none; min-height: 44px; max-height: 48px; height: 46px; } .d2-in { padding: 4px 8px; } .d2-pl { font-size: 11.5px; } .d2-ch { font-size: 13.5px; } .d2-slot.empty .d2-ch { font-size: 11.5px; }
  .d2-m { top: 3px; right: 5px; font-size: 9.5px; padding: 0 5px; }
  .d2-pool { grid-column: 1 / -1; grid-row: 2; padding: 8px; border-right: 0; min-height: 0 !important; }
  .d2-tabs button { padding: 4px 9px; font-size: 11.5px; } .d2-q { min-width: 0; padding: 6px 9px; } .d2-sort { padding: 6px 7px; font-size: 12px; }
  .d2-legend, .d2-hint { display: none; }
  .d2-grid { flex: none; max-height: 48vh; min-height: 0; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 5px; }
  .d2-c span { opacity: 1; font-size: 9px; padding-top: 6px; }
  .d2-card { height: auto; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .d2-card .d2-cart { display: block; min-height: 76px; } .d2-card .d2-cart b { font-size: 17px; } .d2-card .d2-col { display: none; }
  .d2-go { border-left: 0; padding: 8px; } .d2-go .btn-primary { padding: 11px 8px; }
  /* 고른 챔피언 + 확정 버튼은 화면 아래에 붙여 둔다 (0.4.3: 폰에서 확정 버튼이 화면 밖 아래에 있어, 30초 안에 챔피언을 고르고 스크롤해서 찾아 눌러야 했다) */
  .d2-card { position: sticky; bottom: 0; z-index: 6; background: var(--panel, #111a2c); box-shadow: 0 -8px 18px rgba(0, 0, 0, .45); }
  .d2-card .d2-cart { min-height: 58px; } .d2-go small { display: none; }
  .d2-grid { max-height: 40vh; }
  .d2-coach { grid-column: 1 / -1; grid-row: 3; max-height: none; border-top: 1px solid var(--line); }
  .d2-reveal.two { grid-auto-flow: row; } .d2-reveal.two .d2-rv { width: 86vw; }
  .d2-done { padding: 0 12px; gap: 12px; overflow-y: auto; } .d2-dn-h b { font-size: 26px; }
  .d2-dn-row { grid-template-columns: 1fr; gap: 6px; } .d2-dn-tm { flex-direction: row; justify-content: center; } .d2-dn-tm .team-logo img, .d2-dn-tm .team-badge { width: 30px; height: 30px; }
  .d2-dn-cards { gap: 4px; } .d2-dn-c { height: 90px; min-height: 0; padding: 5px; } .d2-dn-c b { font-size: 12px; } .d2-dn-c span { font-size: 10px; }
  /* 전술 · 라커룸: 한 열로 */
  .d3 { grid-template-rows: auto auto auto; } .t3-main { grid-template-columns: minmax(0, 1fr); } .t3-left { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; } .t3-left h4 { width: 100%; }
  .t3-pc { flex: 1 1 30%; min-height: 54px; max-height: 70px; padding: 6px 8px; } .t3-pc b { font-size: 14px; }
  .t3-center { padding: 10px; border-right: 0; } .t3-row2 { grid-template-columns: minmax(0, 1fr); gap: 12px; } .t3-wins { grid-template-columns: minmax(0, 1fr); }
  .t3-detail .dr-ins { grid-template-columns: minmax(0, 1fr); } .t3-detail .dr-rt-row { grid-template-columns: 1fr !important; }
  .t3-foot { padding: 8px 10px; padding-right: 10px; flex-wrap: wrap; } .t3-foot .cr-dim { width: 100%; }
  .l4 { overflow-y: auto; grid-template-rows: auto auto; } .l4-main { grid-template-columns: minmax(0, 1fr); } .l4-left { border-right: 0; } .l4-mid { min-height: 420px; }
}
/* 아주 작은 폰 (iPhone SE 등): 밴픽 상단 점수 · 단계 · 타이머가 겹치지 않게 (0.4.3) */
@media (max-width: 360px) {
  .d2-top { padding-right: 38px; }
  .d2-sc { font-size: 16px; margin: 0; }
  .d2-ph { font-size: 11.5px; } .d2-ph b { display: none; }
  .d2 .dr-timer { font-size: 15px; }
}
/* 폰: 아래 고지 문구가 34px 띠를 넘쳐 화면 아래(확정 버튼 · 일시정지 등)를 덮었다 (0.4.3) */
@media (max-width: 760px) {
  :root { --footer-h: 28px; }
  .legal { font-size: 8px; line-height: 1.15; padding: 0 8px; overflow: hidden; }
  /* 경기 화면 위: 팀 이름이 세로로 깨져 세트 점수와 겹치던 문제 */
  .lv-tm b { font-size: 14px !important; white-space: nowrap; }
  .lv-tm .lv-pips { display: none; }
  .lv-ms { min-width: 22px; height: 26px; font-size: 17px !important; }
}
@media (max-width: 360px) {
  .lv-tm b { font-size: 11.5px !important; }
  .lv-sc .lv-gd, .lv-sc .lv-tw { display: none; }
}
@media (max-width: 760px) { .seg { flex-wrap: wrap; max-width: 100%; } }   /* 전술 회의의 선택 버튼이 작은 폰에서 화면 밖으로 나가던 문제 (0.4.3) */
@media (max-width: 400px) {
  .dr-ins-row { flex-wrap: wrap; gap: 4px; } .dr-ins-row > span { width: 100%; }
  .dr-ins-row .seg { min-width: 0; flex-basis: 100%; } .dr-ins-row .seg button { min-width: 0; white-space: normal; }
}
/* 작은 폰: 시작 고지 화면의 '눌러서 계속' 안내가 화면 아래로 잘리던 문제 (0.4.3) */
@media (max-width: 400px) and (max-height: 700px) {
  #screen-intro { overflow-y: auto; }
  .intro-head { font-size: 24px; } .intro-lines li { font-size: 13px; line-height: 1.55; } .intro-en { font-size: 10px; }
}
