/* 폰 화면 보강 (메타 클리너 모바일 UX) — mobileux.js와 짝
   app.*.js·style.*.css는 빌드된 파일이라 직접 고치지 않고 여기서 덮어쓴다 (a11y.css와 같은 방식). 데스크톱(901px~)은 그대로. */

/* 1) 버전 알림(개발 노트)·테마 버튼: 화면에 고정하지 않고 맨 위 띠(body 위 여백 36px)에 둠 → 스크롤하면 같이 올라가서 내용을 가리지 않음 */
@media (max-width: 900px) {
  .nt-pill, .nt-pill.away {
    position: absolute; z-index: 5;
    top: calc(env(safe-area-inset-top, 0px) + 11px);
    left: 16px; right: auto; transform: none;
    max-width: calc(100vw - 16px - 36px - 16px - 14px);
    opacity: 1; pointer-events: auto;
  }
  .theme-toggle {
    position: absolute; z-index: 5;
    top: calc(env(safe-area-inset-top, 0px) + 6px); right: 16px;
    width: 36px; height: 36px; font-size: 16px;
  }
  /* 열린 패널도 같이 스크롤 (닫기·바깥 누르기 동작은 앱 그대로) */
  .nt-panel {
    position: absolute; z-index: 6;
    top: calc(env(safe-area-inset-top, 0px) + 44px);
    left: 16px; right: auto;
    width: min(calc(100vw - 32px), 380px);
    max-height: none;
    transform: translateY(-8px);
  }
  .nt-panel.on { transform: none; }
}
@media (min-width: 641px) and (max-width: 900px) {
  /* 가로 폰·작은 태블릿: 폰 세로 화면처럼 맨 위 띠를 만들어 둠 (원래는 고정 알림이 내용 위에 얹혔음) */
  body { padding-top: calc(env(safe-area-inset-top, 0px) + 44px); }
}
@media (min-width: 561px) and (max-width: 900px) {
  .nt-pill, .nt-pill.away { left: 24px; }
  .theme-toggle { right: 24px; }
  .nt-panel { left: 24px; }
}

/* 2) 상단 도구 메뉴: 폰에서는 옆으로 밀지 않고 2×2로 모두 보이게 */
@media (max-width: 640px) {
  .sitenav .navtabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    overflow: visible; flex: 1 1 auto; width: 100%;
    -webkit-mask-image: none; mask-image: none;
  }
  .sitenav a {
    display: flex; align-items: center; justify-content: center; text-align: center;
    flex-wrap: wrap; gap: 0 3px; min-height: 42px; padding: 6px 6px;
    white-space: normal; line-height: 1.3; font-size: 14px;
  }
  .sitenav .beta { display: inline-block; margin-left: 0; }
}
@media (max-width: 380px) {
  .sitenav a { font-size: 13px; padding: 6px 4px; }
}

/* 3) 아래 기능 탭: 폰에서는 같은 너비의 2칸 격자 (가로로 넓은 561~900px은 3칸) */
@media (max-width: 900px) {
  nav.tabs {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; flex-wrap: nowrap;
    width: 100%; box-sizing: border-box; align-self: stretch;
  }
}
@media (max-width: 560px) {
  nav.tabs { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  nav.tabs .tab {
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0 4px;
    min-height: 48px; padding: 8px 6px; text-align: center; line-height: 1.3;
    white-space: normal; font-size: 14px; border: 1px solid transparent;
  }
  nav.tabs .tab .beta { margin-left: 0; }
}

/* 4) 결과: 작은 변화(5% 미만)는 성공 초록 대신 중립 색 */
.ux-soft, .pct.good.ux-soft, .summary em.ux-soft { color: var(--mute); }
.pct.ux-meta { font-size: 13px; font-weight: 700; }

/* 4) 결과: 파일이 하나뿐이면 ZIP은 숨기고, 그 파일의 「받기」를 크게 */
@media (max-width: 760px) {
  .panel.ux-single [data-summary] [data-zip] { display: none; }
  .panel.ux-single .file .dl { width: 100%; gap: 8px; }
  .panel.ux-single .file .dl a.btn {
    flex: 1 1 auto; justify-content: center; text-align: center; min-height: 46px;
    padding: 0 22px; font-size: 16px; font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    border: 0; color: var(--on-accent);
  }
}

/* 5) 이미지 압축 설정 카드: 들쭉날쭉하던 배치를 2열 격자로 정리
   (예전에는 줄바꿈 + 아래 정렬이라, 설명 글이 긴 항목 옆의 「움직이는 그림 가로」가 혼자 아래로 처져 보였음)
   첫 줄: 압축 강도 + 출력 형식 / (직접 설정이면 품질 + PNG 방식) / 마지막 줄: 움직이는 그림 가로 + 목표 용량 */
#panel-comp .controls {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px; align-items: start;
}
#panel-comp .controls .ctl, #panel-comp .controls .ctl.grow { min-width: 0; width: auto; }
#panel-comp .controls .ctl select { width: 100%; max-width: 100%; box-sizing: border-box; }
#panel-comp .controls .vrow select { flex: 1 1 auto; width: auto; min-width: 0; }
#panel-comp .controls .vrow .tgc { flex: 0 0 auto; }
#panel-comp .controls #preset { flex-wrap: nowrap; }
#panel-comp .controls #preset button { flex: 1 1 auto; min-height: 0; padding: 6px 8px; white-space: nowrap; }
@media (max-width: 760px) {
  #panel-comp .controls #preset button { min-height: 40px; }
}
@media (max-width: 560px) {
  #panel-comp .controls { grid-template-columns: minmax(0, 1fr); }
  #panel-comp .controls #preset { flex-wrap: wrap; }
  #panel-comp .controls #preset button { flex: 0 1 auto; white-space: normal; }
}
