/* 全站浮动音乐播放器 */
.global-music {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 1080;
    font-family: inherit;
    color: var(--gm-fg, #1f2937);
}

.global-music-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border: none;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    position: relative;
}
.global-music-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(59, 130, 246, 0.55); }
.global-music-fab .fab-icon { transition: opacity 0.2s ease; }
.global-music-fab.is-playing::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.55);
    animation: gm-pulse 1.6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes gm-pulse {
    0%   { transform: scale(0.95); opacity: 0.8; }
    70%  { transform: scale(1.25); opacity: 0;   }
    100% { transform: scale(1.25); opacity: 0;   }
}

/* 展开面板 */
.global-music-panel {
    position: absolute;
    left: 0;
    bottom: 64px;
    width: 320px;
    max-width: calc(100vw - 36px);
    background: var(--gm-bg, rgba(255, 255, 255, 0.92));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--gm-border, rgba(0, 0, 0, 0.08));
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
    padding: 14px;
    transform-origin: bottom left;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 1;
    transform: scale(1);
}
.global-music-panel.collapsed {
    pointer-events: none;
    opacity: 0;
    transform: scale(0.6);
}

.global-music-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.gm-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gm-icon-wrap.playing { animation: gm-icon-pulse 1.6s ease-in-out infinite; }
@keyframes gm-icon-pulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50%      { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}
.gm-meta { min-width: 0; flex: 1; }
.gm-label { font-size: 0.7rem; opacity: 0.6; letter-spacing: 0.05em; text-transform: uppercase; }
.gm-track-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gm-collapse {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
    padding: 4px;
    font-size: 0.95rem;
}
.gm-collapse:hover { opacity: 1; }

.gm-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.gm-progress-track {
    flex: 1;
    height: 4px;
    background: var(--gm-progress-bg, rgba(0, 0, 0, 0.12));
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.gm-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 2px;
    transition: width 0.1s linear;
}
.gm-time { font-size: 0.72rem; opacity: 0.65; min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }

.gm-transport {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}
.gm-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gm-btn-bg, rgba(0, 0, 0, 0.06));
    border: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
}
.gm-btn:hover { background: var(--gm-btn-bg-hover, rgba(0, 0, 0, 0.12)); }
.gm-btn.play-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.gm-btn.play-btn:hover { transform: scale(1.05); }

.gm-volume {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    color: inherit;
    opacity: 0.85;
}
.gm-volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--gm-progress-bg, rgba(0, 0, 0, 0.12));
    border-radius: 2px;
    outline: none;
}
.gm-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    cursor: pointer;
    border: none;
}
.gm-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
}

.gm-playlist {
    margin-top: 8px;
    max-height: 160px;
    overflow-y: auto;
    border-top: 1px solid var(--gm-border, rgba(0, 0, 0, 0.08));
    padding-top: 6px;
}
.gm-playlist-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    color: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gm-playlist-item:hover { background: var(--gm-btn-bg-hover, rgba(0, 0, 0, 0.08)); }
.gm-playlist-item.active {
    color: #2563eb;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.1);
}
.gm-playlist-empty {
    padding: 12px;
    text-align: center;
    opacity: 0.6;
    font-size: 0.85rem;
}

/* 深色主题适配 */
[data-theme="dark"] .global-music {
    --gm-fg: #e5e7eb;
    --gm-bg: rgba(30, 30, 45, 0.92);
    --gm-border: rgba(255, 255, 255, 0.08);
    --gm-btn-bg: rgba(255, 255, 255, 0.08);
    --gm-btn-bg-hover: rgba(255, 255, 255, 0.16);
    --gm-progress-bg: rgba(255, 255, 255, 0.12);
}

/* 移动端 */
@media (max-width: 480px) {
    .global-music { left: 12px; bottom: 12px; }
    .global-music-panel { width: calc(100vw - 24px); left: 0; }
    .global-music-fab { width: 48px; height: 48px; }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .global-music-fab.is-playing::after,
    .gm-icon-wrap.playing { animation: none; }
}
