:root {
    --glass-bg: rgba(10, 10, 12, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.5);
    --accent: #ffffff;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, ui-monospace;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", sans-serif;
    color: var(--text-main);
    background: #000;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 沉浸式环境光背景 */
#ambient-bg {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    object-fit: cover;
    filter: blur(70px) saturate(200%) brightness(0.4);
    z-index: -1;
    transform: scale(1.05);
}

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
}

.mobile-nav {
    display: none;
}

/* ================= 左侧：无界侧边栏 ================= */
.sidebar {
    width: 380px;
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.header {
    padding: 35px 30px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s ease;
}

.btn-icon:hover {
    background: var(--text-main);
    color: #000;
    border-color: transparent;
}

.search-box {
    display: flex;
    padding: 0 30px 25px;
    gap: 10px;
}

.search-box input {
    flex: 1;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    background: transparent;
    font-size: 14px;
    color: var(--text-main);
    outline: none;
    transition: 0.3s;
    font-family: monospace;
    letter-spacing: 1px;
}

.search-box input:focus {
    border-bottom-color: var(--text-main);
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.3s;
    padding: 0 5px;
}

.btn-text:hover {
    color: var(--text-main);
}

.track-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0 10px 20px;
    scroll-behavior: smooth;
}

.track-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    border-left: 2px solid transparent;
    margin-bottom: 2px;
}

.track-item:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
}

.track-item.active {
    border-left-color: var(--text-main);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
}

.track-item img {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
    opacity: 0.8;
    transition: 0.3s;
}

.track-item.active img {
    opacity: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.track-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.track-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    color: var(--text-main);
}

.track-artist {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 5px;
    font-weight: 400;
}

/* ================= 右侧：主体容器 ================= */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ---- 播放器视图 ---- */
#view-player {
    display: flex;
    flex-direction: column;
    height: 100%;
    animation: fadeIn 0.8s ease forwards;
    min-height: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* 中部弹性区域 */
.player-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* 桌面端：顶部悬浮控制区 */
.player-top {
    display: flex;
    padding: 40px 60px;
    /* 纵向内边距从 50px 缩减到 40px，整体更轻盈 */
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
    gap: 10px;
}

/* 歌曲元数据（封面+信息）容器 */
.player-info-meta {
    display: flex;
    align-items: center;
    /* 居中对齐封面和文字，使画面更舒展平衡 */
    gap: 30px;
    /* 调整封面和文字之间的间距 */
    flex-shrink: 0;
}

.cover-wrap {
    position: relative;
    perspective: 1000px;
}

#cover {
    width: 180px;
    /* 桌面端缩减到 180px，为中部文字腾出呼吸感 */
    height: 180px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

#track-name-large {
    font-size: 38px;
    /* 桌面端调整为 38px，解决字号过大对视线的压迫感 */
    font-weight: 800;
    margin: 0 0 6px 0;
    /* 移除左缩进，对齐封面边缘 */
    letter-spacing: -1px;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

#track-artist-large {
    font-size: 16px;
    /* 桌面端微调为 16px */
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    letter-spacing: -0.2px;
    margin: 0;
}

/* 淡淡的分隔线 */
.desktop-divider {
    width: 1px;
    height: 60px;
    /* 高度缩减到 60px 更加精致 */
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.15), transparent);
    flex-shrink: 0;
    margin: 0 40px;
    /* 边距拉大到 40px，彻底拉开呼吸感，阻断粘连 */
}

/* 频谱图容器 */
.spectrum-wrap {
    flex: 1;
    height: 120px;
    position: relative;
    min-width: 0;
}

#spectrum-canvas {
    height: 100%;
    display: block;
    pointer-events: none;
    /* 触摸点击穿透 */
}

/* ---- 歌词区域 ---- */
.lyrics-area {
    flex: 1;
    padding: 40px 60px 80px;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 10%, #000 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 10%, #000 80%, transparent 100%);
}

.lyrics-area::before,
.lyrics-area::after {
    content: '';
    display: block;
    height: 40vh;
}

.lrc-line {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.25);
    font-weight: 500;
    margin: 28px 0;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    line-height: 1.5;
    transform-origin: left center;
}

.lrc-line.active {
    color: var(--text-main);
    font-size: 28px;
    font-weight: 700;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    transform: translateY(-2px);
}

/* 控制区 */
.controls-area {
    padding: 0 60px;
    margin-top: -20px;
    z-index: 20;
    position: relative;
}

.progress-wrap {
    height: 20px;
    display: flex;
    align-items: center;
    width: 100%;
    cursor: pointer;
    margin-bottom: 15px;
}

.progress-track {
    height: 2px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    transition: height 0.2s;
    border-radius: 2px;
}

.progress-wrap:hover .progress-track {
    height: 4px;
}

.progress-bar {
    height: 100%;
    background: var(--text-main);
    width: 0%;
    pointer-events: none;
    transition: width 0.1s linear;
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: monospace;
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.btn-group {
    display: flex;
    gap: 30px;
    align-items: center;
}

.btn-group button {
    background: none;
    border: none;
    color: var(--text-main);
    opacity: 0.7;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-group button:hover {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
}

.btn-group button:active {
    transform: scale(0.95);
}

#btn-play svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- 设置视图 ---- */
#view-settings {
    display: none;
    padding: 60px;
    min-height: 100%;
    background: var(--glass-bg);
    animation: fadeIn 0.4s ease forwards;
    overflow-y: auto;
}

.settings-card {
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 40px;
    margin-bottom: 40px;
}

.settings-card h2 {
    margin-top: 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    margin-bottom: 30px;
}

.settings-row {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-row label {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
}

input[type="text"] {
    padding: 15px 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    font-size: 16px;
    outline: none;
    transition: 0.3s;
    width: 100%;
    max-width: 400px;
    color: #fff;
    font-family: monospace;
}

input[type="text"]:focus {
    border-bottom-color: #fff;
}

.btn-outline {
    border: 1px solid var(--text-dim);
    background: transparent;
    color: var(--text-main);
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.3s;
    width: max-content;
    border-radius: 2px;
}

.btn-outline:hover {
    background: var(--text-main);
    color: #000;
}

textarea.code-box {
    width: 100%;
    height: 100px;
    padding: 15px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    font-family: monospace;
    font-size: 12px;
    resize: none;
    outline: none;
    color: var(--text-dim);
    line-height: 1.5;
    border-radius: 4px;
}

/* 滑动条样式 */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    border-radius: 50%;
    background: var(--text-main);
    cursor: pointer;
    margin-top: -4.5px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* 预设按钮 */
.btn-preset {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.3s;
}

.btn-preset:hover,
.btn-preset.active {
    border-color: var(--text-main);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* ================= 移动端适配 ================= */
@media (max-width: 950px) {

    #desk-setting-btn {
        display: none !important;
    }

    .layout {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    .mobile-nav {
        display: flex;
        height: 60px;
        min-height: 60px;
        order: 3;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--glass-border);
        position: relative;
        z-index: 100;
    }

    .mobile-nav button {
        flex: 1;
        height: 100%;
        border: none;
        background: transparent;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 1px;
        color: var(--text-dim);
        cursor: pointer;
        transition: 0.3s;
        text-transform: uppercase;
    }

    .mobile-nav button.active {
        color: var(--text-main);
        box-shadow: inset 0 2px 0 var(--text-main);
    }

    body.tab-list .main {
        display: none !important;
    }

    body.tab-player .sidebar {
        display: none !important;
    }

    body.tab-player #view-settings {
        display: none !important;
    }

    body.tab-settings .sidebar {
        display: none !important;
    }

    body.tab-settings #view-player {
        display: none !important;
    }

    body.tab-settings #view-settings {
        display: block !important;
    }

    .sidebar {
        width: 100%;
        background: transparent;
        border: none;
        flex: 1;
        overflow-y: auto;
        order: 1;
    }

    .main {
        width: 100%;
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        order: 2;
    }

    #view-player {
        flex: 1;
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow: hidden;
    }

    .player-content-area {
        flex: 1 1 auto;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 100%;
        min-height: 0;
        overflow: hidden;
    }

    /* 移动端顶部：歌曲信息垂直紧凑排版 */
    .player-top {
        position: relative;
        flex: 0 0 auto;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0 30px;
        border: none;
        text-align: center;
        gap: 15px;
        /* 收紧间距防止太散 */
        transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2;
        pointer-events: auto;
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0px);
    }

    .player-info-meta {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        text-align: center;
        width: 100%;
    }

    .desktop-divider {
        display: none;
        /* 移动端隐藏横向分隔线 */
    }

    /* 移动端频谱容器：接替原本按钮，填补空白 */
    .spectrum-wrap {
        width: 100%;
        height: 60px;
        margin-top: 5px;
    }

    .info {
        align-items: center;
        padding-bottom: 0;
    }

    .lyrics-area {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        padding: 0 30px;
        overflow-y: auto;
        transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 3;
        pointer-events: none;
        opacity: 0;
        transform: scale(0.9) translateY(20px);
        filter: blur(10px);
    }

    /* ==== 切换动效触发 ==== */
    #view-player.show-lyrics .player-top {
        opacity: 0;
        transform: scale(1.1) translateY(-20px);
        pointer-events: none;
        filter: blur(20px);
    }

    #view-player.show-lyrics .lyrics-area {
        opacity: 1;
        transform: scale(1) translateY(0);
        pointer-events: auto;
        filter: blur(0px);
    }

    /* 控制栏层 */
    .controls-area {
        flex-shrink: 0;
        padding: 0 30px 30px;
        margin-top: 0;
        z-index: 10;
        position: relative;
    }

    #cover {
        width: 220px;
        /* 移动端封面需要稍微大点，保证视觉主体 */
        height: 220px;
    }

    #track-name-large {
        font-size: 28px;
        white-space: normal;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        text-align: center;
        margin: 0 0 8px 0;
    }

    #track-artist-large {
        font-size: 16px;
        text-align: center;
    }

    .lrc-line {
        font-size: 16px;
        transform-origin: center center;
        margin: 20px 0;
    }

    .lrc-line.active {
        font-size: 22px;
    }

    .lyrics-area::before,
    .lyrics-area::after {
        height: 50vh;
    }

    #view-settings {
        padding: 30px;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
}

/* 横屏移动端 */
@media (max-width: 950px) and (orientation: landscape) {
    .mobile-nav {
        height: 50px;
        min-height: 50px;
    }

    .player-top {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 20px 30px;
        gap: 20px;
    }

    .player-info-meta {
        flex-direction: row;
        align-items: center;
        gap: 20px;
        text-align: left;
        width: auto;
    }

    .info {
        align-items: flex-start;
    }

    #cover {
        width: 100px;
        height: 100px;
    }

    #track-name-large {
        font-size: 24px;
        margin-bottom: 4px;
        text-align: left;
    }

    #track-artist-large {
        text-align: left;
    }

    .spectrum-wrap {
        width: 180px;
        /* 横屏横向紧凑化 */
        height: 50px;
        margin-top: 0;
    }

    .lyrics-area {
        text-align: left;
        padding: 10px 30px 20px;
    }

    .lrc-line {
        transform-origin: left center;
    }

    .lyrics-area::before,
    .lyrics-area::after {
        height: 30vh;
    }
}

/* ================= 嵌入模式 (iframe) ================= */
body.is-embed .sidebar,
body.is-embed .mobile-nav,
body.is-embed .search-box {
    display: none !important;
}

body.is-embed .layout {
    display: block;
    overflow: hidden;
    background: transparent;
}

body.is-embed .main {
    width: 100%;
    height: 100vh;
    display: flex !important;
    flex-direction: column;
}

body.is-embed #view-settings {
    display: none !important;
}

body.is-embed .player-top {
    padding: 25px 30px 20px;
    gap: 25px;
    border-bottom: none;
    align-items: center;
}

body.is-embed #cover {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

body.is-embed #track-name-large {
    font-size: 24px;
    text-shadow: none;
}

body.is-embed #track-artist-large {
    font-size: 14px;
}

body.is-embed .controls-area {
    padding: 0 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
    margin-top: 0;
}

body.is-embed .player-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

body.is-embed .lyrics-area {
    padding: 20px 30px;
    flex: 1;
}

body.is-embed .lrc-line {
    font-size: 15px;
    margin: 18px 0;
}

body.is-embed .lrc-line.active {
    font-size: 20px;
}

/* 嵌入端隐藏无关元素并对齐 meta */
body.is-embed .desktop-divider,
body.is-embed .spectrum-wrap {
    display: none !important;
}

body.is-embed .player-info-meta {
    width: 100%;
    align-items: center;
    gap: 25px;
}