/* ===== 站点 tool-content 基础样式（保留） ===== */
.tool-content {
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    padding: 1.2em;
    border-radius: .6em;
    position: relative;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .tool-content:not(.mp-player) {
        padding: .8em !important;
        box-shadow: unset;
    }
}

/* ===== 本地音乐播放器 ===== */
.mp-player {
    /* 浅色主题（默认） */
    --mp-app-bg: #ffffff;
    --mp-side-bg: #f7f8fb;
    --mp-panel: rgba(255, 255, 255, .7);
    --mp-panel-hover: #f1f3f9;
    --mp-line: rgba(30, 35, 60, .09);
    --mp-txt: #232537;
    --mp-sub: #7c8092;
    --mp-accent: #6d7cf0;
    --mp-accent-2: #a56ee8;
    --mp-red: #ef5b72;
    --mp-bar-bg: rgba(30, 35, 60, .11);
    --mp-scroll: rgba(30, 35, 60, .18);
    --mp-cover-shadow: 0 14px 34px rgba(30, 35, 70, .16);
    --mp-track-active: linear-gradient(90deg, rgba(109, 124, 240, .16), rgba(165, 110, 232, .07));

    width: 100%;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns:1fr 320px;
    padding: 0; /* 合并到 .tool-content 后，抵消站点默认的 1.2em 内边距 */
    height: 590px; /* 固定高度：右侧列表超出时自身滚动，不撑高整个播放器 */
    background: var(--mp-app-bg);
    border: 1px solid var(--mp-line);
    border-radius: 0.6em;
    overflow: hidden;
    position: relative;
    color: var(--mp-txt);
    font-family: var(--font-family, inherit);
    transition: background .3s, color .3s;
}

.mp-player[data-theme="dark"] {
    --mp-app-bg: #171820;
    --mp-side-bg: #121319;
    --mp-panel: rgba(255, 255, 255, .055);
    --mp-panel-hover: rgba(255, 255, 255, .09);
    --mp-line: rgba(255, 255, 255, .09);
    --mp-txt: #f2f3f7;
    --mp-sub: #9a9dab;
    --mp-accent: #7c8cff;
    --mp-accent-2: #c07cff;
    --mp-red: #ff6b81;
    --mp-bar-bg: rgba(255, 255, 255, .12);
    --mp-scroll: rgba(255, 255, 255, .12);
    --mp-cover-shadow: 0 14px 34px rgba(0, 0, 0, .5);
    --mp-track-active: linear-gradient(90deg, rgba(124, 140, 255, .22), rgba(192, 124, 255, .1));
}

.mp-player * {
    box-sizing: border-box
}

/* 功能元素不参与 grid 布局，避免多出空行 */
.tool-content.mp-player > #mpFileInput,
.tool-content.mp-player > #mpAudio {
    display: none
}

/* ---------- 左侧：播放区 ---------- */
.mp-main {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    padding: 28px 32px;
    min-width: 0
}

.mp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.mp-tag {
    font-size: 12px;
    color: var(--mp-sub);
    letter-spacing: 1px
}

.mp-mode-btns {
    display: flex;
    gap: 6px
}

.mp-mode-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--mp-line);
    background: var(--mp-panel);
    color: var(--mp-sub);
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .15s;
}

.mp-mode-btn:hover {
    color: var(--mp-txt);
    background: var(--mp-panel-hover)
}

.mp-mode-btn.on {
    color: var(--mp-accent);
    border-color: rgba(109, 124, 240, .5);
    background: rgba(109, 124, 240, .12)
}

.mp-mode-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round
}

.mp-cover-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 25px 0
}

.mp-cover {
    width: min(240px, 60%);
    aspect-ratio: 1;
    flex-shrink: 0; /* 固定高度下防止被 flex 压扁，保持正圆 */
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: conic-gradient(from 200deg, transparent 0deg, rgba(255, 255, 255, .13) 26deg, transparent 58deg, transparent 178deg, rgba(255, 255, 255, .06) 208deg, transparent 238deg),
    repeating-radial-gradient(circle at 50% 50%,
            rgba(255, 255, 255, .13) 0px,
            rgba(255, 255, 255, .13) 1px,
            rgba(0, 0, 0, .42) 1.5px,
            rgba(0, 0, 0, .42) 3.5px),
    radial-gradient(circle at 50% 50%, #2a2a31 0%, #101014 58%, #050507 100%);
    box-shadow: var(--mp-cover-shadow), inset 0 0 0 1px rgba(255, 255, 255, .07);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mp-spin 10s linear infinite;
    animation-play-state: paused;
    transition: box-shadow .3s;
}

.mp-cover.playing {
    animation-play-state: running;
    box-shadow: 0 20px 50px rgba(109, 124, 240, .34), inset 0 0 0 1px rgba(255, 255, 255, .09)
}

.mp-vinyl-label {
    position: absolute;
    width: 36%;
    height: 36%;
    border-radius: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(165deg, #3bc996 0%, #1a93b0 100%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .12), inset 0 2px 12px rgba(255, 255, 255, .28);
}

.mp-vinyl-hole {
    position: absolute;
    width: 9%;
    height: 9%;
    border-radius: 50%;
    z-index: 3;
    background: #fff;
    border: 2px solid #9aa0a6;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .12);
}

@keyframes mp-spin {
    to {
        transform: rotate(360deg)
    }
}

.mp-info {
    text-align: center;
    margin-bottom: 16px
}

.mp-title {
    font-size: 19px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.mp-artist {
    font-size: 13px;
    color: var(--mp-sub);
    margin-top: 6px
}

.mp-progress-area {
    margin-bottom: 16px
}

.mp-bar {
    height: 5px;
    border-radius: 5px;
    background: var(--mp-bar-bg);
    cursor: pointer;
    position: relative;
    overflow: hidden
}

.mp-fill {
    height: 100%;
    width: 0%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--mp-accent), var(--mp-accent-2));
    transition: width .1s linear
}

.mp-times {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--mp-sub);
    margin-top: 8px;
    font-variant-numeric: tabular-nums
}

.mp-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-bottom: 18px
}

.mp-ctrl {
    background: none;
    border: none;
    color: var(--mp-txt);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .15s
}

.mp-ctrl:hover {
    color: var(--mp-accent);
    transform: scale(1.08)
}

.mp-ctrl svg {
    width: 22px;
    height: 22px;
    fill: currentColor
}

.mp-ctrl.mp-play {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--mp-accent), var(--mp-accent-2));
    box-shadow: 0 8px 22px rgba(109, 124, 240, .4);
}

.mp-ctrl.mp-play:hover {
    color: #fff;
    transform: scale(1.05)
}

.mp-vol {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    color: var(--mp-sub)
}

.mp-vol svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0
}

.mp-vol input {
    -webkit-appearance: none;
    appearance: none;
    width: 140px;
    height: 5px;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    /* 已填充部分用与进度条一致的渐变，比例由 JS 通过 --mp-vol-pct 传入 */
    background: linear-gradient(90deg, var(--mp-accent), var(--mp-accent-2)) 0 / var(--mp-vol-pct, 80%) 100% no-repeat,
    var(--mp-bar-bg);
}

.mp-vol input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mp-accent), var(--mp-accent-2));
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
    cursor: pointer;
}

.mp-vol input::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--mp-accent);
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
    cursor: pointer
}

.mp-vol input::-moz-range-track {
    background: transparent
}

.mp-vol span {
    font-size: 11px;
    width: 32px;
    text-align: right
}

.mp-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(255, 255, 255, .93);
    border: 2px dashed var(--mp-accent);
    border-radius: 14px;
    font-size: 15px;
    gap: 10px;
    color: var(--mp-accent);
}

.mp-player[data-theme="dark"] .mp-drop-overlay {
    background: rgba(23, 24, 32, .92)
}

.mp-drop-overlay.show {
    display: flex
}

.mp-drop-overlay .ico {
    font-size: 44px
}

/* ---------- 右侧：播放列表 ---------- */
.mp-side {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    background: var(--mp-side-bg);
    border-left: 1px solid var(--mp-line);
    min-height: 0;
    transition: background .3s;
}

.mp-side-head {
    padding: 22px 18px 14px
}

.mp-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 600
}

.mp-brand .mp-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mp-accent), var(--mp-accent-2));
    box-shadow: 0 0 10px var(--mp-accent)
}

.mp-brand small {
    font-size: 10px;
    color: var(--mp-sub);
    font-weight: 400;
    margin-left: auto
}

.mp-add-btn {
    margin-top: 15px;
    width: 100%;
    padding: 9px;
    border-radius: 7px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--mp-accent), var(--mp-accent-2));
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 600;
    transition: transform .15s, filter .15s;
}

.mp-add-btn:hover {
    filter: brightness(1.08)
}

.mp-add-btn:active {
    transform: scale(.98)
}

.mp-list-label {
    padding: 6px 18px 8px;
    font-size: 11px;
    color: var(--mp-sub);
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between
}

.mp-list-label span {
    cursor: pointer;
    transition: color .15s
}

.mp-list-label span:hover {
    color: var(--mp-txt)
}

.mp-playlist {
    flex: 1;
    overflow-y: auto;
    padding: 0 9px 14px;
    min-height: 0
}

.mp-playlist::-webkit-scrollbar {
    width: 6px
}

.mp-playlist::-webkit-scrollbar-thumb {
    background: var(--mp-scroll);
    border-radius: 6px
}

.mp-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--mp-sub);
    font-size: 13px;
    line-height: 1.9
}

.mp-empty .ico {
    font-size: 32px;
    display: block;
    margin-bottom: 10px;
    opacity: .5
}

.mp-track {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px;
    border-radius: 11px;
    cursor: pointer;
    transition: background .15s
}

.mp-track:hover {
    background: var(--mp-panel-hover)
}

.mp-track.active {
    background: var(--mp-track-active)
}

.mp-track .num {
    width: 18px;
    text-align: center;
    font-size: 12px;
    color: var(--mp-sub);
    flex-shrink: 0
}

.mp-track.active .num {
    color: var(--mp-accent)
}

.mp-track .thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #fff
}

.mp-track .meta {
    min-width: 0;
    flex: 1
}

.mp-track .name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.mp-track.active .name {
    color: var(--mp-accent)
}

.mp-track .artist {
    font-size: 11px;
    color: var(--mp-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px
}

.mp-track .del {
    opacity: 0;
    color: var(--mp-sub);
    font-size: 15px;
    padding: 2px 5px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: .15s
}

.mp-track:hover .del {
    opacity: 1
}

.mp-track .del:hover {
    color: var(--mp-red);
    background: rgba(239, 91, 114, .12)
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
    .mp-player {
        grid-template-columns:1fr;
        height: auto /* 窄屏上下排列时改为自适应，避免内容被压扁 */
    }

    .mp-main {
        grid-column: 1;
        grid-row: 1;
        padding: 22px
    }

    .mp-side {
        grid-column: 1;
        grid-row: 2;
        max-height: 240px;
        border-left: none;
        border-top: 1px solid var(--mp-line)
    }

    .mp-cover {
        width: min(200px, 48%)
    }

    .mp-title {
        font-size: 17px
    }
}
