
* { -webkit-tap-highlight-color: transparent !important; }

/* --- 侧边栏控制面板 (原有逻辑) --- */
.mp-wrapper {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    user-select: none;
    touch-action: pan-y;
    will-change: transform;
}
.mp-wrapper * { box-sizing: border-box; margin: 0; padding: 0; }
.mp-trigger {
    width: 20px; height: 68px; min-height: 68px;
    border-radius: 0 12px 12px 0;
    background: rgba(17, 24, 39, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: none;
    box-shadow: 2px 0 14px rgba(0, 0, 0, 0.14);
    cursor: grab; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; outline: none;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    transition: background 0.25s ease, width 0.25s ease;
}
.mp-trigger .mp-arrow {
    color: rgba(255, 255, 255, 0.85); width: 12px; height: 12px; display: block;
    pointer-events: none; transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.mp-wrapper.open .mp-trigger .mp-arrow { transform: rotate(180deg); }
.mp-panel {
    position: absolute; left: 0; top: 0; width: 300px;
    max-width: calc(100vw - 34px); max-height: min(520px, calc(100vh - 24px));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-radius: 0 16px 16px 0; border: 1px solid #eef2f8; border-left: none;
    box-shadow: 4px 0 32px rgba(15, 23, 42, 0.10);
    opacity: 0; transform: translateX(-105%); pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.4s ease;
    display: flex; flex-direction: column; overflow: hidden;
}
.mp-wrapper.open .mp-panel { opacity: 1; transform: translateX(0); pointer-events: auto; }
.mp-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px 16px; border-bottom: 1px solid #eef2f8; flex-shrink: 0; }
.mp-title { flex: 1; font-size: 14px; font-weight: 700; color: #1a3d5e; display: flex; align-items: center; gap: 6px; }
.mp-close-btn { color: #b0bec5; width: 26px; height: 26px; cursor: pointer; border: none; background: transparent; border-radius: 7px; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.mp-search { display: flex; align-items: center; gap: 6px; margin: 10px 14px 4px; background: #fff; border: 1px solid #dde3ee; border-radius: 8px; padding: 6px 10px; height: 32px; flex-shrink: 0; }
.mp-search-input { flex: 1; font-size: 12px; color: #1a3d5e; outline: none; background: transparent; border: none; min-width: 0; }
.mp-categories { display: flex; gap: 6px; padding: 8px 14px 4px; overflow-x: auto; flex-shrink: 0; }
.mp-categories::-webkit-scrollbar { height: 0; }
.mp-cat { font-size: 11px; padding: 4px 10px; border-radius: 12px; cursor: pointer; background: #f1f5f9; color: #64748b; white-space: nowrap; flex-shrink: 0; border: 1px solid transparent; }
.mp-cat.active { background: #e6f0ff; color: #007aff; font-weight: 600; border-color: #bfdbfe; }
.mp-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 4px 8px 8px; min-height: 80px; overscroll-behavior: contain; }
.mp-list::-webkit-scrollbar { width: 3px; }
.mp-list::-webkit-scrollbar-thumb { background: #d0dbe8; border-radius: 4px; }
.mp-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; flex-shrink: 0; }
.mp-item.active { background: #eef3fc; }
.mp-item-num { width: 20px; height: 20px; border-radius: 50%; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #94a3b8; font-weight: 600; flex-shrink: 0; }
.mp-item.active .mp-item-num { background: #007aff; color: #fff; }
.mp-item-name { flex: 1; font-size: 12px; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-item.active .mp-item-name { color: #007aff; font-weight: 600; }
.mp-item-cat { font-size: 9px; padding: 2px 7px; border-radius: 8px; background: #f1f5f9; color: #94a3b8; flex-shrink: 0; }
.mp-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px 10px; border-top: 1px solid #eef2f8; flex-shrink: 0; }
.mp-now { font-size: 11px; color: #8e9daf; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mp-now strong { color: #1a3d5e; font-weight: 600; }
.mp-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mp-ctrl { width: 28px; height: 28px; border-radius: 50%; border: none; background: transparent; color: #5a6e8a; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mp-ctrl svg { width: 14px; height: 14px; }
.mp-play-btn { width: 30px; height: 30px; border-radius: 50%; border: none; background: #007aff; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 122, 255, 0.35); }
.mp-play-btn svg { width: 12px; height: 12px; }

/* ================= 完美仿苹果灵动岛 (顶部居中) ================= */
.dynamic-island {
    position: fixed;
    /* 核心：定位到屏幕顶部正中，避开状态栏 */
    top: max(10px, env(safe-area-inset-top, 10px)); 
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    background: #000000;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    
    /* 紧凑态 (胶囊大小) */
    width: 140px;
    height: 36px;
    border-radius: 20px;
    
    /* 苹果标志性的弹簧过渡 */
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                height 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                border-radius 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                opacity 0.3s ease;
    
    opacity: 0;
    pointer-events: none;
}

.dynamic-island.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* 点击展开后的尺寸 */
.dynamic-island.is-expanded {
    width: 350px;
    height: 160px;
    border-radius: 38px;
}

/* --- 紧凑态内容 (胶囊里) --- */
.di-compact {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 12px;
    box-sizing: border-box;
    transition: opacity 0.2s ease;
    opacity: 1;
    cursor: pointer;
}
.dynamic-island.is-expanded .di-compact {
    opacity: 0;
    pointer-events: none;
}

/* 左侧小封面 / 默认音符 */
.di-cover {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 8px;
    overflow: hidden;
}
.di-cover svg { width: 12px; height: 12px; fill: #fff; }

/* 中间文字 */
.di-title {
    font-size: 12px;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* 右侧动态波形 */
.di-eq {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    margin-left: 8px;
}
.di-eq i {
    width: 2px;
    background: #30d158; /* 苹果绿 */
    border-radius: 1px;
    height: 4px;
    transition: height 0.2s;
}
.dynamic-island.is-playing .di-eq i {
    animation: diEq 0.7s ease-in-out infinite alternate;
}
.dynamic-island.is-playing .di-eq i:nth-child(2) { animation-delay: -0.3s; }
.dynamic-island.is-playing .di-eq i:nth-child(3) { animation-delay: -0.5s; }
.dynamic-island.is-playing .di-eq i:nth-child(4) { animation-delay: -0.1s; }

@keyframes diEq {
    0% { height: 4px; }
    100% { height: 14px; }
}

/* --- 展开态内容 (大面板) --- */
.di-expanded {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    transition-delay: 0s;
}
.dynamic-island.is-expanded .di-expanded {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.1s;
}

.di-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.di-cover-large {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.di-cover-large svg { width: 24px; height: 24px; fill: #fff; }

.di-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.di-title-large {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.di-sub-large {
    font-size: 12px;
    color: #9d9da5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.di-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.di-time {
    font-size: 10px;
    color: #888;
    font-variant-numeric: tabular-nums;
    width: 30px;
    text-align: center;
}
.di-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}
.di-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0%;
}

.di-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
}
.di-btn {
    background: none;
    border: none;
    color: #fff;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.2s, transform 0.1s;
}
.di-btn:active {
    transform: scale(0.85);
    opacity: 1;
}
.di-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.di-play-btn svg {
    width: 26px;
    height: 26px;
}
