/* ===== 主题变量 ===== */
:root {
    /* 亮色主题（默认） */
    --bg-primary: #f0f2f5;
    --bg-card: rgba(255, 255, 255, 0.5);
    --bg-nav: rgba(255, 255, 255, 0.7);
    --text-main: #1a1a2e;
    --text-dim: rgba(0, 0, 0, 0.5);
    --glass-bg: rgba(255, 255, 255, 0.5);
    --glass-border: rgba(0, 0, 0, 0.12);
    --shadow: rgba(0, 0, 0, 0.06);
    --shadow-hover: rgba(0, 0, 0, 0.12);
    --card-hover: rgba(255, 255, 255, 0.7);
    --primary: #5e5ce6;
    --success: #30d158;
    --warning: #ff9f0a;
    --error: #ff453a;
    --nav-height: 60px;
    --gradient-start: #1a1a2e;
    --gradient-end: rgba(26, 26, 46, 0.4);
    --scrollbar-bg: rgba(0, 0, 0, 0.08);
    --scrollbar-thumb: rgba(0, 0, 0, 0.2);
}

/* 暗色主题 */
[data-theme="dark"] {
    --bg-primary: #0d0d12;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-nav: rgba(255, 255, 255, 0.05);
    --text-main: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.6);
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.10);
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-hover: rgba(0, 0, 0, 0.7);
    --card-hover: rgba(255, 255, 255, 0.08);
    --gradient-start: #ffffff;
    --gradient-end: rgba(255, 255, 255, 0.3);
    --scrollbar-bg: rgba(255, 255, 255, 0.05);
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
}

html { 
    scroll-behavior: smooth; 
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-bg); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

body {
    font-family: -apple-system, 'SF Pro Display', 'Noto Sans SC', sans-serif;
    background: var(--bg-primary);
    margin: 0; padding: 20px;
    background-image: 
        radial-gradient(at 0% 0%, rgba(94, 92, 230, 0.10) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.10) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(31, 41, 55, 0.03) 0px, transparent 80%);
    min-height: 100vh;
    color: var(--text-main);
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.3s ease;
}

/* ===== 导航栏 ===== */
.nav-tabs-wrapper {
    position: sticky;
    top: 20px;
    margin: 0 auto 30px auto;
    width: calc(100% - 40px);
    max-width: 360px;
    background: var(--bg-nav);
    border: 1px solid var(--glass-border);
    border-top: 1.5px solid rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 28px;
    z-index: 1000;
    box-shadow: 
        0 20px 40px var(--shadow),
        inset 0 8px 16px rgba(255, 255, 255, 0.25), 
        inset 0 -4px 10px rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.15, 0, 0.15, 1);
    isolation: isolate;
}
.nav-tabs-wrapper::before {
    content: ""; position: absolute; inset: 0; z-index: -2;
    backdrop-filter: blur(20px) saturate(180%) brightness(1.1);
    -webkit-backdrop-filter: blur(20px) saturate(180%) brightness(1.1);
    border-radius: inherit;
}
.nav-tabs-wrapper::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: 
        radial-gradient(130% 75% at 50% 0%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 45%);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.85),
        inset 1px 0 1px rgba(255, 255, 255, 0.25),
        inset -1px 0 1px rgba(255, 255, 255, 0.25);
    border-radius: inherit;
    pointer-events: none;
}

.nav-header {
    padding: 18px 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
    user-select: none;
}
.nav-header .icon {
    transition: transform 0.4s cubic-bezier(0.15, 0, 0.15, 1);
    font-size: 0.75rem;
    opacity: 0.7;
}
.nav-tabs-wrapper.expanded .nav-header .icon {
    transform: rotate(180deg);
}

.nav-content-grid {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.15, 0, 0.15, 1);
}
.nav-tabs-wrapper.expanded .nav-content-grid {
    grid-template-rows: 1fr;
}
.nav-content {
    overflow: hidden;
}
.nav-content-inner {
    padding: 0 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    padding: 14px 20px;
    border-radius: 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    background: var(--bg-card);
    text-align: left;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.1);
}
.nav-item:hover { 
    color: var(--text-main); 
    background: var(--card-hover); 
    border-color: var(--glass-border); 
    box-shadow: inset 1px 1px 4px rgba(255, 255, 255, 0.4);
    transform: scale(0.98);
}

/* ===== 左上角导航栏 ===== */
.nav-sidebar {
    position: fixed;
    left: 20px;
    top: 20px;  /* 改成 top: 20px，不要 50% */
    /* 删掉 transform: translateY(-50%) */
    z-index: 999;
    width: 180px;
    background: var(--bg-nav);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 20px 40px var(--shadow);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    transition: all 0.4s cubic-bezier(0.15, 0, 0.15, 1);
    overflow: hidden;
    max-height: 90vh;
}

.nav-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: 
        radial-gradient(130% 75% at 50% 0%, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 45%);
    border-radius: inherit;
    pointer-events: none;
}

.nav-sidebar .nav-header {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.9rem;
    user-select: none;
    border-bottom: 1px solid var(--glass-border);
}

.nav-sidebar .nav-header .icon {
    transition: transform 0.4s cubic-bezier(0.15, 0, 0.15, 1);
    font-size: 0.7rem;
    opacity: 0.7;
}

.nav-sidebar.expanded .nav-header .icon {
    transform: rotate(180deg);
}

.nav-sidebar .nav-content-grid {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.15, 0, 0.15, 1);
}

.nav-sidebar.expanded .nav-content-grid {
    grid-template-rows: 1fr;
}

.nav-sidebar .nav-content {
    overflow: hidden;
}

.nav-sidebar .nav-content-inner {
    padding: 8px 12px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-sidebar .nav-item {
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-sidebar .nav-item .nav-icon {
    font-size: 1rem;
    opacity: 0.7;
}

.nav-sidebar .nav-item:hover {
    background: var(--card-hover);
    border-color: var(--glass-border);
    transform: translateX(4px);
}

/* ===== 容器 ===== */
.container { 
    max-width: 900px; 
    margin: 0 auto; 
    padding: 0 20px;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    .nav-sidebar {
        left: 12px;
        top: 12px;
        width: 160px;
    }
    .nav-sidebar .nav-header {
        padding: 12px 16px;
        font-size: 0.8rem;
    }
    .nav-sidebar .nav-item {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    .nav-sidebar .nav-item .nav-icon {
        font-size: 0.85rem;
    }
    .container {
        margin-left: 80px;
        padding: 0 16px;
    }
    .main-title {
        font-size: 2rem;
        margin-top: 30px;
    }
}

@media (max-width: 480px) {
    .nav-sidebar {
        left: 50%;
        top: auto;
        bottom: 20px;
        transform: translateX(-50%);
        width: calc(100% - 40px);
        max-width: 320px;
        border-radius: 16px;
        max-height: 60vh;
    }
    .nav-sidebar .nav-content-inner {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 8px;
    }
    .nav-sidebar .nav-item {
        padding: 8px 12px;
        font-size: 0.7rem;
        flex: 1;
        min-width: 60px;
        justify-content: center;
    }
    .nav-sidebar .nav-item .nav-icon {
        font-size: 0.8rem;
    }
    .container {
        margin-left: 0;
        padding: 0 12px;
    }
    .main-title {
        font-size: 1.6rem;
        margin-top: 20px;
    }
    .subtitle {
        font-size: 0.7rem;
        margin-bottom: 30px;
    }
}

/* ===== 右上角独立主题切换 ===== */
.theme-toggle-float {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    background: var(--bg-nav);
    border-radius: 100px;
    padding: 4px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 8px 24px var(--shadow);
    z-index: 1001;
    transition: all 0.3s ease;
}

.theme-toggle-float button {
    background: transparent;
    border: none;
    padding: 8px 14px;
    border-radius: 100px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-dim);
    line-height: 1;
}

.theme-toggle-float button.active {
    background: var(--card-hover);
    color: var(--text-main);
    box-shadow: 0 2px 12px var(--shadow);
}

.theme-toggle-float button:hover {
    transform: scale(1.08);
}

.theme-toggle-float button:active {
    transform: scale(0.92);
}

/* 暗色模式下微调 */
[data-theme="dark"] .theme-toggle-float {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.10);
}

[data-theme="dark"] .theme-toggle-float button.active {
    background: rgba(255, 255, 255, 0.12);
}

/* 移动端适配 */
@media (max-width: 640px) {
    .theme-toggle-float {
        top: 12px;
        right: 12px;
        padding: 3px;
    }
    .theme-toggle-float button {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}


.main-title {
    text-align: center;
    margin: 40px 0 10px;
    font-size: 3.2rem;
    font-weight: 700;
    font-family: 'STXingkai', '华文行楷', 'Xingkai SC', cursive;
    background: linear-gradient(135deg, #1a1a2e 0%, #5e5ce6 40%, #a855f7 70%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 6px;
    filter: drop-shadow(0 4px 20px rgba(94, 92, 230, 0.12));
}

.subtitle { 
    text-align: center; 
    color: var(--text-dim); 
    margin-bottom: 50px; 
    font-size: 0.85rem; 
    letter-spacing: 2px; 
}

/* ===== 响应式适配 ===== */
@media (max-width: 768px) {
    .container {
        padding-left: 180px;
        padding-right: 16px;
    }
    .main-title {
        font-size: 2rem;
        margin-top: 30px;
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
    .main-title {
        font-size: 1.6rem;
        margin-top: 20px;
    }
    .subtitle {
        font-size: 0.7rem;
        margin-bottom: 30px;
    }
}

/* ===== 区块标题 ===== */
.section-header {
    display: flex;
    justify-content: space-between; align-items: center;
    margin: 60px 0 20px 10px; 
    scroll-margin-top: 80px; 
}
.section-title { display: flex; flex-direction: column; gap: 2px; }
.section-title .zh { font-size: 1.1rem; font-weight: 700; color: var(--text-main); }
.section-title .en { font-size: 0.65rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }

/* ===== 卡片 ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.card {
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: 24px; padding: 24px;
    transition: all 0.4s cubic-bezier(0.15, 0, 0.15, 1);
    position: relative; overflow: hidden;
    box-shadow: 0 6px 12px var(--shadow);
    isolation: isolate;
}
.card::before {
    content: ""; position: absolute; inset: 0; z-index: -2;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.card::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: var(--glass-bg);
    border-radius: inherit;
    box-shadow: inset 1px 1px 1px 0 rgba(255, 255, 255, 0.25), inset -1px -1px 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.15, 0, 0.15, 1);
}
.card:hover { transform: translateY(-5px); }
.card:hover::after {
    background: var(--card-hover);
    border-color: var(--glass-border);
    box-shadow: inset 1px 1px 3px 0 rgba(255, 255, 255, 0.4), inset -1px -1px 1px 0 rgba(255, 255, 255, 0.1);
}

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px; }
.icon-box { display: flex; align-items: center; gap: 12px; }
.site-icon { width: 26px; height: 26px; border-radius: 6px; }
.node-name { display: flex; flex-direction: column; }
.node-name .zh { font-weight: 600; font-size: 0.95rem; color: var(--text-main); }
.node-name .en { font-size: 0.65rem; color: var(--text-dim); }

.tag { 
    font-size: 0.6rem; padding: 2px 8px; border-radius: 100px; 
    background: var(--bg-card); border: 1px solid var(--glass-border); 
    font-weight: 700; color: var(--text-dim); 
}
.ip-text { 
    font-family: 'SF Mono', 'Menlo', monospace; 
    font-size: 1.2rem; 
    color: var(--text-main);
    margin: 8px 0; 
    letter-spacing: -0.5px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}
.sub-text { font-size: 0.75rem; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }

/* ===== 延迟条 ===== */
.latency-bar { height: 6px; width: 100%; background: var(--bg-card); border-radius: 100px; overflow: hidden; margin-top: 12px; }
.latency-fill { height: 100%; width: 0%; border-radius: 100px; transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* ===== 按钮 ===== */
.btn-test {
    padding: 12px 28px; border-radius: 100px; border: none;
    background: rgba(255, 255, 255, 0.9); color: #000; font-weight: 700; cursor: pointer;
    transition: all 0.3s; font-size: 0.85rem; box-shadow: 0 4px 15px var(--shadow);
    display: flex; flex-direction: column; align-items: center; line-height: 1.2;
    position: relative; overflow: hidden; isolation: isolate;
}
.btn-test::before {
    content: ""; position: absolute; inset: 0; z-index: -2;
    backdrop-filter: blur(10px);
}
.btn-test::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    box-shadow: inset 2px 2px 2px 0 rgba(255, 255, 255, 0.9), inset -1px -1px 1px 1px rgba(0, 0, 0, 0.04);
    border-radius: inherit;
}
.btn-test:hover { 
    transform: scale(1.05); 
    box-shadow: 0 8px 25px var(--shadow-hover); 
    background: #ffffff;
}
.btn-test span.en { font-size: 0.6rem; text-transform: uppercase; opacity: 0.6; }

[data-theme="dark"] .btn-test {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}
[data-theme="dark"] .btn-test:hover {
    background: rgba(255, 255, 255, 0.25);
}
[data-theme="dark"] .btn-test::after {
    box-shadow: inset 2px 2px 2px 0 rgba(255, 255, 255, 0.2), inset -1px -1px 1px 1px rgba(0, 0, 0, 0.2);
}

.header-btns { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-screenshot {
    padding: 12px 20px; border-radius: 100px; border: 1px solid var(--glass-border);
    background: var(--bg-card); color: var(--text-main); font-weight: 600; cursor: pointer;
    transition: all 0.3s; font-size: 0.8rem; display: flex; flex-direction: column; align-items: center; line-height: 1.2;
}
.btn-screenshot:hover { background: var(--card-hover); }
.btn-screenshot:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-run-all {
    width: 100%; margin-top: 14px; padding: 14px 28px; border-radius: 14px; border: none;
    background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff; font-weight: 700; cursor: pointer;
    font-size: 0.9rem; display: flex; flex-direction: column; align-items: center; line-height: 1.3; gap: 2px;
    transition: all 0.3s; box-shadow: 0 4px 15px rgba(94, 92, 230, 0.35);
}
.btn-run-all:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-run-all:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-2px); }

/* ===== 状态 ===== */
.status-good { color: var(--success); }
.status-warn { color: var(--warning); }
.status-bad { color: var(--error); }
.anim-pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.9; } }

/* ===== DNS ===== */
.dns-leak-results { margin-top: 15px; display: flex; flex-direction: column; gap: 10px; }
.dns-item { 
    font-size: 0.85rem; padding: 10px; 
    background: var(--bg-card); border-radius: 12px; 
    display: flex; flex-direction: column; gap: 4px; 
    color: var(--text-main);
}
.conclusion { margin-top: 15px; padding: 15px; border-radius: 16px; text-align: center; font-weight: 700; font-size: 1rem; }
.leak-detected { background: rgba(255, 69, 58, 0.10); border: 1px solid var(--error); color: var(--error); }
.leak-safe { background: rgba(48, 209, 88, 0.10); border: 1px solid var(--success); color: var(--success); }

/* ===== 分组 ===== */
#split-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { 
    .grid, #split-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .card { padding: 12px 8px; border-radius: 14px; }
    .ip-text { font-size: 0.75rem; flex-wrap: wrap; word-break: break-all; gap: 4px; }
    .node-name .zh { font-size: 0.7rem; }
    .node-name .en { font-size: 0.5rem; }
    .sub-text { font-size: 0.55rem; }
    .tag { font-size: 0.5rem; padding: 2px 4px; }
    .site-icon { width: 16px; height: 16px; }
    .group-header .zh { font-size: 0.85rem; }
}
.group-header {
    grid-column: 1 / -1;
    display: flex; align-items: baseline; gap: 8px;
    margin: 28px 0 4px; padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
}
.group-header:first-child { margin-top: 4px; }
.group-header .zh { font-size: 1.05rem; font-weight: 800; color: var(--text-main); }
.group-header .en { font-size: 0.65rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }

/* ===== 设置面板 ===== */
.settings-panel {
    background: var(--bg-card) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-dim) !important;
}
.settings-panel summary,
details summary {
    color: var(--text-main) !important;
    font-weight: 600;
    outline: none;
    user-select: none;
    cursor: pointer;
}
details {
    background: var(--bg-card) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-dim) !important;
}
details > summary {
    color: var(--text-main) !important;
    font-weight: 600;
    outline: none;
    user-select: none;
    cursor: pointer;
}
details p,
details li,
details p strong {
    color: var(--text-main) !important;
}
details a {
    color: var(--primary);
    text-decoration: none;
}
details a:hover {
    text-decoration: underline;
}

/* ===== 玻璃切换 ===== */
.glass-toggle-wrapper { display: flex; flex-direction: column; align-items: center; margin-bottom: 25px; }
.settings-part { border-bottom: 1px dashed var(--glass-border); padding-bottom: 16px; margin-bottom: 16px; }
.settings-part-title { font-weight: 700; color: var(--text-main); font-size: 0.9rem; margin-bottom: 10px; }

.glass-toggle { 
    display: flex; 
    background: var(--bg-card); 
    border: 1px solid var(--glass-border); 
    border-radius: 100px; 
    padding: 4px; 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px); 
}
.glass-toggle button { 
    background: transparent; 
    border: none; 
    color: var(--text-dim); 
    padding: 6px 16px; 
    border-radius: 100px; 
    font-size: 0.85rem; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.3s; 
}
.glass-toggle button.active { 
    background: var(--card-hover); 
    color: var(--text-main); 
    box-shadow: 0 2px 10px var(--shadow); 
}

.glass-notice { 
    font-size: 0.7rem; 
    color: var(--text-dim); 
    margin-top: 10px; 
    text-align: center; 
    max-width: 90%; 
    line-height: 1.5; 
}
.glass-notice strong { color: var(--text-main); }

/* ===== 截图模式 ===== */
body.screenshot-capture .card::before,
body.screenshot-capture .card::after,
body.screenshot-capture .nav-tabs-wrapper::before,
body.screenshot-capture .btn-test::before,
body.screenshot-capture .btn-test::after {
    display: none !important;
}
body.screenshot-capture .card {
    background: var(--bg-primary) !important;
    border: 1px solid var(--glass-border) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
body.screenshot-capture .btn-test {
    background: #e5e5ea !important;
    box-shadow: none !important;
}
body.screenshot-capture .nav-tabs-wrapper {
    position: static !important;
    box-shadow: none !important;
    background: var(--bg-primary) !important;
}

/* ===== 回顶部按钮 ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(94, 92, 230, 0.4);
    transition: all 0.3s cubic-bezier(0.15, 0, 0.15, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.back-to-top:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 30px rgba(94, 92, 230, 0.5);
}

.back-to-top:active {
    transform: scale(0.92);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== 页脚 ===== */
.site-footer {
    margin-top: 80px;
    padding: 40px 20px 30px;
    border-top: 1px solid var(--glass-border);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-brand .footer-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 1px;
}

.footer-brand .footer-logo i {
    color: var(--primary);
    margin-right: 6px;
}

.footer-desc {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.footer-desc i {
    margin: 0 2px;
}

.footer-links {
    display: flex;
    gap: 12px;
}

.footer-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    font-size: 1.15rem;
    transition: all 0.3s cubic-bezier(0.15, 0, 0.15, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.footer-links a::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--primary);
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.15, 0, 0.15, 1);
    opacity: 0.15;
}

.footer-links a:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.footer-links a:hover::before {
    transform: scale(1);
}

.footer-links a.telegram:hover {
    color: #0088cc;
    border-color: #0088cc;
    box-shadow: 0 8px 24px rgba(0, 136, 204, 0.25);
}

.footer-links a.github:hover {
    color: #06b6d4;
    border-color: #06b6d4;
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.25);
}

.footer-links a.blog:hover {
    color: #f59e0b;
    border-color: #f59e0b;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25);
}

.footer-links a.rss:hover {
    color: #ff6b00;
    border-color: #ff6b00;
    box-shadow: 0 8px 24px rgba(255, 107, 0, 0.25);
}

[data-theme="dark"] .footer-links a.github:hover {
    color: #f0f6fc;
    border-color: #f0f6fc;
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.08);
}

.footer-bottom {
    max-width: 900px;
    margin: 20px auto 0;
    padding-top: 18px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.footer-bottom i {
    margin: 0 4px;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* 暗色模式下回顶部按钮微调 */
[data-theme="dark"] .back-to-top {
    box-shadow: 0 4px 20px rgba(94, 92, 230, 0.3);
}

[data-theme="dark"] .back-to-top:hover {
    box-shadow: 0 8px 30px rgba(94, 92, 230, 0.4);
}

/* 渲染质量覆盖样式 - 低 */
body[data-glass="low"] .card::before, 
body[data-glass="low"] .nav-tabs-wrapper::before, 
body[data-glass="low"] .btn-test::before { 
    filter: none !important; 
}
body[data-glass="low"] .card::before { 
    backdrop-filter: blur(40px) saturate(200%) !important; 
    -webkit-backdrop-filter: blur(40px) saturate(200%) !important; 
}
body[data-glass="low"] .nav-tabs-wrapper::before { 
    backdrop-filter: blur(20px) !important; 
    -webkit-backdrop-filter: blur(20px) !important; 
}
body[data-glass="low"] .btn-test::before { 
    backdrop-filter: blur(10px) !important; 
    -webkit-backdrop-filter: blur(10px) !important; 
}
body[data-glass="low"] .card::after { 
    background: var(--bg-card) !important; 
}

/* 渲染质量覆盖样式 - 中 */
body[data-glass="medium"] .card::before { 
    backdrop-filter: blur(20px) !important; 
    -webkit-backdrop-filter: blur(20px) !important; 
}
body[data-glass="medium"] .nav-tabs-wrapper::before { 
    backdrop-filter: blur(20px) !important; 
    -webkit-backdrop-filter: blur(20px) !important; 
}

/* ==============================================================
   播放器样式 - 完美适配亮色/暗色主题 (无冲突)
   ============================================================== */

/* ===== 播放器面板 ===== */
#player-wrap {
  position: fixed;
  left: 18px;
  bottom: 92px;
  width: 360px;
  max-width: calc(100% - 36px);
  z-index: 15000;
  display: none;
  transform-origin: left bottom;
}
#player-wrap.show {
  display: block;
  animation: popIn .18s ease;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== APlayer 适配主题（使用CSS变量，自动跟随亮/暗） ===== */
.aplayer {
  border-radius: 12px !important;
  overflow: hidden !important;
  background: var(--bg-card, rgba(255, 255, 255, 0.92)) !important;
  box-shadow: 0 8px 32px var(--shadow, rgba(0, 0, 0, 0.3)) !important;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* 歌曲名 - 跟随主题 */
.aplayer .aplayer-info .aplayer-music .aplayer-title {
  color: var(--text-main, #000) !important;
  font-weight: bold;
  transition: color 0.3s ease;
}

/* 播放列表 - 跟随主题 */
.aplayer .aplayer-list ol li {
  color: var(--text-main, #000) !important;
  border-top: 1px solid var(--glass-border, rgba(0,0,0,0.08)) !important;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.aplayer .aplayer-list ol li .aplayer-list-title {
  color: var(--text-main, #000) !important;
}
.aplayer .aplayer-list ol li.aplayer-list-light {
  background: rgba(255, 140, 0, 0.1) !important;
}
.aplayer .aplayer-list ol li:hover {
  background: var(--card-hover, rgba(0,0,0,0.05)) !important;
}

/* 歌词 - 使用独立颜色变量（可被JS动态修改） */
.aplayer .aplayer-lrc p {
  color: var(--lyrics-color, #ff8c00) !important;
  font-weight: 700;
  transition: color 0.2s ease;
}
.aplayer .aplayer-lrc p.aplayer-lrc-current {
  color: var(--lyrics-color-current, #ff4500) !important;
  font-weight: bold;
  font-size: 16px;
}

/* 进度条/音量条 - 跟随主题主色 */
.aplayer .aplayer-bar-wrap .aplayer-bar .aplayer-played {
  background: var(--primary, #49b1f5) !important;
}
.aplayer .aplayer-bar-wrap .aplayer-bar .aplayer-thumb {
  background: var(--primary, #49b1f5) !important;
}
.aplayer .aplayer-volume-bar-wrap .aplayer-volume-bar .aplayer-volume-played {
  background: var(--primary, #49b1f5) !important;
}

.aplayer .aplayer-info {
  border-top: none !important;
  padding: 12px 15px 8px !important;
}

/* ===== 独立歌词窗口（可拖动/缩放/改色） ===== */
#floating-lyrics {
  position: fixed;
  left: 100px;
  bottom: 50px;
  min-width: 200px;
  min-height: 70px;
  width: auto;
  height: auto;
  text-align: left;
  z-index: 99999;
  color: var(--lyrics-color, #ff8c00);
  font-size: 18px;
  font-weight: bold;
  text-shadow: 2px 2px 12px rgba(0, 0, 0, 0.9);
  background: var(--glass-bg, rgba(10, 10, 20, 0.55));
  padding: 18px 22px;
  border-radius: 18px;
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  max-width: 500px;
  opacity: 0;
  transition: opacity 0.3s ease, box-shadow 0.2s ease, background 0.3s ease;
  border: 1px solid var(--glass-border, rgba(255,255,255,0.15));
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
  pointer-events: auto;
  cursor: grab;
  resize: both;
  overflow: hidden;
}
#floating-lyrics:active {
  cursor: grabbing;
}
#floating-lyrics.show {
  opacity: 1;
}

/* 歌词内部文本容器 */
#floating-lyrics .current-line {
  font-size: 30px;
  margin-bottom: 8px;
  font-weight: bold;
  min-height: 28px;
  overflow: hidden;
  position: relative;
  color: inherit;
  transition: color 0.15s ease;
}
#floating-lyrics .next-line {
  font-size: 14px;
  min-height: 18px;
  color: inherit;
  opacity: 0.8;
  transition: color 0.15s ease;
}

/* 打字效果 */
#floating-lyrics .current-line .typing-text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  animation: typing 2s steps(40, end), blink-caret 0.75s step-end infinite;
  border-right: 2px solid var(--lyrics-color-current, #ff4500);
  animation-fill-mode: both;
  color: inherit;
}
#floating-lyrics .current-line .fade-in-text {
  opacity: 0;
  animation: fadeIn 0.5s ease-in forwards;
  color: inherit;
}
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}
@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--lyrics-color-current, #ff4500); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 歌词窗口控制按钮组 */
.lyrics-controls {
  position: absolute;
  top: 6px;
  right: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  background: rgba(0,0,0,0.3);
  padding: 4px 8px 4px 6px;
  border-radius: 30px;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.08);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: auto;
  z-index: 10;
}
#floating-lyrics:hover .lyrics-controls,
#floating-lyrics:focus-within .lyrics-controls {
  opacity: 1;
}
.lyrics-controls input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  outline: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
  transition: transform 0.1s ease;
}
.lyrics-controls input[type="color"]:hover {
  transform: scale(1.08);
}
.lyrics-controls .reset-color-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 14px;
  border-radius: 20px;
  padding: 2px 10px;
  cursor: pointer;
  font-weight: 600;
  backdrop-filter: blur(4px);
  transition: background 0.15s ease;
  letter-spacing: 0.3px;
  border: 1px solid rgba(255,255,255,0.1);
}
.lyrics-controls .reset-color-btn:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* resize 手柄 */
#floating-lyrics::-webkit-resizer {
  background: rgba(255,255,255,0.2);
  border-radius: 0 0 12px 0;
  border-right: 2px solid rgba(255,255,255,0.1);
  border-bottom: 2px solid rgba(255,255,255,0.1);
}

/* ===== 音乐胶囊 ===== */
#music-capsule {
  position: fixed;
  left: 22px;
  bottom: 96px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30000;
  background: radial-gradient(circle at 30% 30%, #00c3ff, #0061ff);
  box-shadow: 0 8px 28px rgba(0,180,255,0.12);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
#music-capsule img {
  width: 95%;
  height: 95%;
  border-radius: 50%;
  object-fit: cover;
  transition: transform .3s ease;
}
#music-capsule.playing {
  background: radial-gradient(circle at 30% 30%, #ff9500, #ff5e00);
  box-shadow: 0 8px 28px rgba(255,140,0,0.28);
}
#music-capsule.playing img {
  animation: spin 6s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

/* ===== 右键菜单 - 紧凑现代风格 ===== */
#right-menu {
  position: fixed;
  display: none;
  z-index: 40000;
  min-width: 180px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  color: #1a1a2e;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
  padding: 6px 0;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.15s ease, transform 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.25);
  overflow: hidden;
}

/* 暗色主题适配 */
[data-theme="dark"] #right-menu {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#right-menu.show {
  display: flex;
  opacity: 1;
  transform: scale(1);
  flex-direction: column;
}

#right-menu li {
  list-style: none;
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#right-menu li:last-child {
  border-bottom: none;
}

#right-menu li i {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  color: rgba(26, 26, 46, 0.5);
  transition: color 0.2s ease;
}

/* 暗色主题图标颜色 */
[data-theme="dark"] #right-menu li i {
  color: rgba(255, 255, 255, 0.4);
}

#right-menu li:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

[data-theme="dark"] #right-menu li:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

#right-menu li:hover i {
  color: #2563eb;
}

[data-theme="dark"] #right-menu li:hover i {
  color: #60a5fa;
}

/* 关闭按钮特殊样式 */
#right-menu li:last-child {
  color: rgba(26, 26, 46, 0.6);
}

[data-theme="dark"] #right-menu li:last-child {
  color: rgba(255, 255, 255, 0.5);
}

#right-menu li:last-child:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

[data-theme="dark"] #right-menu li:last-child:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

#right-menu li:last-child:hover i {
  color: #dc2626;
}

[data-theme="dark"] #right-menu li:last-child:hover i {
  color: #f87171;
}

/* 菜单底部箭头 */
#right-menu::after {
  content: "";
  position: absolute;
  top: -6px;
  left: var(--arrow-left, 24px);
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] #right-menu::after {
  border-bottom: 6px solid rgba(255, 255, 255, 0.1);
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  #music-capsule {
    left: 18px;
    bottom: 22px;
    width: 64px;
    height: 64px;
  }
  #player-wrap {
    left: 12px;
    bottom: 84px;
    width: calc(100% - 24px);
  }
  #floating-lyrics {
    left: 80px;
    bottom: 30px;
    max-width: 280px;
    font-size: 16px;
    padding: 14px 16px;
    min-width: 160px;
    min-height: 60px;
  }
  #floating-lyrics .current-line {
    font-size: 20px;
  }
  #floating-lyrics .next-line {
    font-size: 12px;
  }
  .lyrics-controls {
    opacity: 0.8; /* 移动端常显 */
  }
}

@media (max-width: 480px) {
  #music-capsule {
    left: 12px;
    bottom: 16px;
    width: 56px;
    height: 56px;
  }
  #floating-lyrics {
    left: 70px;
    bottom: 20px;
    max-width: 200px;
    font-size: 14px;
    padding: 10px 14px;
    min-width: 120px;
    min-height: 50px;
  }
  #floating-lyrics .current-line {
    font-size: 16px;
  }
  #floating-lyrics .next-line {
    font-size: 10px;
  }
}
