/* ══════════════════════════════════════════════════════
   responsive-mobile.css
   모바일 반응형 — iOS / Android
   대상: max-width 767px 이하 전체 모바일 디바이스
   ══════════════════════════════════════════════════════
   Breakpoints:
     기본 모바일       : ~480px  (Galaxy S, iPhone 표준)
     아이폰 Pro Max    : 430px   (iPhone 15 Pro Max)
     아이폰 표준       : 390px   (iPhone 14/15)
     아이폰 mini / SE  : 375px
     갤럭시 S 소형     : 360px
     초소형            : ~320px
   ══════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────
   1. 전체 모바일 공통 (767px 이하)
   ────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* 레이아웃 */
  .app-wrap { max-width: 100vw; }
  .app-header { padding: 14px 16px 10px; }
  .view { padding: 12px 14px 80px; }

  /* 섹션 */
  .section-title { font-size: 20px; }
  .create-hero-title { font-size: 24px; }
  .create-hero-sub { font-size: 13px; }

  /* 프롬프트 카드 */
  .prompt-card { padding: 14px 12px; }
  .genre-btn-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .genre-btn { padding: 8px 4px 6px; font-size: 10px; }
  .genre-ico { font-size: 18px !important; }
  .mood-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .mood-chip { padding: 6px 3px; font-size: 9px; }
  .mood-ico { font-size: 15px !important; }
  .sub-genre-row { gap: 4px; }
  .sub-genre-btn { font-size: 10px; padding: 4px 8px; }
  .form-input { font-size: 16px; padding: 10px; } /* iOS 줌 방지 */
  .lyrics-btn-row { flex-wrap: wrap; gap: 4px; }
  .ai-assist-btn { font-size: 11px; padding: 5px 8px; }

  /* 옵션 행 */
  .options-row { flex-direction: column; gap: 8px; }
  .opt-group { width: 100%; }
  .opt-select { width: 100%; }

  /* 고급 설정 */
  .adv-grid { grid-template-columns: 1fr !important; }
  .adv-instrument-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .adv-inst-btn { font-size: 10px; padding: 6px 2px; }
  .slider-group { min-width: 0; }
  .duration-btns { flex-wrap: wrap; gap: 4px; }
  .dbtn { padding: 6px 10px; font-size: 11px; }

  /* 생성 버튼 */
  .gen-btn { padding: 14px; font-size: 14px; }

  /* 결과 카드 */
  .result-card { padding: 0; }
  .rc-cover { height: 160px; }
  .rc-actions { flex-wrap: wrap; gap: 6px; }

  /* 미니플레이어 */
  #mini-player .mp-body { padding: 6px 10px; }
  .mp-title { font-size: 13px; }

  /* 풀플레이어 */
  .fp-inner { padding: 0 12px; }
  .fp-title { font-size: 20px; }
  .fp-controls { gap: 28px; }
  .fp-play-btn { width: 56px; height: 56px; }
  .fp-play-btn svg { width: 36px; height: 36px; }
  .fp-ctrl-btn svg { width: 24px; height: 24px; }
  .fp-side-actions { gap: 5px; padding-top: 40px; max-height: calc(100vh - 180px); }
  .fp-side-btn { width: 32px; height: 32px; font-size: 13px; }
  .fp-side-btn svg { width: 16px; height: 16px; }
  .fp-lyrics-main { padding: 12px 16px 20px; }
  .fp-lyrics-main .fp-lm-line { font-size: 14px; }
  .fp-lyrics-main .fp-lm-line.active { font-size: 20px; }

  /* 히스토리 */
  .hist-tabs { gap: 6px; }
  .hist-tab { padding: 6px 14px; font-size: 11.5px; }
  .hist-card { padding: 6px 2px; }
  .hist-thumb { width: 44px; height: 44px; }

  /* 커뮤니티 */
  .comm-featured-cover { height: 180px; }
  .comm-featured-title { font-size: 17px; }
  .comm-featured-actions { gap: 5px; flex-wrap: wrap; }
  .comm-reaction-btn { padding: 5px 10px; font-size: 11px; }
  .comm-list-item { gap: 4px; padding: 10px 8px; }
  .comm-list-img { width: 40px; height: 40px; }
  .comm-list-title { font-size: 12px; }
  .comm-list-actions { gap: 4px; }
  .comm-reaction-sm { padding: 4px 7px; font-size: 12px; }
  .comm-list-actions .star-rating-sm .star { font-size: 11px; padding: 0; }

  /* 댓글 */
  .comment-sheet { max-height: 85vh; border-radius: 12px 12px 0 0; }
  .comment-list { padding: 8px 10px; }
  .comment-reply { margin-left: 28px; }
  .comment-avatar, .comment-avatar-ph { width: 24px; height: 24px; font-size: 11px; }
  .comment-text { font-size: 12px; }
  .comment-input-wrap { padding: 8px 10px 20px; }
  .comment-input { font-size: 12px; padding: 7px 12px; }

  /* 공유 시트 */
  .comm-share-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .comm-share-icon { font-size: 20px; }
  .comm-share-label { font-size: 9px; }

  /* 바텀 네비 */
  .bottom-nav { padding: 6px 0 env(safe-area-inset-bottom, 4px); }
  .bnav-label { font-size: 9px; }
  .bnav-svg { width: 20px; height: 20px; }

  /* 모드 탭 */
  .mtab { font-size: 12px; padding: 7px 10px; }

  /* 로딩 카드 */
  .loading-card.on { padding: 20px 14px; }

  /* 설정 */
  .settings-banner { padding: 14px; }

  /* MV */
  .mv-gen-hero { padding: 10px 0 14px; }
  .mv-gen-title { font-size: 16px; }

  /* YouTube */
  .yt-input-row { flex-direction: column; gap: 6px; }
  .yt-input-row input, .yt-input-row button { width: 100%; }

  /* 히스토리 그리드 모드 */
  .hist-view-grid.grid-mode { grid-template-columns: repeat(2, 1fr) !important; }

  /* AI 시트 */
  .ai-sheet-box { max-height: 85vh; }
}

/* ──────────────────────────────────────────────────────
   2. 표준 모바일 (480px 이하) — 아이폰 노치/다이나믹 아일랜드
   ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .app-wrap { max-width: 100vw; }
  .app-header { padding: 14px 12px 10px; }
  .view { padding: 12px 10px 80px; }

  /* 풀플레이어 — 노치/다이나믹 아일랜드 대응 */
  .fp-header {
    padding-top: max(env(safe-area-inset-top, 44px), 44px);
    padding-bottom: 6px;
  }
  .fp-bottom { padding-bottom: max(env(safe-area-inset-bottom, 20px), 20px); }
  .fp-layout { padding: 0 16px !important; }
  .fp-layout, .fp-center, .fp-info, .fp-info-row,
  .fp-lyrics-main, .fp-lyrics-header-bar, .fp-more-menu {
    text-align: left !important;
    align-items: stretch !important;
  }
  .fp-info { padding: 0 !important; }
  .fp-title {
    font-size: 20px;
    white-space: normal;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left !important;
  }
  .fp-lyrics-main { padding: 8px 0 40px !important; text-align: left !important; }
  .fp-controls { gap: 22px; }

  /* 모달/시트 폭 — 전체 너비 */
  .rv-popup  { max-width: calc(100vw - 24px); }
  .rv-sheet  { max-width: calc(100vw - 16px); }
  .rv-wide   { max-width: calc(100vw - 16px); }
}

/* ──────────────────────────────────────────────────────
   3. 아이폰 Pro Max / 대형 폰 (410px ~ 480px, 높이 800px+)
   ────────────────────────────────────────────────────── */
@media (min-width: 410px) and (max-width: 480px) and (min-height: 800px) {
  .fp-lyrics-main { max-height: 45vh; }
  .fp-title { font-size: 22px; }
  .fp-play-btn { width: 68px; height: 68px; }
  .fp-controls { gap: 28px; }
}

/* ──────────────────────────────────────────────────────
   4. 아이폰 mini / SE (375px 이하)
   ────────────────────────────────────────────────────── */
@media (max-width: 375px) {
  .fp-header { padding-left: 12px !important; padding-right: 12px !important; }
  .fp-bottom {
    padding: 0 12px !important;
    padding-bottom: max(env(safe-area-inset-bottom, 16px), 16px) !important;
  }
  .fp-title { font-size: 18px !important; }
  .fp-play-btn { width: 56px !important; height: 56px !important; }
  .fp-controls { gap: 18px !important; margin-bottom: 10px !important; }
  .fp-prog-section { margin-top: 12px !important; }
  .fp-layout { padding: 0 12px !important; }
  .fp-lyrics-main { max-height: 35vh !important; padding: 8px 0 !important; }
  .fp-lyrics-main .fp-lm-line { font-size: 13px !important; padding: 5px 0 !important; }
  .fp-lyrics-main .fp-lm-line.active { font-size: 18px !important; }

  /* 섹션 타이틀 축소 */
  .section-title { font-size: 18px; }
  .create-hero-title { font-size: 22px; }
  .logo { font-size: 16px; }
}

/* ──────────────────────────────────────────────────────
   5. 갤럭시 S 소형 / 초소형 Android (360px 이하)
   ────────────────────────────────────────────────────── */
@media (max-width: 360px) {
  .genre-btn-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .genre-btn { font-size: 9px; padding: 6px 2px; }
  .genre-ico { font-size: 16px !important; }
  .genre-grid { grid-template-columns: repeat(3, 1fr); }
  .mood-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .mood-chip { font-size: 8px; padding: 5px 2px; }
  .adv-instrument-grid { grid-template-columns: repeat(3, 1fr); }
  .comm-featured-cover { height: 150px; }
  .comm-list-actions { gap: 3px; }
  .comm-reaction-sm { padding: 3px 5px; font-size: 11px; }
  .comm-list-actions .star-rating-sm .star { font-size: 10px; }
  .hist-view-grid.grid-mode { gap: 6px; }
  .hist-view-grid.grid-mode .hist-info { padding: 8px 10px; }
  .hist-view-grid.grid-mode .hist-play-icon { width: 36px; height: 36px; font-size: 14px; }

  /* 폰트 축소 */
  .section-title { font-size: 17px; }
  .create-hero-title { font-size: 20px; }
  .app-header { padding: 12px 10px 8px; }
  .view { padding: 10px 8px 80px; }
}

/* ──────────────────────────────────────────────────────
   6. 짧은 화면 높이 (iPhone SE 등 700px 이하)
   ────────────────────────────────────────────────────── */
@media (max-height: 700px) {
  .fp-layout, .fp-center, .fp-info, .fp-info-row,
  .fp-lyrics-main {
    text-align: left !important;
    align-items: stretch !important;
  }
  .fp-side-actions { padding-top: 20px !important; gap: 4px !important; max-height: calc(100vh - 150px) !important; }
  .fp-side-btn { width: 30px !important; height: 30px !important; }
  .fp-side-btn svg { width: 15px !important; height: 15px !important; }
  .fp-header {
    padding-top: max(env(safe-area-inset-top, 12px), 12px) !important;
    padding-bottom: 4px !important;
  }
  .fp-title { font-size: 17px !important; text-align: left !important; }
  .fp-tags { font-size: 10px !important; margin-top: 3px !important; }
  .fp-prog-section { margin-top: 10px !important; margin-bottom: 10px !important; }
  .fp-controls { gap: 20px !important; margin-bottom: 8px !important; }
  .fp-play-btn { width: 52px !important; height: 52px !important; }
  .fp-play-btn svg { width: 32px !important; height: 32px !important; }
  .fp-ctrl-btn { width: 38px !important; height: 38px !important; }
  .fp-bottom { padding: 0 16px !important; padding-bottom: env(safe-area-inset-bottom, 8px) !important; }
  .fp-lyrics-main { max-height: 30vh !important; }
  .fp-lyrics-main .fp-lm-line { font-size: 13px !important; }
  .fp-lyrics-main .fp-lm-line.active { font-size: 17px !important; }
  .ai-sheet-box { max-height: 65vh; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}

/* ──────────────────────────────────────────────────────
   7. iOS Safe Area (노치 / 홈 인디케이터)
   ────────────────────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
  .comment-input-wrap { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .fp-bottom { padding-bottom: max(env(safe-area-inset-bottom, 16px), 16px); }
}

/* ──────────────────────────────────────────────────────
   8. 터치 디바이스 — hover 효과 비활성화
   ────────────────────────────────────────────────────── */
@media (hover: none) {
  .comm-list-item:hover { background: transparent; }
  .genre-btn:hover { transform: none; }
  .gen-btn:hover { transform: none; box-shadow: none; }
  .hist-card:hover { background: transparent; }
  .attend-banner:hover { transform: none; border-color: inherit; }
  .spotlight-card:active { transform: scale(.96); }
  .mood-card:active { transform: scale(.96); }
}
