/* ========== 播放器样式（干净的暗黑极简风） ========== */
#mpRoot {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #f4f4f8;
    -webkit-tap-highlight-color: transparent;
}

#mpRoot *,
#mpRoot *::before,
#mpRoot *::after {
    box-sizing: border-box;
}

/* 卡片主体 */
#mpRoot .mp-card {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    height: min(600px, calc(100dvh - 40px));
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas: "art" "meta" "lyr" "prog" "ctrl";
    gap: 16px;
    padding: 26px 22px calc(24px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 32px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8);
    overflow: hidden;
}

/* ===== 封面区域 ===== */
#mpRoot .mp-art {
    grid-area: art;
    display: flex;
    justify-content: center;
    align-items: center;
}

#mpRoot .mp-cover-wrap {
    position: relative;
    width: min(240px, 30vmin);
    aspect-ratio: 1/1;
    border-radius: 50%;
    /* 阴影加在 wrap 上，让图片有立体感 */
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: mpSpin 26s linear infinite;
    animation-play-state: paused;
}

#mpRoot .mp-cover-wrap.spinning {
    animation-play-state: running;
}

/* 外圈背景图 */
#mpRoot .mp-cover-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    z-index: 0;
}

/* 内部图标容器 */
#mpRoot .mp-cover {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    z-index: 2;
}

/* 图标样式 */
#mpRoot .mp-cover svg {
    width: 32px;
    height: 32px;
    fill: #fff;
    /* 加一点点发光，保证在任何图片上都能看清 */
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.8));
    background-color: #ffffff86;
    border-radius: 50%;
}

@keyframes mpSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== 歌曲信息 ===== */
#mpRoot .mp-meta {
    grid-area: meta;
    text-align: center;
    min-width: 0;
}

#mpRoot .mp-title {
    margin: 0;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

#mpRoot .mp-artist {
    margin: 7px 0 0;
    font-size: 13px;
    color: #8f8fa3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: .5px;
}

/* ===== 歌词 ===== */
#mpRoot .mp-lyrics {
    grid-area: lyr;
    position: relative;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0 8px;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 84%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 16%, #000 84%, transparent 100%);
}

#mpRoot .mp-lyrics::-webkit-scrollbar {
    display: none;
}

#mpRoot .mp-line {
    padding: 10px 12px;
    text-align: center;
    font-size: 15px;
    line-height: 1.55;
    color: rgba(255, 255, 255, .3);
    transition: color .35s, transform .4s cubic-bezier(.22, 1, .36, 1);
    cursor: pointer;
    user-select: none;
    border-radius: 10px;
}

#mpRoot .mp-line:hover {
    color: rgba(255, 255, 255, .6);
    background: rgba(255, 255, 255, .03);
}

#mpRoot .mp-line.active {
    color: #fff;
    font-weight: 600;
    transform: scale(1.05);
    background: rgba(255, 255, 255, .05);
}

#mpRoot .mp-line .ch {
    transition: color .15s;
}

#mpRoot .mp-line .ch.done {
    color: #9eeed3;
    text-shadow: 0 0 10px rgba(139, 124, 255, .5);
}

#mpRoot .mp-empty {
    text-align: center;
    color: #8f8fa3;
    font-size: 14px;
    padding: 50px 0;
}

/* ===== 进度条 ===== */
#mpRoot .mp-prog-area {
    grid-area: prog;
    align-self: end;
}

#mpRoot .mp-progress {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
    user-select: none;
}

#mpRoot .mp-rail {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, .15);
    border-radius: 99px;
}

#mpRoot .mp-buffer {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    border-radius: 99px;
    background: rgba(255, 255, 255, .1);
    transition: width .2s;
}

#mpRoot .mp-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    border-radius: 99px;
    background: #8decc8;
    /* 主色调改为纯紫 */
}

#mpRoot .mp-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%) scale(0);
    transition: transform .2s;
    box-shadow: 0 0 10px rgba(124, 255, 216, 0.8);
    z-index: 2;
}

#mpRoot .mp-progress:hover .mp-thumb,
#mpRoot .mp-progress.dragging .mp-thumb {
    transform: translate(-50%, -50%) scale(1);
}

@media (hover:none) {
    #mpRoot .mp-thumb {
        transform: translate(-50%, -50%) scale(1);
    }
}

#mpRoot .mp-time {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #8f8fa3;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
    padding: 0 2px;
    letter-spacing: .3px;
}

/* ===== 按钮 ===== */
#mpRoot .mp-controls {
    grid-area: ctrl;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

#mpRoot .mp-btn {
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .1);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all .2s;
}

#mpRoot .mp-btn:hover {
    background: rgba(255, 255, 255, .15);
}

#mpRoot .mp-btn:active {
    transform: scale(.9);
}

#mpRoot .mp-btn:disabled {
    opacity: .35;
    cursor: default;
}

#mpRoot .mp-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

#mpRoot .mp-btn-play {
    width: 66px;
    height: 66px;
    background: #a2eed575;
    border: none;
    box-shadow: 0 10px 25px -5px rgba(139, 124, 255, .5);
}

#mpRoot .mp-btn-play:hover {
    background: #5cb3a0;
}

#mpRoot .mp-btn-play svg {
    width: 26px;
    height: 26px;
}

#mpRoot .mp-btn-play .mp-icon-pause {
    display: none;
}

#mpRoot .mp-btn-play.playing .mp-icon-play {
    display: none;
}

#mpRoot .mp-btn-play.playing .mp-icon-pause {
    display: block;
}

/* ===== 响应式布局 ===== */
@media (min-width:761px) {
    #mpRoot .mp-card {
        grid-template-columns: 320px 1fr;
        grid-template-rows: auto auto 1fr auto;
        grid-template-areas: "art lyr" "meta lyr" "prog lyr" "ctrl lyr";
        gap: 0 40px;
        padding: 36px;
    }

    #mpRoot .mp-cover-wrap {
        width: min(260px, 30vmin);
    }

    #mpRoot .mp-lyrics {
        padding: 0 14px;
    }

    #mpRoot .mp-line {
        font-size: 16px;
        padding: 12px 14px;
    }

    #mpRoot .mp-meta {
        margin-top: 30px;
    }

    #mpRoot .mp-prog-area {
        margin-top: 8px;
    }

    #mpRoot .mp-controls {
        margin-top: 26px;
    }
}

@media (max-width:760px) {
    #mpRoot {
        padding: 12px;
    }

    #mpRoot .mp-card {
        width: 100%;
        height: min(640px, calc(100dvh - 24px));
        border-radius: 24px;
        padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
    }

    #mpRoot .mp-cover-wrap {
        width: min(180px, 26vmin);
    }

    #mpRoot .mp-line {
        font-size: 14px;
        padding: 9px 10px;
    }
}

@media (max-width:760px) and (max-height:700px) {
    #mpRoot .mp-card {
        height: calc(100dvh - 24px);
        padding: 18px 16px;
        gap: 12px;
    }

    #mpRoot .mp-cover-wrap {
        width: min(140px, 22vmin);
    }

    #mpRoot .mp-title {
        font-size: 18px;
    }

    #mpRoot .mp-btn-play {
        width: 58px;
        height: 58px;
    }

    #mpRoot .mp-btn {
        width: 44px;
        height: 44px;
    }
}

/* ===== 绝对生效的迷你播放器样式 ===== */
#mpRoot.mini-mode {
  position: fixed !important;
  inset: auto 20px 20px auto !important; /* 右下角 */
  z-index: 9999 !important;
  display: flex !important; 
  padding: 0 !important;
  pointer-events: none;
}

#mpRoot.mini-mode .mp-card {
  pointer-events: auto;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  width: 320px !important; /* 加宽到 320px，容下三个按钮和歌名 */
  height: auto !important;
  padding: 10px 16px !important;
  gap: 12px !important;
  border-radius: 99px !important;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.1) !important;
  background: #1a1a24 !important;
  /* 重置大卡片的 grid 布局 */
  grid-template-columns: unset !important;
  grid-template-rows: unset !important;
  grid-template-areas: unset !important;
  cursor: pointer;
}

/* 隐藏不需要的元素 */
#mpRoot.mini-mode .mp-lyrics,
#mpRoot.mini-mode .mp-prog-area {
  display: none !important;
}

/* 缩小封面 */
#mpRoot.mini-mode .mp-art { margin: 0 !important; flex-shrink: 0; }
#mpRoot.mini-mode .mp-cover-wrap { width: 42px !important; height: 42px !important; }
#mpRoot.mini-mode .mp-cover svg { width: 16px !important; height: 16px !important; }

/* 歌名自适应省略 */
#mpRoot.mini-mode .mp-meta {
  margin: 0 !important;
  text-align: left !important;
  flex: 1;
  min-width: 0; 
  overflow: hidden;
}
#mpRoot.mini-mode .mp-title { 
  font-size: 14px !important; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
}
#mpRoot.mini-mode .mp-artist { 
  font-size: 11px !important; 
  margin-top: 2px !important; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
}

/* 按钮紧凑排布 */
#mpRoot.mini-mode .mp-controls { 
  margin: 0 !important; 
  gap: 6px !important; 
  flex-shrink: 0; 
}

#mpRoot.mini-mode .mp-btn-play {
  width: 36px !important;
  height: 36px !important;
  box-shadow: none !important;
  order: 2; /* 播放键在中间 */
}
#mpRoot.mini-mode .mp-btn-play svg { width: 18px !important; height: 18px !important; }

/* 切歌按钮缩小并取消背景 */
#mpRoot.mini-mode #prevBtn,
#mpRoot.mini-mode #nextBtn {
  display: grid !important;
  width: 32px !important;
  height: 32px !important;
  background: transparent !important;
  border: none !important;
}
#mpRoot.mini-mode #prevBtn { order: 1; }
#mpRoot.mini-mode #nextBtn { order: 3; }

#mpRoot.mini-mode #prevBtn svg,
#mpRoot.mini-mode #nextBtn svg {
  width: 16px !important;
  height: 16px !important;
}