/* ============================================================
   Evermore · 全站悬浮背景音乐播放器
   跟随 Romantic Pearl 配色（珍珠白 / 鼠尾草绿 / 橄榄绿 / 香槟金）
   ============================================================ */

.mp {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 900;
    font-family: var(--font-body);
    color: var(--ink);
    -webkit-tap-highlight-color: transparent;
}

/* ---------- 收起状态的小圆钮 ---------- */

.mp-fab {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-gold);
    border-radius: 50%;
    background: linear-gradient(165deg, var(--pearl-soft), var(--ivory));
    color: var(--olive);
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(104, 118, 95, 0.18);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.mp-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(104, 118, 95, 0.24);
}

.mp-fab svg {
    width: 22px;
    height: 22px;
}

.mp[data-expanded="true"] .mp-fab {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

/* 播放中的小律动 */
.mp-eq {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 20px;
    height: 14px;
    display: none;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    padding: 2px 3px;
    border-radius: 7px;
    background-color: var(--olive);
}

.mp-eq i {
    width: 2px;
    height: 4px;
    border-radius: 1px;
    background-color: var(--pearl);
    animation: mp-eq 1s ease-in-out infinite;
}

.mp-eq i:nth-child(2) { animation-delay: 0.18s; }
.mp-eq i:nth-child(3) { animation-delay: 0.36s; }

.mp[data-playing="true"] .mp-eq {
    display: flex;
}

@keyframes mp-eq {
    0%, 100% { height: 3px; }
    50% { height: 9px; }
}

/* ---------- 展开的卡片 ---------- */

.mp-card {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 304px;
    padding: 16px 16px 14px;
    border: 1px solid var(--line-gold);
    border-radius: 18px;
    background: linear-gradient(168deg, var(--pearl-soft) 0%, var(--ivory) 100%);
    box-shadow: 0 20px 46px rgba(104, 118, 95, 0.22);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.mp[data-expanded="true"] .mp-card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.mp-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.mp-kicker {
    font-size: 9.5px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--champagne);
    margin-bottom: 4px;
}

.mp-title {
    font-family: var(--font-serif);
    font-size: 14.5px;
    line-height: 1.45;
    color: var(--olive);
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-min {
    flex: none;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-light);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.mp-min:hover {
    background-color: var(--sage-mist);
    color: var(--olive);
}

.mp-min svg {
    width: 14px;
    height: 14px;
}

/* ---------- 进度 ---------- */

.mp-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.mp-time {
    font-size: 10.5px;
    letter-spacing: 0.04em;
    color: var(--ink-light);
    font-variant-numeric: tabular-nums;
    min-width: 30px;
    text-align: center;
}

/* 通用滑块 */
.mp-seek,
.mp-volume {
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 999px;
    background: rgba(104, 118, 95, 0.18);
    outline: none;
    cursor: pointer;
}

.mp-seek {
    flex: 1;
    min-width: 0;
}

.mp-volume {
    width: 74px;
    flex: none;
}

.mp-seek::-webkit-slider-thumb,
.mp-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--olive);
    border: 2px solid var(--pearl-soft);
    box-shadow: 0 1px 4px rgba(104, 118, 95, 0.35);
    cursor: pointer;
}

.mp-seek::-moz-range-thumb,
.mp-volume::-moz-range-thumb {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--olive);
    border: 2px solid var(--pearl-soft);
    cursor: pointer;
}

.mp-seek:focus-visible,
.mp-volume:focus-visible {
    box-shadow: 0 0 0 3px rgba(165, 178, 155, 0.35);
}

/* ---------- 控制区 ---------- */

.mp-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.mp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--olive);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, opacity 0.2s;
}

.mp-btn:hover:not(:disabled) {
    background-color: var(--sage-mist);
}

.mp-btn:disabled {
    opacity: 0.32;
    cursor: not-allowed;
}

.mp-btn svg {
    width: 16px;
    height: 16px;
}

.mp-play {
    width: 42px;
    height: 42px;
    background: linear-gradient(160deg, var(--olive), var(--olive-deep));
    color: var(--pearl);
    box-shadow: 0 8px 18px rgba(104, 118, 95, 0.28);
}

.mp-play:hover:not(:disabled) {
    background: linear-gradient(160deg, var(--olive-deep), #4A5544);
}

.mp-play svg {
    width: 18px;
    height: 18px;
}

.mp-play.is-attention {
    animation: mp-pulse 1.8s ease-in-out infinite;
}

@keyframes mp-pulse {
    0%, 100% { box-shadow: 0 8px 18px rgba(104, 118, 95, 0.28); }
    50% { box-shadow: 0 8px 22px rgba(165, 178, 155, 0.55); }
}

.mp-vol {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---------- 状态行 ---------- */

.mp-status {
    margin-top: 10px;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    color: var(--ink-light);
    text-align: center;
    line-height: 1.6;
}

.mp-status.is-error {
    color: #9A6A6E;
}

.mp-resume {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(165, 178, 155, 0.7);
    border-radius: 999px;
    background-color: var(--sage-mist);
    color: var(--olive);
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background-color 0.2s;
}

/* hidden 属性要能真正隐藏（否则 display:block 会覆盖它） */
.mp-resume[hidden] {
    display: none;
}

.mp-resume:hover {
    background-color: rgba(165, 178, 155, 0.28);
}

/* ---------- 小屏 ---------- */

@media (max-width: 600px) {
    .mp {
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    .mp-fab {
        width: 46px;
        height: 46px;
    }

    .mp-card {
        width: min(280px, calc(100vw - 24px));
        padding: 14px 14px 12px;
    }

    .mp-title {
        max-width: 168px;
    }

    .mp-volume {
        width: 58px;
    }
}

/* ---------- 减少动态效果 ---------- */

@media (prefers-reduced-motion: reduce) {
    .mp-fab,
    .mp-card,
    .mp-btn {
        transition: none;
    }

    .mp-eq i,
    .mp-play.is-attention {
        animation: none;
    }
}
