/* ============================================
   B2 音乐播放器 — player.css
   所有类名前缀 diy- 避免与 B2 主题冲突
   复刻原瓜奇迷你播放器（明亮模式，三端响应式）
   ============================================ */

/* ── CSS 变量 ── */
:root {
    --diy-gq-color: #31c27c;
    --diy-gq-color-light: #5ddb9e;
    --diy-gq-color-bg: rgba(49, 194, 124, 0.1);
    --diy-gq-color-hover: rgba(49, 194, 124, 0.18);
}

/* ── 根容器 ── */
.diy-gq-root {
    position: fixed;
    z-index: 99990;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* ============================================
   折叠态
   ============================================ */
.diy-gq-folded {
    display: flex;
    align-items: center;
    padding: 4px;
    gap: 4px;
}

.diy-gq-unfold-btn {
    width: 24px;
    height: 44px;
    border: none;
    background: transparent;
    color: rgba(0, 0, 0, 0.25);
    cursor: pointer;
    font-size: 14px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.diy-gq-unfold-btn:hover {
    color: var(--diy-gq-color);
    background: var(--diy-gq-color-bg);
}

.diy-gq-f-cover {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}
.diy-gq-f-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.diy-gq-f-cover img.diy-spin {
    animation: diyGqSpin 8s linear infinite;
}
.diy-gq-f-mask {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.2s;
    color: #fff;
    font-size: 18px;
    border-radius: 50%;
    pointer-events: none; /* 让点击穿透到父级 */
}
.diy-gq-f-cover:hover .diy-gq-f-mask {
    opacity: 1;
}

@keyframes diyGqSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   展开态
   ============================================ */
.diy-gq-player {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.diy-gq-root.diy-folded .diy-gq-player {
    border-radius: 10px;
    width: auto;
}

.diy-gq-root:not(.diy-folded) .diy-gq-player {
    width: 420px;
    border-radius: 10px;
}

/* 圆角联动 */
.diy-gq-root.diy-has-lyrics .diy-gq-player {
    border-radius: 0 0 10px 10px;
}
.diy-gq-root.diy-has-playlist .diy-gq-player {
    border-radius: 10px 10px 0 0;
}
.diy-gq-root.diy-has-lyrics.diy-has-playlist .diy-gq-player {
    border-radius: 0;
}

.diy-gq-expanded {
    padding: 10px 12px 8px;
}

.diy-gq-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.diy-gq-fold-btn {
    width: 18px;
    height: 44px;
    border: none;
    background: transparent;
    color: rgba(0, 0, 0, 0.25);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.diy-gq-fold-btn:hover {
    color: var(--diy-gq-color);
    background: var(--diy-gq-color-bg);
}

.diy-gq-cover {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}
.diy-gq-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.diy-gq-cover img.diy-spin {
    animation: diyGqSpin 8s linear infinite;
}
.diy-gq-cover-mask {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.2s;
    color: #fff;
    font-size: 16px;
    border-radius: 50%;
    pointer-events: none; /* 让点击穿透到父级 */
}
.diy-gq-cover:hover .diy-gq-cover-mask {
    opacity: 1;
}

.diy-gq-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.diy-gq-title {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── 控制按钮 ── */
.diy-gq-ctrls {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}
.diy-gq-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: rgba(0, 0, 0, 0.55);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.diy-gq-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}
.diy-gq-btn:active {
    transform: scale(0.92);
}
.diy-gq-btn.diy-play {
    width: 34px;
    height: 34px;
    background: var(--diy-gq-color-bg);
    color: var(--diy-gq-color);
    font-size: 17px;
}
.diy-gq-btn.diy-play:hover {
    background: var(--diy-gq-color-hover);
}
.diy-gq-btn.diy-sm {
    width: 26px;
    height: 26px;
    font-size: 13px;
    border-radius: 6px;
}
.diy-gq-btn.diy-on {
    color: var(--diy-gq-color);
    background: var(--diy-gq-color-bg);
}

.diy-gq-tools {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

/* ── 音量 ── */
.diy-gq-vol {
    display: flex;
    align-items: center;
    gap: 4px;
}
.diy-gq-vs {
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.1);
    cursor: pointer;
    position: relative;
}
.diy-gq-vf {
    height: 100%;
    border-radius: 2px;
    background: var(--diy-gq-color);
    transition: width 0.1s;
}

/* ── 进度条 ── */
.diy-gq-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.diy-gq-tl,
.diy-gq-tr {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.3);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
}
.diy-gq-tl { text-align: left; }
.diy-gq-tr { text-align: right; }

.diy-gq-progress {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.06);
    cursor: pointer;
    position: relative;
    transition: height 0.15s;
}
.diy-gq-progress:hover {
    height: 6px;
}
.diy-gq-p-track {
    height: 100%;
    position: relative;
}
.diy-gq-p-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--diy-gq-color), var(--diy-gq-color-light));
    position: relative;
    transition: width 0.1s linear;
    min-width: 0;
}
.diy-gq-p-dot {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 6px rgba(49, 194, 124, 0.5);
    opacity: 0;
    transition: opacity 0.2s;
}
.diy-gq-progress:hover .diy-gq-p-dot {
    opacity: 1;
}

/* ============================================
   歌词面板（展开态上方）
   ============================================ */
.diy-gq-lyrics {
    width: 420px;
    background: rgba(248, 248, 252, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    padding: 36px 0 10px;
    position: relative;
    overflow: hidden;
}
.diy-gq-lx {
    position: absolute;
    top: 6px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    font-size: 13px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}
.diy-gq-lx:hover {
    background: rgba(0, 0, 0, 0.12);
    color: rgba(0, 0, 0, 0.8);
}
.diy-gq-lwrap {
    position: relative;
    height: 66px;
    overflow: hidden;
}
.diy-gq-lbox {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 0 16px;
}
.diy-gq-ll {
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 0;
}
.diy-gq-ll.diy-p {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.18);
    line-height: 20px;
}
.diy-gq-ll.diy-n {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.18);
    line-height: 20px;
}
.diy-gq-ll.diy-c {
    font-size: 15px;
    color: var(--diy-gq-color);
    font-weight: 600;
    line-height: 24px;
}

/* 歌词滑动动画 — 使用 key 驱动的 Transition 效果 */
.diy-gq-lyric-slide {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.diy-gq-lyric-slide-enter {
    opacity: 0;
    transform: translateY(14px);
}
.diy-gq-lyric-slide-leave {
    opacity: 0;
    transform: translateY(-14px);
}

/* ============================================
   歌单抽屉（展开态下方）
   ============================================ */
.diy-gq-playlist {
    width: 420px;
    background: rgba(248, 248, 252, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-top: none;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}
.diy-gq-phd {
    padding: 10px 14px;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.diy-gq-pl-scroll {
    max-height: 200px;
    overflow-y: auto;
}
.diy-gq-pi {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.diy-gq-pi:hover {
    background: rgba(0, 0, 0, 0.04);
}
.diy-gq-pi.diy-cur {
    background: var(--diy-gq-color-bg);
}
.diy-gq-pi.diy-cur .diy-gqt {
    color: var(--diy-gq-color);
}
.diy-gq-pi.diy-cur .diy-pn {
    color: var(--diy-gq-color);
}
.diy-pn {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.25);
    text-align: center;
}
.diy-gqt {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.diy-pic {
    color: var(--diy-gq-color);
    font-size: 14px;
    text-align: right;
}

/* ============================================
   Toast 提示
   ============================================ */
.diy-gq-toast {
    position: absolute;
    right: 0;
    bottom: 100%;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s, transform 0.3s;
}
.diy-gq-toast.diy-has-lyrics {
    bottom: calc(100% + 44px);
}

/* ============================================
   浮动歌词弹窗（折叠态+歌词显示）
   ============================================ */
.diy-gq-lyric-pop {
    position: absolute;
    right: 0;
    bottom: 100%;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 6px 14px;
    min-width: 60px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: opacity 0.3s;
}
.diy-gq-lyric-txt {
    font-size: 13px;
    color: var(--diy-gq-color);
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    transition: all 0.3s ease;
}

/* ============================================
   过渡动画
   ============================================ */
.diy-gq-drawer-up-enter-active,
.diy-gq-drawer-up-leave-active {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 300px;
    overflow: hidden;
}
.diy-gq-drawer-up-enter-from,
.diy-gq-drawer-up-leave-to {
    max-height: 0;
    opacity: 0;
    transform: translateY(12px);
}

.diy-gq-drawer-down-enter-active,
.diy-gq-drawer-down-leave-active {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 300px;
    overflow: hidden;
}
.diy-gq-drawer-down-enter-from,
.diy-gq-drawer-down-leave-to {
    max-height: 0;
    opacity: 0;
    transform: translateY(-12px);
}

/* ============================================
   手机端 — 展开态（底部全宽栏）
   ============================================ */
.diy-gq-m-root {
    position: fixed;
    z-index: 99990;
    left: 0;
    right: 0;
    bottom: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column-reverse;
}

.diy-gq-m-toast {
    position: absolute;
    left: 50%;
    bottom: 68px;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.94);
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* 歌词面板（手机折叠态-浮动歌词，展开态无歌词面板） */
.diy-gq-m-lyrics {
    padding: 8px 16px;
    text-align: center;
    background: rgba(248, 248, 252, 0.96);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}
.diy-gq-m-lyrics-x {
    position: absolute;
    right: 12px;
    top: 6px;
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.4);
    font-size: 14px;
    cursor: pointer;
}
.diy-gq-m-l {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.diy-gq-m-l.diy-p,
.diy-gq-m-l.diy-n {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.18);
    line-height: 18px;
}
.diy-gq-m-l.diy-c {
    font-size: 14px;
    color: var(--diy-gq-color);
    font-weight: 600;
    line-height: 22px;
}

/* 歌单抽屉（手机端） */
.diy-gq-m-pl {
    max-height: 220px;
    overflow-y: auto;
    background: rgba(248, 248, 252, 0.96);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.diy-gq-m-pl-hd {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.4);
}
.diy-gq-m-pl-hd button {
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.5);
    font-size: 14px;
    cursor: pointer;
}
.diy-gq-m-pl-items {
    padding: 4px 0;
}
.diy-gq-m-pl-it {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
}
.diy-gq-m-pl-it.diy-cur {
    background: var(--diy-gq-color-bg);
}
.diy-gq-m-pl-it.diy-cur .diy-t {
    color: var(--diy-gq-color);
}
.diy-gq-m-pl-it .diy-n {
    width: 18px;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.25);
    text-align: center;
    flex-shrink: 0;
}
.diy-gq-m-pl-it .diy-t {
    flex: 1;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 底部控制栏（手机展开态） */
.diy-gq-m-bar {
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 8px 12px 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.diy-gq-m-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.diy-gq-m-cov {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.diy-gq-m-cov img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.diy-gq-m-cov img.diy-spin {
    animation: diyGqSpin 8s linear infinite;
}
.diy-gq-m-mid {
    flex: 1;
    min-width: 0;
}
.diy-gq-m-tt {
    font-size: 14px;
    color: #222;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.diy-gq-m-prog {
    cursor: pointer;
    margin-top: 4px;
}
.diy-gq-m-prog-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.diy-gq-m-tl,
.diy-gq-m-tr {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.3);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.diy-gq-m-pb {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.06);
}
.diy-gq-m-pf {
    height: 100%;
    border-radius: 3px;
    background: var(--diy-gq-color);
}
.diy-gq-m-play {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--diy-gq-color-bg);
    color: var(--diy-gq-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.diy-gq-m-bot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 6px;
}
.diy-gq-m-bot button {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.diy-gq-m-bot button.diy-on {
    color: var(--diy-gq-color);
    background: var(--diy-gq-color-bg);
}
.diy-gq-m-bot button.diy-m {
    font-size: 12px;
    width: 32px;
}

/* 手机端过渡动画 */
.diy-gq-m-drawer-enter-active,
.diy-gq-m-drawer-leave-active {
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 240px;
    overflow: hidden;
}
.diy-gq-m-drawer-enter-from,
.diy-gq-m-drawer-leave-to {
    max-height: 0;
    opacity: 0;
}

/* ============================================
   响应式断点
   ============================================ */

/* 平板端 (768-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .diy-gq-root {
        right: 12px;
        bottom: 12px;
    }
    .diy-gq-root:not(.diy-folded) .diy-gq-player {
        width: 360px;
    }
    .diy-gq-lyrics {
        width: 360px;
    }
    .diy-gq-playlist {
        width: 360px;
    }
}

/* 手机端 (<768px) */
@media (max-width: 767px) {
    .diy-gq-root {
        right: 8px;
        bottom: 8px;
    }
    /* 桌面播放器折叠态在手机上保留，展开态隐藏（由手机端接管） */
    .diy-gq-root:not(.diy-folded) {
        display: none;
    }
    /* 手机端展开态显示 */
    .diy-gq-m-root.diy-expanded {
        display: flex;
    }
    .diy-gq-m-root:not(.diy-expanded) {
        display: none;
    }
    /* 浮动歌词弹窗手机端缩小字体 */
    .diy-gq-lyric-txt {
        font-size: 11px;
    }
}

/* 桌面端和平板隐藏手机端 */
@media (min-width: 768px) {
    .diy-gq-m-root {
        display: none !important;
    }
}

/* ============================================
   空歌单提示
   ============================================ */
.diy-gq-empty {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.35);
    white-space: nowrap;
}
.diy-gq-empty .diy-gq-empty-icon {
    font-size: 24px;
    margin-bottom: 6px;
}
