/* Responsive Design - 响应式设计 */

@media (max-width: 768px) {
    /* 基础布局 */
    .tab-content, #tree { padding: 8px; }
    h1 { font-size: 18px; }
    
    /* 本地文件卡片 */
    .local-card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
    .local-card {
        flex-direction: column;
        text-align: center;
        padding: 8px;
    }
    .local-card-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .local-card-title { font-size: 12px; }
    .local-card-meta { font-size: 11px; }
    
    /* 播放列表 */
    .playlist-track-item {
        gap: 8px;
        padding: 10px;
        margin-bottom: 6px;
    }
    .track-cover { 
        width: 50px; 
        height: 50px;
        min-width: 50px;
    }
    .playlist-track-item.current-playing .track-cover {
        width: 90px;
        height: 90px;
    }
    .track-title { 
        font-size: 13px; 
        max-width: 120px;
    }
    .playlist-track-item.current-playing .track-title {
        font-size: 18px;
        -webkit-line-clamp: 2;
        max-height: 60px;
    }
    .track-type { font-size: 11px; }
    .track-progress { font-size: 9px; }
    .track-menu-btn {
        width: 32px;
        height: 32px;
    }
    
    /* 拖拽手柄 - 移动端放大触摸区域 */
    .drag-handle {
        width: 32px;
        height: 48px;
        min-width: 32px;
        opacity: 0.6;
    }
    .drag-handle svg {
        width: 18px;
        height: 18px;
    }

    /* 歌单管理卡片尺寸（平板） */
    .playlist-item { padding: 12px 14px; gap: 12px; }
    .playlist-icon { width: 46px; height: 46px; font-size: 20px; }
    .playlist-name { font-size: 15px; }
    .playlist-count { font-size: 12px; }
    .playlist-action-btn { width: 34px; height: 34px; }
    .default-badge { font-size: 11px; padding: 3px 7px; }

    .track-seq {
        right: 10px;
        bottom: 10px;
        font-size: 11px;
        padding: 4px 6px;
    }
    
    /* 底部导航栏 */
    .bottom-nav { height: 56px; }
    .nav-icon { font-size: 28px; }
    .nav-label { font-size: 9px; }
    
    /* 按钮 */
    button {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 6px;
    }
    
    /* 标签页 */
    .tab-btn { 
        padding: 10px; 
        font-size: 12px;
    }
    
    /* 模态框 */
    .modal-header, .playlists-modal-header, .search-modal-header, .history-modal-header {
        padding: 12px;
    }
    .modal-title, .playlists-modal-header h2, .search-modal-header h3, .history-modal-header h3 {
        font-size: 18px;
    }
    .modal-close, .ranking-modal-close, .history-modal-close,
    .playlists-back-btn, .playlists-add-btn,
    .search-modal-back, .full-player-back, .now-playing-close {
        width: 36px;
        height: 36px;
    }
    
    /* 全屏播放器 */
    .full-player-artwork-container {
        width: 280px;
        height: 280px;
    }
    .full-player-artwork-placeholder { font-size: 80px; }
    .full-player-title { font-size: 18px; }
    .full-player-artist { font-size: 14px; }
    .full-player-control-btn { font-size: 18px; }
    .full-player-play-pause {
        width: 56px;
        height: 56px;
    }
    
    /* Mini Player 代码已移除 */
    
    /* 搜索框 */
    .search-modal-input {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* 音量弹出框 */
    .volume-popup {
        width: 40px;
        height: 120px;
        right: 12px;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕优化 */
    .tab-content, #tree { padding: 6px; }
    
    /* 播放列表 - 更小的卡片 */
    .playlist-track-item {
        gap: 10px;
        padding: 8px;
        margin-bottom: 4px;
    }
    .track-cover { 
        width: 45px; 
        height: 45px;
    }
    .playlist-track-item.current-playing .track-cover {
        width: 110px;
        height: 110px;
    }
    .track-title { 
        font-size: 12px; 
        max-width: 100px;
    }
    .playlist-track-item.current-playing .track-title {
        font-size: 16px;
        -webkit-line-clamp: 2;
        max-height: 55px;
    }
    .track-type { font-size: 10px; }
    
    /* 拖拽手柄 - 超小屏幕 */
    .drag-handle {
        width: 28px;
        height: 44px;
        min-width: 28px;
    }
    .drag-handle svg {
        width: 16px;
        height: 16px;
    }

    .track-seq {
        right: 8px;
        bottom: 8px;
        font-size: 10px;
        padding: 3px 6px;
    }
    
    /* 底部导航 */
    .bottom-nav { height: 52px; padding: 0 4px; }
    .nav-item { padding: 4px; gap: 2px; }
    .nav-icon { font-size: 26px; }
    .nav-label { font-size: 8px; }
    
    /* 播放栏控制 */
    .footer-controls-left, .footer-controls-right { gap: 6px; }
    .control-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    .play-pause-large {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    /* 本地卡片 */
    .local-card-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .local-card-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    
    /* 面包屑 */
    .local-breadcrumb { 
        padding: 8px; 
        font-size: 12px;
        gap: 4px;
    }
    
    /* 模态框 */
    .modal-body, .playlists-modal-body, .search-modal-body, .history-modal-body, .ranking-modal-body {
        padding: 12px;
        padding-bottom: 70px;
    }
    
    /* 排行榜标签 */
    .ranking-tabs {
        gap: 6px;
        padding: 12px;
    }
    .ranking-tab {
        padding: 8px;
        font-size: 12px;
    }
}

/* iPhone 专门优化 */
@media (max-width: 430px) {
    /* 播放列表 - iPhone 屏幕很窄 */
    .playlist-track-item {
        gap: 8px;
        padding: 6px;
        margin-bottom: 4px;
    }
    
    .track-cover { 
        width: 40px; 
        height: 40px;
        min-width: 40px;
    }
    
    .playlist-track-item.current-playing .track-cover {
        width: 100px;
        height: 100px;
    }
    
    /* 歌曲名称 - iPhone 需要更激进地截断 */
    .track-title { 
        font-size: 13px;
        max-width: 80px;
    }
    
    .playlist-track-item.current-playing .track-title {
        font-size: 16px;
        max-width: 100%;
        -webkit-line-clamp: 2;
        max-height: 50px;
    }
    
    .track-type { font-size: 10px; }
    .track-meta { gap: 4px; font-size: 11px; }
    .track-playlist-name { max-width: 60px; }
    
    /* 拖拽手柄 - iPhone 最小化宽度 */
    .drag-handle {
        width: 24px;
        height: 40px;
        min-width: 24px;
    }
    .drag-handle svg {
        width: 14px;
        height: 14px;
    }

    .track-seq {
        right: 8px;
        bottom: 8px;
        font-size: 10px;
        padding: 3px 6px;
    }

    /* 歌单管理卡片尺寸（iPhone） */
    .playlist-item { padding: 10px 12px; gap: 10px; }
    .playlist-icon { width: 42px; height: 42px; font-size: 18px; }
    .playlist-name { font-size: 14px; }
    .playlist-count { font-size: 12px; }
    .playlist-action-btn { width: 32px; height: 32px; }
    
    .track-menu-btn {
        width: 28px;
        height: 28px;
        padding: 2px;
    }
    
    /* 底部导航 - iPhone 安全区域 */
    .bottom-nav { 
        height: 54px;
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    .nav-item { padding: 4px 2px; }
    .nav-icon { font-size: 30px; }
    .nav-label { font-size: 8px; }
    
    /* 播放栏 */
    .player-bar { 
        gap: 8px;
        padding: 4px 6px;
    }
    .player-cover { 
        width: 36px; 
        height: 36px; 
    }
    .player-title { font-size: 12px; }
    
    /* 按钮 - iPhone 触摸目标最少44x44px */
    button {
        padding: 10px 12px;
        font-size: 12px;
        min-height: 44px;
    }
    
    .control-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 16px;
    }
    
    /* 搜索框 */
    .search-modal-input {
        padding: 12px;
        font-size: 16px;
        height: 44px;
    }
    
    /* 全屏播放器 */
    .full-player-artwork-container {
        width: 240px;
        height: 240px;
    }
    .full-player-title { font-size: 16px; }
    .full-player-artist { font-size: 12px; }
    .full-player-play-pause {
        width: 50px;
        height: 50px;
    }
}

/* iPod touch 7 专门优化 (320px, 4英寸屏幕) */
@media (max-width: 360px) {
    /* 整体容器 - 更紧凑的内边距 */
    .tab-content, #tree { padding: 4px; }
    body { font-size: 14px; }
    
    /* 播放列表 - 超小卡片 */
    .playlist-track-item {
        gap: 6px;
        padding: 6px;
        margin-bottom: 3px;
        border-radius: 8px;
    }
    
    /* 封面尺寸 - iPod touch 需要非常小 */
    .track-cover { 
        width: 38px; 
        height: 38px;
        min-width: 38px;
        border-radius: 6px;
    }
    
    .playlist-track-item.current-playing .track-cover {
        width: 85px;
        height: 85px;
        border-radius: 10px;
    }
    
    /* 歌曲信息 - 极度压缩的文本 */
    .track-info { gap: 2px; }
    .track-title { 
        font-size: 12px;
        max-width: 70px;
        line-height: 1.3;
    }
    
    .playlist-track-item.current-playing .track-title {
        font-size: 15px;
        max-width: 100%;
        -webkit-line-clamp: 2;
        max-height: 45px;
        line-height: 1.4;
    }
    
    .track-type { 
        font-size: 9px;
        padding: 2px 4px;
    }
    
    .track-meta { 
        gap: 3px; 
        font-size: 10px;
    }
    
    .track-playlist-name { 
        max-width: 50px;
        font-size: 10px;
    }
    
    /* 拖拽手柄 - 最小化 */
    .drag-handle {
        width: 20px;
        height: 36px;
        min-width: 20px;
    }
    
    .drag-handle svg {
        width: 12px;
        height: 12px;
    }
    
    /* 序号徽章 */
    .track-seq {
        right: 6px;
        bottom: 6px;
        font-size: 9px;
        padding: 2px 5px;
        min-width: 16px;
    }
    
    /* 菜单按钮 */
    .track-menu-btn {
        width: 26px;
        height: 26px;
        padding: 2px;
        font-size: 14px;
    }
    
    /* 底部导航栏 - iPod touch 优化 */
    .bottom-nav { 
        height: 50px;
        padding: 0 2px;
        gap: 0;
    }
    
    .nav-item { 
        padding: 3px 1px;
        gap: 1px;
        min-width: 50px;
    }
    
    .nav-icon { 
        font-size: 24px;
        width: 28px;
        height: 28px;
        line-height: 28px;
    }
    
    .nav-label { 
        font-size: 7px;
        letter-spacing: -0.2px;
    }
    
    /* 播放栏 - 紧凑布局 */
    .player-bar { 
        gap: 6px;
        padding: 3px 5px;
        height: auto;
        min-height: 48px;
    }
    
    .player-cover { 
        width: 32px; 
        height: 32px;
        border-radius: 6px;
    }
    
    .player-info { gap: 2px; }
    .player-title { 
        font-size: 11px;
        max-width: 140px;
    }
    
    .player-artist { 
        font-size: 9px;
        max-width: 140px;
    }
    
    /* 播放控制按钮 */
    .footer-controls-left,
    .footer-controls-right { 
        gap: 4px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        font-size: 13px;
        padding: 0;
    }
    
    .play-pause-large {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    
    /* 按钮 - 保持可点击但更小 */
    button {
        padding: 8px 10px;
        font-size: 11px;
        min-height: 38px;
        border-radius: 6px;
    }
    
    /* 本地文件卡片 */
    .local-card-grid { 
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 4px;
    }
    
    .local-card {
        padding: 6px;
        border-radius: 8px;
    }
    
    .local-card-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .local-card-title { 
        font-size: 11px;
        margin-top: 4px;
    }
    
    .local-card-meta { 
        font-size: 9px;
        margin-top: 2px;
    }
    
    /* 面包屑导航 */
    .local-breadcrumb { 
        padding: 6px;
        font-size: 11px;
        gap: 3px;
    }
    
    .breadcrumb-item { font-size: 11px; }
    
    /* 模态框优化 */
    .modal-header,
    .playlists-modal-header,
    .search-modal-header,
    .history-modal-header,
    .ranking-modal-header {
        padding: 10px;
        height: 48px;
    }
    
    .modal-title,
    .playlists-modal-header h2,
    .search-modal-header h3,
    .history-modal-header h3,
    .ranking-modal-header h3 {
        font-size: 16px;
    }
    
    .modal-close,
    .ranking-modal-close,
    .history-modal-close,
    .playlists-back-btn,
    .playlists-add-btn,
    .search-modal-back,
    .full-player-back,
    .now-playing-close {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .modal-body,
    .playlists-modal-body,
    .search-modal-body,
    .history-modal-body,
    .ranking-modal-body {
        padding: 8px;
        padding-bottom: 60px;
    }
    
    /* 歌单管理卡片 */
    .playlist-item { 
        padding: 8px 10px;
        gap: 8px;
        border-radius: 8px;
    }
    
    .playlist-icon { 
        width: 38px;
        height: 38px;
        font-size: 17px;
    }
    
    .playlist-name { 
        font-size: 13px;
        line-height: 1.3;
    }
    
    .playlist-count { 
        font-size: 11px;
    }
    
    .playlist-action-btn { 
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    .default-badge { 
        font-size: 9px;
        padding: 2px 5px;
    }
    
    /* 排行榜标签 */
    .ranking-tabs {
        gap: 4px;
        padding: 8px;
        flex-wrap: wrap;
    }
    
    .ranking-tab {
        padding: 6px 8px;
        font-size: 11px;
        border-radius: 6px;
        min-width: 48px;
    }
    
    /* 搜索框 */
    .search-modal-input {
        padding: 10px;
        font-size: 14px;
        height: 40px;
    }
    
    /* 搜索结果卡片 */
    .search-result-item {
        padding: 8px;
        gap: 8px;
    }
    
    .search-result-cover {
        width: 45px;
        height: 45px;
    }
    
    .search-result-title {
        font-size: 12px;
    }
    
    .search-result-artist {
        font-size: 10px;
    }
    
    /* 全屏播放器 */
    .full-player {
        padding: 12px;
    }
    
    .full-player-artwork-container {
        width: 200px;
        height: 200px;
        margin: 20px auto;
    }
    
    .full-player-artwork-placeholder { 
        font-size: 60px;
    }
    
    .full-player-info {
        padding: 12px 0;
    }
    
    .full-player-title { 
        font-size: 15px;
        margin-bottom: 4px;
    }
    
    .full-player-artist { 
        font-size: 11px;
    }
    
    .full-player-playlist {
        font-size: 10px;
        margin-top: 4px;
    }
    
    /* 进度条区域 */
    .full-player-progress-container {
        padding: 12px 0;
    }
    
    .full-player-progress-bar {
        height: 4px;
        margin: 8px 0;
    }
    
    .full-player-progress-thumb {
        width: 14px;
        height: 14px;
    }
    
    .full-player-time {
        font-size: 11px;
    }
    
    /* 全屏播放器控制 */
    .full-player-controls {
        gap: 12px;
        padding: 12px 0;
    }
    
    .full-player-control-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .full-player-play-pause {
        width: 50px;
        height: 50px;
    }
    
    .full-player-play-pause svg {
        width: 24px;
        height: 24px;
    }
    
    /* 全屏播放器副控制 */
    .full-player-secondary-controls {
        gap: 16px;
        padding: 8px 0;
    }
    
    .full-player-secondary-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    /* 音量控制 */
    .full-player-volume-container {
        padding: 8px 0;
    }
    
    .full-player-volume-slider {
        height: 4px;
    }
    
    /* Toast 提示 */
    .toast {
        padding: 10px 14px;
        font-size: 12px;
        border-radius: 8px;
        min-width: 200px;
    }
    
    /* Loading 指示器 */
    .loading-overlay {
        font-size: 14px;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
    }
}

/* iPhone 12+ 优化 (390px-430px) */
@media (min-width: 390px) and (max-width: 430px) {
    /* 播放列表布局 */
    .playlist-track-item { gap: 10px; padding: 8px; }
    .track-cover { width: 50px; height: 50px; min-width: 50px; }
    .playlist-track-item.current-playing .track-cover {
        width: 120px;
        height: 120px;
    }

    .track-title { font-size: 14px; max-width: 120px; }
    .playlist-track-item.current-playing .track-title {
        font-size: 18px;
        -webkit-line-clamp: 2;
        max-height: 60px;
    }
    .track-type { font-size: 11px; }
    .track-meta { gap: 6px; font-size: 12px; }
    .track-playlist-name { max-width: 80px; }

    .track-seq {
        right: 10px;
        bottom: 10px;
        font-size: 11px;
        padding: 4px 6px;
    }

    /* 歌单管理卡片尺寸（iPhone12+） */
    .playlist-item { padding: 12px 14px; gap: 12px; }
    .playlist-icon { width: 46px; height: 46px; font-size: 20px; }
    .playlist-name { font-size: 15px; }
    .playlist-count { font-size: 12px; }
    .playlist-action-btn { width: 34px; height: 34px; }

    /* 底部导航与安全区域 */
    .bottom-nav { height: 60px; padding-bottom: max(0px, env(safe-area-inset-bottom)); }
    .nav-item { padding: 4px; gap: 3px; }
    .nav-icon { font-size: 26px; }
    .nav-label { font-size: 9px; }

    /* 播放栏 */
    .player-bar { gap: 10px; padding: 6px; }
    .player-cover { width: 40px; height: 40px; }
    .player-title { font-size: 13px; }

    /* 按钮保持 44px 可点击面积 */
    button { min-height: 44px; }
    .control-btn { min-width: 44px; min-height: 44px; }

    /* 全屏播放器稍大 */
    .full-player-artwork-container { width: 300px; height: 300px; }
    .full-player-title { font-size: 17px; }
    .full-player-artist { font-size: 13px; }
    .full-player-play-pause { width: 54px; height: 54px; }
}
