/* ============================================================
   dynamic-backgrounds.css
   动态背景引擎样式（登录页 + 播放页共用）+ 登录页动效选择器
   ============================================================ */

/* ── 登录页动效选择器（与播放器设置页 lm-select 风格一致） ── */
.background-picker {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 14px;
    border: 1px solid #ffffff26;
    border-radius: 9999px;
    background: #121826bf;
    color: #e2e8f0;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 24px -4px #00000080, inset 0 1px 0 #ffffff26;
    font-size: 12px;
    font-weight: 600;
}

.background-picker > i { color: #10b981; font-size: 12px; }

.bg-picker-select {
    appearance: none;
    min-width: 128px;
    padding: 6px 30px 6px 12px;
    border: 1.5px solid #10b981;
    border-radius: 9999px;
    background-color: #10b981;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23ffffff'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
    cursor: pointer;
    outline: none;
    box-shadow: 0 2px 8px #10b98166;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.bg-picker-select:hover { background-color: #059669; border-color: #059669; }

.bg-picker-select:focus-visible { box-shadow: 0 0 0 3px #10b98140; }

.bg-picker-select option { background: #1f2937; color: #e5e7eb; font-weight: 500; }

.theme-light .background-picker {
    background: #ffffffd9;
    color: #334155;
    border-color: #cbd5e1cc;
    box-shadow: 0 8px 20px -4px #10b98126, inset 0 1px 0 #fff;
}

.theme-light .bg-picker-select option { background: #fff; color: #334155; }

/* ── 登录页宿主 ── */
#login-scene { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }

html:not([data-login-background="aurora"]) .bg-grid-mask,
html:not([data-login-background="aurora"]) #cursor-glow { display: none; }

/* ── 播放页宿主 ── */
#player-dynamic-scene { overflow: hidden; }

/* ── 引擎图层 ── */
.dbg-layer,
.dbg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.dbg-layer[data-mode="cosmos"] {
    background:
        radial-gradient(ellipse at 20% 30%, #6639b840, transparent 55%),
        radial-gradient(ellipse at 80% 80%, #087ea444, transparent 60%);
}

.dbg-layer[data-mode="bubbles"] { background: radial-gradient(ellipse at bottom, #0891b220, transparent 70%); }
.dbg-layer[data-mode="sakura"] { background: radial-gradient(ellipse at top right, #f472b61a, transparent 60%); }
.dbg-layer[data-mode="fireflies"] { background: radial-gradient(ellipse at bottom, #65a30d1a, transparent 65%); }

/* 极光光斑 */
.dbg-blob {
    position: absolute;
    aspect-ratio: 1;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    mix-blend-mode: screen;
    animation: dbg-aurora 18s ease-in-out infinite alternate;
}

.dbg-light .dbg-blob { opacity: 0.4; mix-blend-mode: normal; }

.dbg-blob-1 {
    width: min(520px, 70%);
    top: -10%;
    left: -5%;
    background: radial-gradient(circle, #059669 0%, #10b98166 50%, transparent 70%);
    animation-duration: 20s;
}

.dbg-blob-2 {
    width: min(580px, 75%);
    bottom: -15%;
    right: -10%;
    background: radial-gradient(circle, #0284c7 0%, #06b6d466 50%, transparent 70%);
    animation-duration: 24s;
    animation-delay: -5s;
}

.dbg-blob-3 {
    width: min(420px, 60%);
    top: 45%;
    left: 35%;
    background: radial-gradient(circle, #6366f1 0%, #6366f14d 50%, transparent 70%);
    animation-duration: 16s;
    animation-delay: -9s;
}

/* 漫游图标 / 泡泡 */
.dbg-item {
    position: absolute;
    color: #67e8f9;
    opacity: 0.26;
    animation: dbg-drift var(--duration) ease-in-out infinite alternate;
    animation-delay: var(--delay);
}

.dbg-light .dbg-item { color: #047857; }

.dbg-icon {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentcolor;
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dbg-bubble {
    border-radius: 50%;
    border: 1px solid #a5f3fc55;
    background:
        radial-gradient(circle at 28% 24%, #fff5, transparent 22%),
        radial-gradient(circle at 70% 80%, #a78bfa33, #22d3ee09 65%);
    box-shadow: inset -4px -6px 18px #22d3ee22;
    opacity: 0.7;
}

.dbg-light .dbg-bubble { border-color: #0891b244; }

/* 音符升腾 */
.dbg-note {
    position: absolute;
    bottom: -60px;
    color: #6ee7b7;
    opacity: 0;
    filter: drop-shadow(0 0 6px #10b98166);
    animation: dbg-rise var(--duration) cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: var(--delay);
}

.dbg-light .dbg-note { color: #059669; }

/* 流动波纹 */
.dbg-wave {
    position: absolute;
    width: 150%;
    height: 75%;
    left: -25%;
    bottom: -50%;
    border-radius: 43%;
    border: 1px solid #67e8f944;
    background: linear-gradient(140deg, #10b98128, #6366f122);
    animation: dbg-spin 28s linear infinite;
}

.dbg-wave:nth-child(2) { bottom: -45%; animation-duration: 37s; animation-direction: reverse; }
.dbg-wave:nth-child(3) { bottom: -40%; animation-duration: 46s; opacity: 0.5; }

@keyframes dbg-aurora {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    50% { transform: translate(50px, 40px) scale(1.1) rotate(45deg); }
    100% { transform: translate(-30px, -20px) scale(0.95) rotate(-30deg); }
}

@keyframes dbg-drift {
    from { transform: translate3d(-12px, 35px, 0) rotate(-12deg); }
    to { transform: translate3d(22px, -65px, 0) rotate(18deg); }
}

@keyframes dbg-rise {
    0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(0.6); opacity: 0; }
    15% { opacity: 0.8; }
    50% { transform: translate3d(var(--sway), -55vh, 0) rotate(160deg) scale(1); }
    85% { opacity: 0.6; }
    100% { transform: translate3d(0, -110vh, 0) rotate(340deg) scale(1.15); opacity: 0; }
}

@keyframes dbg-spin { to { transform: rotate(360deg); } }

/* 页面隐藏 / 容器不可见时暂停 CSS 动画 */
.dbg-paused * { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
    .dbg-layer *,
    body:has(#login-scene) .logo-glow::after { animation: none !important; }

    .dbg-note { opacity: 0.5; bottom: auto; top: 40%; }
    #cursor-glow { display: none; }
}

/* ── 小屏适配 ── */
@media (max-width: 600px) {
    .background-picker { top: 16px; right: 12px; padding: 4px 4px 4px 10px; gap: 6px; }
    .background-picker > span { display: none; }
    .bg-picker-select { min-width: 110px; }
    body:has(#login-scene) .theme-toggle-btn { top: 16px; left: 12px; }
    .dbg-blob { filter: blur(45px); }
}

/* 仅登录页：矮屏允许滚动 */
@media (max-height: 760px) {
    body:has(#login-scene) { overflow-y: auto; padding-top: 88px; padding-bottom: 30px; }
}

/* ── 播放页明亮模式视觉适配 ── */
#view-player-detail.detail-light-mode #btn-toggle-lyrics {
    background-color: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.08);
    color: #475569;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

#view-player-detail.detail-light-mode #btn-toggle-lyrics:hover {
    background-color: #fff;
    color: #059669;
}

#view-player-detail.detail-light-mode #now-playing-header h2 {
    color: #64748b;
}

#view-player-detail.detail-light-mode #mobile-player-cover-container {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.15);
}