/* ========================================
   响应式设计 - 移动端适配
   ======================================== */

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 禁用悬停效果 */
    .card-stack:hover .card {
        opacity: 0;
    }

    /* 触摸时展开卡片 */
    .card-stack.touch-active .card {
        opacity: 1;
    }

    /* 增大触摸目标 */
    .control-btn {
        min-width: 48px;
        min-height: 48px;
    }

    .playlist-item button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* 平板设备（768px - 1024px）*/
@media (max-width: 1024px) {
    .music-player-panel {
        width: 280px;
        top: 15px;
        right: 15px;
        padding: 20px;
    }

    .card-stack {
        width: 180px;
        height: 250px;
    }

    #playlist {
        width: 280px;
        top: 420px;
        right: 15px;
    }
}

/* 手机设备（最大768px）*/
@media (max-width: 768px) {
    /* 音乐播放器 - 底部固定 */
    .music-player-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 16px 20px 20px;
        z-index: 998;
        transform: translateY(0);
        transition: transform 0.3s ease;
    }

    .music-player-panel.collapsed {
        transform: translateY(calc(100% - 50px));
    }

    /* 可折叠指示器 */
    .music-player-panel::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .current-track {
        margin-bottom: 12px;
    }

    .track-name {
        font-size: 14px;
    }

    #audioVisualizer {
        height: 40px;
        margin-bottom: 12px;
    }

    .controls-row {
        gap: 15px;
        margin-bottom: 12px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
    }

    .control-btn.play-btn {
        width: 52px;
        height: 52px;
    }

    /* 播放列表 - 底部抽屉 */
    #playlist {
        position: fixed;
        top: auto;
        bottom: 300px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: 40vh;
        border-radius: 16px;
    }

    /* 照片卡片 - 移动端优化 */
    .card-stack-container {
        perspective: 800px;
    }

    .card-stack {
        width: 160px;
        height: 220px;
    }

    /* 卡片展开角度调整 */
    .card-stack.touch-active .card:nth-child(1) {
        transform: translateY(0) rotate(-35deg) translateX(-140px) scale(0.9);
    }

    .card-stack.touch-active .card:nth-child(2) {
        transform: translateY(-5px) rotate(-20deg) translateX(-90px) scale(0.93);
    }

    .card-stack.touch-active .card:nth-child(3) {
        transform: translateY(-8px) rotate(-10deg) translateX(-45px) scale(0.96);
    }

    .card-stack.touch-active .card:nth-child(4) {
        transform: translateY(-10px) rotate(0deg) translateX(0) scale(1);
    }

    .card-stack.touch-active .card:nth-child(5) {
        transform: translateY(-8px) rotate(10deg) translateX(45px) scale(0.96);
    }

    .card-stack.touch-active .card:nth-child(6) {
        transform: translateY(-5px) rotate(20deg) translateX(90px) scale(0.93);
    }

    .card-stack.touch-active .card:nth-child(7) {
        transform: translateY(0) rotate(35deg) translateX(140px) scale(0.9);
    }

    /* 照片上传按钮 */
    .card-upload-controls {
        bottom: 20px;
        flex-direction: column;
        gap: 10px;
    }

    .card-upload-btn {
        width: auto;
        min-width: 120px;
        padding: 12px 24px;
    }

    /* 添加音乐按钮 */
    #addMusicButton {
        top: auto;
        bottom: 350px;
        right: 10px;
    }

    /* 照片预览模态框 */
    .photo-modal-close {
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
    }

    .photo-counter {
        bottom: 20px;
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* 小屏手机（最大480px）*/
@media (max-width: 480px) {
    .music-player-panel {
        padding: 12px 16px 16px;
    }

    .track-name {
        font-size: 13px;
    }

    .track-status {
        font-size: 11px;
    }

    .control-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .control-btn.play-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .card-stack {
        width: 140px;
        height: 190px;
    }

    #playlist {
        bottom: 280px;
        max-height: 35vh;
        padding: 12px;
    }

    .playlist-item {
        padding: 10px 12px;
    }

    .playlist-item-name {
        font-size: 12px;
    }

    .playlist-item-duration {
        font-size: 10px;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 600px) {
    .music-player-panel {
        position: fixed;
        top: 10px;
        right: 10px;
        bottom: auto;
        width: 320px;
        padding: 12px 16px;
        border-radius: 16px;
    }

    .music-player-panel::before {
        display: none;
    }

    .current-track {
        margin-bottom: 8px;
    }

    .track-name {
        font-size: 12px;
    }

    #audioVisualizer {
        height: 30px;
        margin-bottom: 8px;
    }

    .controls-row {
        gap: 10px;
        margin-bottom: 8px;
    }

    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .control-btn.play-btn {
        width: 40px;
        height: 40px;
    }

    .volume-control {
        margin-bottom: 6px;
    }

    #playlist {
        top: 10px;
        right: 340px;
        bottom: auto;
        width: 260px;
        max-height: 150px;
    }

    .card-stack-container {
        top: 40%;
    }
}

/* 安全区域适配（iPhone刘海屏）*/
@supports (padding: max(0px)) {
    .music-player-panel {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}
