/* ============================================================
 * 首页背景音乐播放器样式
 * 位置由后台配置（四角之一），边距由 CSS 变量 --xb-music-x / -y 控制
 * ============================================================ */

.xb-music {
    position: fixed;
    z-index: 9990;
    display: flex;
    align-items: center;
    gap: 10px;
    --xb-music-x: 24px;
    --xb-music-y: 96px;
}

.xb-music-bottom-right { right: var(--xb-music-x); bottom: var(--xb-music-y); flex-direction: row-reverse; }
.xb-music-bottom-left  { left: var(--xb-music-x);  bottom: var(--xb-music-y); }
.xb-music-top-right    { right: var(--xb-music-x); top: var(--xb-music-y);    flex-direction: row-reverse; }
.xb-music-top-left     { left: var(--xb-music-x);  top: var(--xb-music-y); }

.xb-music-btn {
    position: relative;
    width: 46px;
    height: 46px;
    flex: none;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066cc, #2ea6ff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0, 102, 204, .35);
    transition: transform .22s ease, box-shadow .22s ease;
    -webkit-tap-highlight-color: transparent;
}

.xb-music-btn:hover { box-shadow: 0 10px 26px rgba(0, 102, 204, .45); }
.xb-music-btn:active { transform: scale(.95); }

.xb-music-svg { display: block; }
.xb-music-pause { display: none; }
.xb-music.is-playing .xb-music-play { display: none; }
.xb-music.is-playing .xb-music-pause { display: block; }

/* 播放中：外圈旋转光环 */
.xb-music.is-playing .xb-music-btn::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(0, 102, 204, .35);
    border-top-color: rgba(0, 102, 204, .9);
    animation: xbMusicSpin 2.4s linear infinite;
}

@keyframes xbMusicSpin {
    to { transform: rotate(360deg); }
}

/* 自定义图标 */
.xb-music.has-custom-icon .xb-music-btn {
    background: #fff;
    overflow: hidden;
}
.xb-music-custom {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* 提示文字（自动播放被拦截时出现） */
.xb-music-tip {
    display: none;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 20, 45, .82);
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    animation: xbTipIn .3s ease;
}

.xb-music-tip.is-show { display: block; }

@keyframes xbTipIn {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: none; }
}

/* 移动端：缩小尺寸，位置由 JS 追加安全边距 */
@media (max-width: 768px) {
    .xb-music-btn { width: 42px; height: 42px; }
    .xb-music-tip { font-size: 11px; padding: 5px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .xb-music.is-playing .xb-music-btn::before { animation: none; }
    .xb-music-tip { animation: none; }
}
