/* ═══════════════════════════════════════════════════════════════
   SONAR · 移动端（≤ 820px）
   App 内永远是移动版式；浏览器里窄屏自动切换。
   ═══════════════════════════════════════════════════════════════ */

.tabbar { display: none; }

@media (max-width: 820px) {
  :root {
    --player-h: 64px;
    --topbar-h: 58px;
    --tabbar-h: 58px;
  }

  body { font-size: 14px; }

  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }

  .main { padding-bottom: calc(var(--player-h) + var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px); }

  .topbar {
    gap: 8px;
    padding: 0 14px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
  }
  .topbar__back { display: inline-flex; }
  .topbar__login { display: none; }
  .searchbox { height: 38px; }
  .searchbox__kbd { display: none; }
  .searchbox input { font-size: 14px; }

  .view { padding: 4px 14px 24px; }

  .page-head { margin: 8px 0 18px; flex-wrap: wrap; gap: 12px; }
  .page-head h1 { font-size: 25px; }
  .page-head p { font-size: 12.5px; }
  .page-head__actions { width: 100%; }

  .hero { padding: 20px 18px; border-radius: var(--r-l); margin-bottom: 24px; }
  .hero h1 { font-size: 26px; line-height: 1.16; margin: 6px 0 10px; }
  .hero__lead { font-size: 12.5px; line-height: 1.65; }
  .hero__actions { margin-top: 16px; gap: 8px; }
  .hero__actions .btn { height: 40px; padding: 0 16px; font-size: 13px; }
  .hero__stats { gap: 16px; margin-top: 16px; padding-top: 12px; }
  .hero__stat b { font-size: 17px; }
  .hero__stat span { font-size: 8.5px; letter-spacing: 0.08em; }
  .hero__rings { right: -180px; width: 380px; height: 380px; opacity: 0.4; }

  .section { margin-bottom: 30px; }
  .section__head { margin-bottom: 12px; align-items: center; }
  .section__head h2 { font-size: 17px; }
  .section__head p { display: none; }

  .card-grid { grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 14px 10px; }
  .card-row { grid-auto-columns: 138px; gap: 12px; }
  .album-card__body { padding-top: 8px; }
  .album-card__title { font-size: 12.5px; }
  .album-card__sub { font-size: 11.5px; }
  .album-card__play { opacity: 1; transform: none; width: 36px; height: 36px; right: 8px; bottom: 8px; }

  /* 曲目行：手机上收敛为「封面 + 歌名 + 时长/更多」 */
  .tracklist__head { display: none; }
  .track-row {
    grid-template-columns: 16px minmax(0, 1fr) auto 50px;
    gap: 6px;
    padding: 6px 2px;
    border-radius: 8px;
  }
  .track-row__album, .track-row__act .js-album, .track-row__act .js-drag { display: none; }
  .track-row__dur { font-size: 10.5px; }
  .track-row__act { opacity: 1; gap: 0; }
  .track-row__act .icon-btn { width: 24px; height: 24px; }
  .track-row__act .icon-btn svg { width: 14px; height: 14px; }
  .track-row__cover { width: 42px; height: 42px; }
  .track-row__title { font-size: 13.5px; }
  .track-row__artist { font-size: 11.5px; }
  .track-row__idx { font-size: 10px; }

  .detail-head { grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: end; margin-bottom: 20px; }
  .detail-head__art { border-radius: var(--r-m); }
  .detail-head h1 { font-size: 24px; margin: 4px 0 8px; }
  .detail-meta { font-size: 11.5px; gap: 6px; }
  .detail-desc { display: none; }
  .detail-actions { margin-top: 12px; gap: 6px; }
  .detail-actions .btn { height: 34px; padding: 0 13px; font-size: 12.5px; }

  .genre-strip { margin-bottom: 24px; gap: 6px; }
  .chip { height: 28px; font-size: 12px; padding: 0 11px; }

  /* 播放器 → 迷你条 */
  .player {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    border-radius: 0;
    border-top: 1px solid var(--line);
  }
  .player__inner { grid-template-columns: minmax(0, 1fr) auto; padding: 0 10px 0 12px; gap: 8px; }
  .player__cover { width: 42px; height: 42px; border-radius: 7px; }
  .player__title { font-size: 13px; }
  .player__sub > span:first-child { font-size: 11.5px; }
  .player__center { flex-direction: row; gap: 4px; }
  .player__controls .icon-btn:not(#btnPlay), .player__right .icon-btn, .volume, .player__timeline, .player__like { display: none; }
  .player__play { width: 38px; height: 38px; background: transparent; color: var(--ink); }
  .player__play:hover { transform: none; }
  .player__progress { height: 2px; }
  .player__progress::before { inset: -9px 0; }

  /* 底部导航 */
  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 61;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 9.5px;
    color: var(--ink-3);
    letter-spacing: 0.04em;
  }
  .tabbar a span { display: grid; place-items: center; width: 20px; height: 20px; }
  .tabbar a svg { width: 19px; height: 19px; }
  .tabbar a.is-active { color: var(--accent); }
  .tabbar a.is-active i { font-weight: 600; }
  .tabbar i { font-style: normal; }

  /* 抽屉 / 弹层 */
  .drawer { bottom: calc(var(--player-h) + var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); width: 100vw; }
  .modal-host.is-open { display: flex; align-items: flex-end; }
  .modal {
    left: 0; top: auto; bottom: 0;
    transform: none;
    width: 100vw;
    max-height: 88vh;
    border-radius: var(--r-l) var(--r-l) 0 0;
    border-bottom: 0;
    animation: sheetIn 280ms var(--ease-out);
  }
  @keyframes sheetIn { from { transform: translateY(100%); } }
  .modal__head { padding: 16px 18px 10px; }
  .modal__body { padding: 6px 18px 18px; }
  .modal__foot { padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .modal__foot .btn { flex: 1; }

  .toast-host { bottom: calc(var(--player-h) + var(--tabbar-h) + 14px); }

  /* 正在播放 */
  .now { grid-template-rows: auto 1fr auto; }
  .now__top { padding: 12px 14px; }
  .now__body { padding: 0 22px; gap: 14px; grid-template-columns: 1fr; justify-items: center; text-align: center; overflow: hidden; }
  .now__art { width: min(62vw, 300px); border-radius: 18px; }
  .now__side { gap: 6px; align-items: center; width: 100%; }
  .now__title { font-size: 22px; }
  .now__artist { font-size: 13px; }
  .now__lyrics { max-height: 24vh; min-height: 120px; text-align: left; width: 100%; padding: 20% 0; }
  .lyric-line { font-size: 14px; }
  .now__bottom { padding: 6px 18px calc(18px + env(safe-area-inset-bottom, 0px)); gap: 6px; }
  .now__controls { gap: 12px; }
  .now__controls .icon-btn { width: 38px; height: 38px; }

  .auth-wrap { padding: 12px 0 30px; min-height: auto; }
  .auth-card { padding: 22px 18px; }

  .profile-head { flex-wrap: wrap; padding: 18px; gap: 14px; }
  .profile-avatar { width: 62px; height: 62px; font-size: 22px; }
  .profile-info h1 { font-size: 20px; }
  .profile-stats { gap: 16px; }

  .settings-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }

  .source-item { grid-template-columns: 26px minmax(0, 1fr) auto; padding: 10px; }
  .source-item__act .icon-btn { width: 28px; height: 28px; }
  .table { font-size: 12px; }
  .table th, .table td { padding: 8px 6px; }
  .table .hide-sm { display: none; }

  .match-row { grid-template-columns: 1fr auto; grid-template-areas: "src arrow" "dst dst"; row-gap: 4px; }
  .match-row .src { grid-area: src; }
  .match-row .arrow { grid-area: arrow; }
  .match-row .dst { grid-area: dst; }

  .site-foot { flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 34px; }
  .site-foot__right { margin-left: 0; }
}

/* App 内特有：状态栏留白 */
@media (max-width: 820px) {
  html.is-app .topbar { padding-top: env(safe-area-inset-top, 0px); height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); }
  html.is-app .now__top { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
}

@media (max-width: 380px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .tabbar a { font-size: 9px; }
  .player__badge { display: none; }
}

@media (max-width: 820px) {
  .player { background: var(--bg); }
}
