/* mobile-cherrypick.css — cherrypick.html(체리피킹) 모바일(≤640px) 전용 화면. */
@media (max-width: 640px) {
  .page-wrap { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)) !important; }
  .back { font-size: 14px; padding: 6px 0; margin-bottom: 8px; }
  h1 { font-size: 22px; }
  .cp-h1-row { gap: 8px; }
  .cp-info-btn { font-size: 12px; padding: 7px 12px; min-height: 34px; }
  /* 말풍선: 숨겨져 있어도 자리를 차지해 오른쪽으로 넘치던 것 — 제목 줄 폭에 맞춘다 */
  .cp-h1-row { position: relative; }
  .cp-info-wrap { position: static !important; }
  .cp-info-tip { left: 0 !important; right: 0 !important; width: auto !important; max-width: none !important; }
  .cp-info-tip p { font-size: 13px !important; }
  .page-sub { font-size: 12px; margin-bottom: 12px; }

  .cross-link-banner { padding: 12px 14px !important; margin-bottom: 14px !important; }
  .ccl-title { font-size: 14px !important; }
  .ccl-sub { font-size: 12px !important; }

  /* 카드 넘김 */
  .cp-slider-btn { width: 40px; height: 40px; }
  .cp-slider-title { font-size: 14px; }
  .cp-slider-dots { margin-bottom: 10px; }
  .cp-slider-dot { width: 10px; height: 10px; }
  .cp-slider-dot-active { width: 26px; }
  /* 카드 6장이 가장 긴 카드 높이로 늘어나던 것: 각자 제 높이만큼 */
  .cp-slider { gap: 12px; margin-bottom: 12px; align-items: flex-start; }
  /* 전형 305개·결격 291개처럼 긴 목록은 카드 안에서 스크롤 */
  #matrixWrap, #blockerWrap, #altList, #tamguSimWrap { max-height: 70vh; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: 2px; }
  .cp-card { padding: 14px !important; border-radius: 16px; }
  .cp-card h2 { font-size: 16px; margin-bottom: 10px; }
  .cp-sub-note { font-size: 12px; line-height: 1.5; }

  /* 등급 입력: 2열, 손가락 크기 */
  .cp-grid-3 { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .cp-grid-3 > .cp-field:nth-child(9) { display: none; }   /* 「↓ 탐구는 두 과목 평균」 빈 칸 — 2열에서는 자리만 차지 */
  .cp-field label { font-size: 12px; }
  .cp-field input, .cp-field select { font-size: 16px !important; min-height: 44px; padding: 8px 10px !important; }
  /* 줄 짝: 국어 / 수학 등급|수학 선택 / 영어|한국사 / 제2외국어 / 탐구1 과목|등급 / 탐구2 과목|등급 / 내신 */
  .cp-grid-3 > .cp-field:nth-child(1), .cp-grid-3 > .cp-field:nth-child(6), .cp-grid-3 > .cp-field:last-child { grid-column: 1 / -1; }
  /* 내 정보(거주지·성별·졸업): 구분선 아래 2열 — 시·도 | 시·군·구, 성별 | 졸업 유형, 학교장 추천은 전체 */
  .cp-profile-row { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; align-items: end; margin-top: 16px !important; padding-top: 14px; border-top: 1px dashed var(--main-border, #ffd0df); }
  .cp-profile-row .cp-field { min-width: 0 !important; }
  .cp-profile-row > .cp-qual-chip { grid-column: 1 / -1; min-width: 0 !important; justify-content: center; }
  .cp-profile-row > .cp-field:nth-child(3), .cp-profile-row > .cp-field:nth-child(4) { grid-column: 1 / -1; }   /* 성별·졸업 유형은 한 줄씩 (졸업 유형 글이 길다) */
  .cp-gender-btn { font-size: 14px !important; padding: 11px 4px !important; }
  /* 체크칩이 홀수라 마지막 하나가 남으면 한 줄 전체 */
  .cp-quals-grid > .cp-qual-chip:nth-child(odd):last-of-type { grid-column: 1 / -1; }
  /* 「기회균형 특별자격 …」「특별 트랙 …」 안내 줄을 구역 제목으로 */
  .cp-card > div[style*="font-size:11.5px"] { font-size: 13.5px !important; font-weight: 900 !important; color: #5f5357 !important; margin-top: 18px !important; padding-top: 14px; border-top: 1px dashed var(--main-border, #ffd0df); line-height: 1.5; }
  /* 체크칩 격자 끝에 끼어 있던 「다시 계산」 버튼은 한 줄 전체 */
  .cp-quals-grid > .cp-btn { grid-column: 1 / -1; min-height: 46px; font-size: 15px; margin-top: 6px; border-radius: 12px; }
  .cp-gender-btn { font-size: 14px; padding: 11px 4px; }
  .cp-quals-grid { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .cp-qual-chip { padding: 10px 10px !important; font-size: 13px; min-height: 44px; }
  .cp-qual-chip input { width: 18px; height: 18px; }

  /* 카드 3·4·6 의 필터 줄(인라인 flex): 검색칸 한 줄, 나머지는 2열 격자 */
  .cp-card > div[style*="flex-wrap:wrap"] { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; margin-bottom: 12px !important; }
  .cp-card > div[style*="flex-wrap:wrap"] > input { grid-column: 1 / -1; min-width: 0 !important; }   /* 검색칸은 한 줄 전체 */
  .cp-card > div[style*="flex-wrap:wrap"] > label:last-child { grid-column: 1 / -1; }          /* 홀수로 남는 마지막 칸도 전체 */
  .cp-card > div[style*="flex-wrap:wrap"] > input, .cp-card > div[style*="flex-wrap:wrap"] > select {
    width: 100%; min-height: 44px; font-size: 15px !important; padding: 8px 10px !important; border-radius: 10px !important;
  }
  .cp-card > div[style*="flex-wrap:wrap"] > label {
    min-height: 44px; display: flex !important; align-items: center; justify-content: center; gap: 8px !important;
    padding: 0 10px; border: 1.5px solid #dfe4ea; border-radius: 10px; font-size: 14px !important; background: #fff;
  }
  .cp-card > div[style*="flex-wrap:wrap"] > label input { width: 18px; height: 18px; }
  .cp-card > div[style*="flex-wrap:wrap"] > .cp-sub-note { grid-column: 1 / -1; }

  /* 추천 카드: 학교 이름 줄 따로, 모집·참고용 배지는 그 아래 줄 */
  .cp-reco-head { flex-wrap: wrap !important; gap: 6px 8px !important; align-items: center !important; }
  .cp-reco-school { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; line-height: 1.3; }
  .cp-reco-school .cp-reco-type { margin-left: 0 !important; flex: 1 1 100%; }
  .cp-reco-trust { font-size: 12px !important; }
  .cp-reco-card { padding: 12px !important; }
  .cp-reco-school { font-size: 15px !important; }
  .cp-reco-school .cp-reco-type { font-size: 12px !important; }
  .cp-reco-quota { font-size: 12px !important; }
  .cp-reco-subtitle { font-size: 13px !important; }
  .cp-check-ok, .cp-check-no, .cp-check-na, .cp-check-warn { font-size: 12px !important; padding: 4px 9px !important; }
  .cp-reco-meta { font-size: 13px !important; }
  .cp-reco-rank, .cp-reco-tier { font-size: 11.5px !important; }
  .cp-eq-chip { font-size: 12px !important; }
  .cp-reco-reason { font-size: 13px !important; }
  .cp-reco-skipped { font-size: 12.5px !important; }
  .cp-skipped-item { font-size: 12px !important; }

  /* 학교별 전형 상세 */
  /* 학교별 전형 상세: 학교 머리는 목록 안에서 위에 붙고, 전형 줄은 이름 한 줄 + 판정 칩 한 줄 */
  .cp-school-block { margin-bottom: 12px !important; }
  .cp-school-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px !important; padding: 10px 12px !important; border-radius: 10px !important; }
  .cp-school-meta { font-size: 12px !important; white-space: nowrap; }
  .cp-tx-list { gap: 8px !important; }
  .cp-tx-row { padding: 12px !important; border-radius: 12px !important; border-color: #f0e3e7 !important; }
  .cp-tx-head { flex-direction: column !important; align-items: flex-start !important; gap: 8px !important; }
  .cp-tx-name { font-size: 14.5px !important; line-height: 1.35; }
  .cp-tx-status { gap: 6px !important; flex-wrap: wrap; }
  .cp-tx-status > span { font-size: 12.5px !important; padding: 5px 10px !important; border-radius: 7px !important; }
  .cp-tx-detail { font-size: 13px !important; line-height: 1.65 !important; padding: 12px !important; margin-top: 10px !important; }
  #mxCount, #bkCount, #altCount { font-size: 13px !important; font-weight: 800 !important; color: #5f5357 !important; margin: 0 0 8px !important; }

  /* 결격·미판정, 시뮬레이션, 대체 방안 */
  /* 결격/미판정: 학교 이름 한 줄, 전형은 그 아래, 사유는 넉넉한 목록 */
  .cp-blocker-card { padding: 12px 14px !important; margin-bottom: 10px !important; border: 1px solid #f0e3e7 !important; border-left: 4px solid var(--main, #ff8fa3) !important; border-radius: 12px !important; }
  .cp-blocker-school { font-size: 15px !important; line-height: 1.3; margin-bottom: 8px !important; }
  .cp-blocker-type { display: block; margin: 3px 0 0 !important; font-size: 12.5px !important; font-weight: 800 !important; color: var(--main-strong, #c0404e) !important; }
  .cp-blocker-reasons { font-size: 13.5px !important; line-height: 1.55 !important; padding-left: 18px !important; margin: 0 !important; }
  .cp-blocker-reasons li { margin-bottom: 5px !important; }
  .cp-blocker-reasons li:last-child { margin-bottom: 0 !important; }
  /* 결격 목록(폰): 학교 머리 + 전형 줄(사유 종류 태그 → 사유) */
  .cp-bk-school { margin-bottom: 12px; }
  .cp-bk-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--main-light, #fff0f3); color: var(--main-strong, #c0404e); font-size: 15px; font-weight: 900; }
  .cp-bk-cnt { font-size: 12px; font-weight: 800; color: #8a7f83; white-space: nowrap; }
  .cp-bk-row { margin-top: 8px; padding: 11px 12px; border: 1px solid #f0e3e7; border-radius: 12px; background: #fff; }
  .cp-bk-type { font-size: 14.5px; font-weight: 900; color: #37352f; line-height: 1.35; }
  .cp-bk-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 8px; }
  .cp-bk-tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 900; background: #f0f0f3; color: #666; }
  .cp-bk-tag-최저 { background: #ffeef0; color: #c0404e; }
  .cp-bk-tag-내신 { background: #fff4e0; color: #a06000; }
  .cp-bk-tag-탐구 { background: #e3f2fd; color: #1565c0; }
  .cp-bk-tag-응시 { background: #e3f2fd; color: #1565c0; }
  .cp-bk-tag-자격 { background: #f0f0f3; color: #555; }
  .cp-bk-tag-지역 { background: #e8f5e9; color: #2e7d32; }
  .cp-bk-tag-확인 { background: #fffbe6; color: #a07000; }
  .cp-bk-row .cp-blocker-reasons { font-size: 13.5px !important; line-height: 1.55 !important; padding-left: 18px !important; margin: 0 !important; color: #444 !important; }
  .cp-bk-row .cp-blocker-reasons li { margin-bottom: 4px !important; }
  .cp-empty-msg, .cp-empty { font-size: 13px; }
  #matrixWrap, #altList, #altSummary { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* 탐구 조합(폰): 전형 덩어리 → 시나리오 다섯 줄 */
  .cp-ts-block { border: 1px solid #f0e3e7; border-radius: 12px; overflow: hidden; margin-bottom: 10px; background: #fff; }
  .cp-ts-head { padding: 10px 12px; background: var(--main-light, #fff0f3); color: var(--main-strong, #c0404e); font-size: 14.5px; font-weight: 900; line-height: 1.35; }
  .cp-ts-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px; border-top: 1px solid #f6eef1; }
  .cp-ts-name { flex: 1 1 0; min-width: 0; font-size: 13.5px; font-weight: 800; color: #37352f; line-height: 1.35; }
  .cp-ts-icon { margin-right: 6px; }
  .cp-ts-res { flex: none; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 900; }
  .cp-ts-ok { background: #e8f5e9; color: #2e7d32; }
  .cp-ts-no { background: #ffeef0; color: #c0404e; }
  .cp-ts-na { background: #f0f0f3; color: #999; }
  .cp-ts-why { flex: 1 1 100%; font-size: 12px; color: #8a7f83; line-height: 1.45; padding-left: 26px; }
  /* 탐구 조합 표(6열, 넓은 화면용): 첫 열 고정, 나머지는 옆으로 넘기고 머리글은 한 줄 */
  #tamguSimWrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #tamguSimWrap .cp-table { min-width: 620px; }
  #tamguSimWrap .cp-table th { font-size: 11.5px !important; white-space: nowrap !important; padding: 9px 8px !important; text-align: center; }
  #tamguSimWrap .cp-table td { text-align: center; font-size: 16px !important; padding: 9px 8px !important; }
  #tamguSimWrap .cp-table th:first-child, #tamguSimWrap .cp-table td:first-child { position: sticky; left: 0; background: #fff; text-align: left; font-size: 13px !important; z-index: 1; box-shadow: 2px 0 0 #f5f5f5; }
  #tamguSimWrap .cp-table thead th:first-child { background: var(--main-light, #fff0f3); }
  .cp-table { font-size: 12.5px !important; }
  .cp-table thead th, .cp-table tbody td { padding: 8px 6px !important; }
  .cp-note { font-size: 12.5px; }
}
