/* ================================================================
   mobile.css — モバイル対応 (≤640px)
               ミニプレイヤー・ボトムナビ・NPOオーバーレイ
   ================================================================ */

.mini-player       { display: none; }
.bottom-nav        { display: none; }
.now-playing-overlay { display: none; }

@media (max-width: 640px) {

  /* ---- アプリ全体 ---- */
  .app {
    display: flex; flex-direction: column;
    height: 100dvh; overflow: hidden;
  }
  .sidebar { display: none !important; }

  /* ---- ヘッダー ---- */
  header { padding: 0 16px; height: var(--header-h); flex-shrink: 0; }
  .header-search { display: none; }
  .logo { font-size: 14px; letter-spacing: 2px; }
  .header-right { gap: 8px; }

  /* ---- メイン ---- */
  .main {
    flex: 1; overflow-y: auto; padding: 16px;
    padding-bottom: calc(var(--player-h) + var(--nav-h) + 16px);
  }
  .player-bar { display: none !important; }

  /* ---- ヒーロー ---- */
  .now-playing-hero { grid-template-columns: 1fr; gap: 20px; min-height: unset; margin-bottom: 28px; }
  .album-art { width: 100%; height: auto; aspect-ratio: 1; max-width: 260px; margin: 0 auto; }
  .song-title-hero  { font-size: 20px; }
  .song-artist-hero { font-size: 14px; }
  .lyrics-scroll-container { height: 160px; }
  .lyric-line        { font-size: 16px; }
  .lyric-line.active { font-size: 20px; }

  /* ---- アップロード ---- */
  .upload-area  { padding: 24px 16px; margin-bottom: 20px; }
  .upload-icon  { font-size: 32px; margin-bottom: 8px; }
  .upload-title { font-size: 13px; }
  .upload-desc  { font-size: 12px; }

  /* ---- カード ---- */
  .songs-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-art   { font-size: 36px; }
  .card-title { font-size: 12px; }

  /* ---- 歌詞フル ---- */
  .lyrics-full-title { font-size: 18px; }
  .lyrics-full-line  { font-size: 18px; padding-left: 14px; }
  .lyrics-full-line.active { font-size: 20px; }

  /* ---- ミニプレイヤー ---- */
  .mini-player {
    display: flex !important;
    position: fixed; bottom: var(--nav-h); left: 0; right: 0;
    height: var(--player-h);
    background: rgba(8,12,24,0.98); backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,212,255,0.15);
    align-items: center; padding: 0 16px; gap: 12px;
    z-index: 200; cursor: pointer;
  }
  .mini-player::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.5;
  }
  .mini-thumb {
    width: 46px; height: 46px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
  }
  .mini-info    { flex: 1; min-width: 0; }
  .mini-title   { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mini-artist  { font-size: 12px; color: var(--text-dim); }
  .mini-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--surface2); }
  .mini-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width 0.5s linear; }
  .mini-controls { display: flex; align-items: center; gap: 10px; }
  .mini-play-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none; color: #000; font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .mini-next-btn { background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; }

  /* ---- ボトムナビ ---- */
  .bottom-nav {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h);
    background: rgba(5,10,20,0.98); backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,212,255,0.1); z-index: 300;
  }
  .bottom-nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    cursor: pointer; color: var(--text-dim); transition: color 0.2s;
    font-size: 10px; font-family: 'Orbitron', monospace; letter-spacing: 1px;
  }
  .bn-icon { font-size: 20px; line-height: 1; opacity: 0.75; transition: opacity 0.2s; }
  .bottom-nav-item.active .bn-icon { opacity: 1; }
  .bottom-nav-item.active { color: var(--accent); }

  /* ---- NPOオーバーレイ ---- */
  .now-playing-overlay {
    position: fixed; inset: 0; background: var(--bg); z-index: 400;
    flex-direction: column; padding: 0; overflow: hidden;
  }
  .now-playing-overlay.open { display: flex !important; }

  .npo-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,212,255,0.1);
    flex-shrink: 0;
  }
  .npo-back     { background: none; border: none; color: var(--text-dim); font-size: 28px; cursor: pointer; line-height: 1; }
  .npo-label    { font-family: 'Orbitron', monospace; font-size: 10px; letter-spacing: 3px; color: var(--text-muted); }
  .npo-like-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
  .npo-like-btn.liked { color: #ff4d7d; }

  .npo-art {
    width: 200px; height: 200px; border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 72px; margin: 20px auto 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    flex-shrink: 0;
  }
  .npo-info   { text-align: center; padding: 0 24px; margin-bottom: 12px; flex-shrink: 0; }
  .npo-title  { font-family: 'Orbitron', monospace; font-size: 18px; font-weight: 700; margin-bottom: 4px; }
  .npo-artist { font-size: 13px; color: var(--text-dim); letter-spacing: 2px; }

  .npo-lyrics {
    flex: 1; overflow: hidden; padding: 0 24px; min-height: 0;
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
  }
  .npo-lyrics-inner { transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
  .npo-lyric-line {
    padding: 10px 0; font-size: 17px; font-weight: 600;
    color: var(--text-muted); text-align: center;
    transition: all 0.4s;
    font-family: 'Noto Sans JP', 'Rajdhani', sans-serif; line-height: 1.4;
  }
  .npo-lyric-line.active { color: var(--accent); font-size: 21px; text-shadow: 0 0 20px rgba(0,212,255,0.6); }
  .npo-lyric-line.past   { opacity: 0.4; }

  .npo-controls { padding: 12px 24px 20px; flex-shrink: 0; }
  .npo-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
  .npo-time     { font-family: 'Orbitron', monospace; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
  .npo-btns     { display: flex; align-items: center; justify-content: center; gap: 24px; }
  .npo-ctrl     { background: none; border: none; color: var(--text-dim); font-size: 24px; cursor: pointer; }
  .npo-play {
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none; color: #000; font-size: 24px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 30px rgba(0,212,255,0.5);
  }
  .npo-vol {
    display: flex; align-items: center; gap: 10px;
    margin-top: 16px; color: var(--text-dim); font-size: 16px;
  }
  .npo-vol input { flex: 1; }
}

/* ================================================================
   スマホ：検索バー表示
   ================================================================ */
@media (max-width: 640px) {
  .header-search  { display: none; }
  .mobile-search-bar { display: flex; align-items: center; }

  /* ソートボタンはヘッダーに残す（ドロップダウンは右端）*/
  .sort-dropdown-wrap { position: static; }
  .sort-menu {
    position: fixed;
    top: calc(var(--header-h) + 8px);
    right: 8px;
    left: 8px;
    min-width: unset;
  }

  /* キュービュー */
  .queue-item { padding: 10px 12px; }
  .queue-thumb { width: 38px; height: 38px; font-size: 18px; }
  .queue-title  { font-size: 13px; }
}

/* ================================================================
   スマホ：ボトムナビのアイテム数が増えたので小さく
   ================================================================ */
@media (max-width: 640px) {
  .bottom-nav-item {
    font-size: 9px;
    gap: 2px;
  }
  .bn-icon { font-size: 18px; }
}

/* mobile-search-bar を通常フローに */
@media (max-width: 640px) {
  .mobile-search-bar {
    position: relative;
    top: unset;
    left: unset;
    right: unset;
    z-index: 99;
    padding: 8px 12px;
  }
  /* メインコンテンツの余分なpadding-topを解除 */
  .main {
    padding-top: 16px !important;
  }
}
