/* =========================================
   夜间模式深度适配 (body.dark-theme)
   作者：你
   优化：Qwen - 清理冗余、增强健壮性、统一结构
   ========================================= */

/* -----------------------------
   1. 全局深色变量定义
   ----------------------------- */
body.dark-theme,
html.dark-theme {
    --border-color: #4d4a4a !important;
    --text-color: #ddd !important;
    --border-bottom: #4d4a4a !important;
    --footer-bg: var(--main-bg-color) !important;
    --footer-color: var(--muted-2-color) !important;
    --key-color: #f8fafc;
    --main-color: #e5eef7;
    --main-shadow: rgba(24, 24, 24, 0.1);
    --muted-color: #b4b6bb;
    --muted-2-color: #888a8f;
    --muted-3-color: #636469;
    --muted-4-color: #43454a;
    --body-bg-color: #292a2d;
    --main-bg-color: #323335;
    --muted-bg-color: #2d2e31;
    --dsuitoum: #32333500;
    --main-border-color: rgba(114, 114, 114, 0.1);
    --muted-border-color: rgba(184, 184, 184, 0.02);
    --blur-bg: rgba(50, 51, 53, 0.8);
    --float-btn-bg: rgba(70, 70, 70, 0.4);
    --header-bg: var(--blur-bg);
    --header-color: var(--main-color);
}

/* -----------------------------
   2. 通用文本与基础元素
   ----------------------------- */
body.dark-theme,
body.dark-theme p,
body.dark-theme span,
body.dark-theme div:not([class*="zm_"]):not([class*="sc_"]) {
    color: var(--text-color) !important;
}

body.dark-theme img {
    /* 可选：防止白色背景图在深色下刺眼 */
    background-color: transparent !important;
}

/* -----------------------------
   3. 页脚区域修复
   ----------------------------- */
body.dark-theme .foot-copyright {
    border-top-color: var(--border-color) !important;
    background-color: var(--footer-bg) !important;
    color: var(--footer-color) !important;
}

body.dark-theme #dsui_ui_bg_box {
    border-top-color: var(--main-border-color) !important;
    border-bottom-color: var(--main-border-color) !important;
    background-color: var(--body-bg-color) !important;
}

body.dark-theme .footer-navi {
    border-bottom-color: var(--border-color) !important;
    background-color: var(--main-bg-color) !important;
    color: var(--muted-2-color) !important;
}

/* 二维码弹窗 */
body.dark-theme .footer-navi .ewms .ewm-content {
    background: var(--main-bg-color) !important;
    border: 1px solid var(--main-border-color) !important;
    box-shadow: 0 16px 32px 0 rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .footer-navi .ewms .ewm-content::before {
    border-top-color: var(--main-bg-color) !important;
}

body.dark-theme .footer-navi .ewms .ewm-main h4 {
    color: var(--main-color) !important;
}

body.dark-theme .footer-navi .ewms .ewm-main h5 {
    color: var(--muted-2-color) !important;
}

/* 友链 & 版权 */
body.dark-theme .footer .friendlinks,
body.dark-theme .footer .friendlinks a {
    color: var(--muted-2-color) !important;
}

body.dark-theme .footer .friendlinks a:hover {
    color: var(--main-color) !important;
}

body.dark-theme .footer .copyright,
body.dark-theme .footer .copyright a {
    color: var(--footer-color) !important;
}

body.dark-theme .footer .copyright p {
    background: var(--muted-bg-color) !important;
    border: 1px solid var(--main-border-color) !important;
}

body.dark-theme #tfbk-footer-new .footer-bottom {
    background-color: var(--muted-bg-color) !important;
    color: var(--muted-2-color) !important;
    border-top: 1px solid var(--main-border-color) !important;
}

/* 标题 & 标签 */
body.dark-theme .title,
body.dark-theme .footer .Onecad_fl h2 a {
    color: var(--main-color) !important;
}

body.dark-theme #dslianjie_links {
    color: var(--muted-2-color) !important;
    border-color: var(--muted-border-color) !important;
    background-color: var(--muted-bg-color) !important;
}

body.dark-theme #dslianjie_links:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--main-color) !important;
    border-color: var(--main-color) !important;
}

body.dark-theme .footer-navi a {
    color: var(--muted-2-color) !important;
}

body.dark-theme .footer-navi a:hover {
    color: var(--main-color) !important;
}

body.dark-theme .footer-navi .ewms .ewm-douyin .ewm-douyin-1:after {
    background: var(--main-border-color) !important;
}

body.dark-theme .footer-navi .bands .band {
    background-color: var(--muted-bg-color) !important;
    border: 1px solid var(--main-border-color) !important;
}

/* -----------------------------
   4. 多彩提示框 (#zm_*)
   ----------------------------- */
body.dark-theme #zm_gll,
body.dark-theme #zm_mhz,
body.dark-theme #zm_szh,
body.dark-theme #zm_tkzj,
body.dark-theme #zm_wbk,
body.dark-theme #zm_xgh,
body.dark-theme #zm_xty,
body.dark-theme #zm_xyz,
body.dark-theme #zm_yyz {
    color: #eee !important;
    border: 1px solid var(--main-border-color) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* 各色系单独调整（保留你的设计） */
body.dark-theme #zm_gll {
    background-image: linear-gradient(102deg, #2e4f3f 17.4%, #4a6b52 49.3%, #5c754e 83.4%, #6b6645 110.3%) !important;
    color: #dcedc8 !important;
}

body.dark-theme #zm_mhz {
    background-color: #4a6fa5 !important;
    background-image: linear-gradient(62deg, #4a6fa5, #6b5b95) !important;
    color: #e3f2fd !important;
    box-shadow: 6px 0 12px -5px rgba(74, 111, 165, 0.3), -6px 0 12px -5px rgba(107, 91, 149, 0.3) !important;
}

body.dark-theme #zm_xgh {
    background-color: rgba(200, 80, 80, 0.4) !important;
    background-image: linear-gradient(220deg, #8b3a3a, rgba(100, 40, 60, 0.6) 55%, #8b4a5a) !important;
    color: #ffcdd2 !important;
    box-shadow: 6px 0 12px -5px rgba(139, 58, 58, 0.3), -6px 0 12px -5px rgba(139, 74, 90, 0.3) !important;
}

body.dark-theme #zm_tkzj {
    background-color: rgba(100, 50, 60, 0.3) !important;
    background-image: linear-gradient(0deg, rgba(100, 50, 60, 0.6), rgba(50, 80, 80, 0.5)) !important;
    color: #e0f7fa !important;
    box-shadow: 6px 0 12px -5px rgba(100, 50, 60, 0.3), -6px 0 12px -5px rgba(50, 80, 80, 0.3) !important;
}

body.dark-theme #zm_xyz {
    background-image: radial-gradient(circle 263px at 100.2% 3%, #062d4d 31.1%, #6b5e2e 36.4%, #8f3a2e 50.9%, #5c6152 60.7%, #8f4a1e 72.5%, #05263d 72.6%) !important;
    color: #fff !important;
    box-shadow: 6px 0 12px -5px rgba(12, 85, 141, 0.4), -6px 0 12px -5px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme #zm_xty {
    background-image: radial-gradient(circle farthest-corner at -8.9% 51.2%, #cc6200 0, #cc6200 15.9%, #ff8800 0, #ff8800 24.4%, #2c3e50 24.5%, #2c3e50 66%) !important;
    color: #fff !important;
    box-shadow: 6px 0 12px -5px rgba(204, 98, 0, 0.3), -6px 0 12px -5px rgba(215, 240, 243, 0.1) !important;
}

body.dark-theme #zm_yyz {
    background-image: radial-gradient(circle farthest-corner at 10% 20%, #3f4aa6 0, #5e4a6b 90%) !important;
    color: #ede7f6 !important;
    box-shadow: 6px 0 12px -5px rgba(94, 74, 107, 0.4), -6px 0 12px -5px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme #zm_szh {
    color: #ddd !important;
    background-image: radial-gradient(circle farthest-corner at 10% 20%, #2b2b2b 0, #505050 90.2%) !important;
    box-shadow: 6px 0 12px -5px rgba(100, 100, 100, 0.3), -6px 0 12px -5px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid var(--muted-3-color) !important;
}

/* -----------------------------
   5. 警示框 (#sc_*, .ml_xuk)
   ----------------------------- */
body.dark-theme #sc_redb {
    background-color: rgba(237, 5, 5, 0.1) !important;
    border-color: var(--main-border-color) !important;
    border-left-color: #ef5350 !important;
    color: var(--main-color) !important;
}

body.dark-theme #ml_xuk {
    border-color: var(--muted-color) !important;
    background-color: var(--muted-bg-color) !important;
    color: var(--main-color) !important;
}

body.dark-theme #sc_blue {
    color: #64b5f6 !important;
    background: rgba(27, 161, 226, 0.15) !important;
    border-color: rgba(27, 161, 226, 0.4) !important;
}

body.dark-theme #sc_error {
    color: #ef9a9a !important;
    background: rgba(255, 236, 236, 0.05) !important;
    border-color: rgba(235, 177, 177, 0.3) !important;
}

body.dark-theme #sc_tips {
    color: var(--muted-color) !important;
    background: var(--muted-bg-color) !important;
    border-color: var(--main-border-color) !important;
}

/* 统一阴影 */
body.dark-theme #sc_blue,
body.dark-theme #sc_error,
body.dark-theme #sc_tips {
    box-shadow: 0 10px 12px 1px rgba(0, 0, 0, 0.3) !important;
}

/* -----------------------------
   6. 引用与折叠框 (.ds-*)
   ----------------------------- */
body.dark-theme .ds-abstract,
body.dark-theme .ds-blockquote {
    background: var(--muted-bg-color) !important;
    color: var(--muted-color) !important;
    border-color: var(--main-border-color) !important;
}

body.dark-theme .ds-abstract ds-fieldset {
    border-color: var(--main-border-color) !important;
    background: transparent !important;
}

body.dark-theme .ds-abstract ds-legend {
    color: var(--main-color) !important;
    background: var(--main-bg-color) !important;
    padding: 0 5px;
    border: 1px solid var(--main-border-color);
    border-radius: 4px;
}

body.dark-theme #ds-btxian,
body.dark-theme .ds-btxian {
    border-left-color: rgba(155, 4, 248, 0.6) !important;
    border-bottom-color: rgba(102, 102, 102, 0.3) !important;
    color: var(--main-color) !important;
}

/* -----------------------------
   7. 文章内容 & 特殊标题
   ----------------------------- */
body.dark-theme .wp-posts-content p {
    color: var(--muted-color) !important;
}

body.dark-theme .bt1 {
    border-left-color: #42a1ff !important;
    color: var(--main-color) !important;
}

body.dark-theme .vip-kapian {
    background: rgba(30, 60, 120, 0.6) !important;
    border-color: rgba(62, 121, 239, 0.4) !important;
    opacity: 0.8 !important;
    color: #fff !important;
}

body.dark-theme .dsui-lansebiaoti02,
body.dark-theme .dsui-lansebiaoti02 span {
    color: #64b5f6 !important;
    border-bottom-color: rgba(61, 170, 214, 0.3) !important;
}

body.dark-theme .dsui-lansek2 {
    background-color: var(--muted-bg-color) !important;
    border-color: rgba(166, 223, 242, 0.3) !important;
    border-left-color: #42a1ff !important;
    color: #90caf9 !important;
}

body.dark-theme .dsui-lansek01 {
    background: rgba(239, 112, 96, 0.2) !important;
    border-bottom-color: rgba(239, 112, 96, 0.5) !important;
    color: #ffccbc !important;
}

/* DSUI 教程标签 */
body.dark-theme .dsui-tutorial-tag .label {
    color: var(--muted-color) !important;
    border-color: var(--muted-color) !important;
    background: transparent !important;
}

body.dark-theme .dsui-tutorial-tag.red .label {
    color: #ef9a9a !important;
    border-color: #ef9a9a !important;
}

body.dark-theme .dsui-tutorial-tag.red .label:hover {
    background-color: rgba(211, 47, 47, 0.15) !important;
}

body.dark-theme .dsui-tutorial-tag.blue .label {
    color: #90caf9 !important;
    border-color: #90caf9 !important;
}

body.dark-theme .dsui-tutorial-tag.blue .label:hover {
    background-color: rgba(25, 118, 210, 0.15) !important;
}

body.dark-theme .dsui-tutorial-tag.green .label {
    color: #a5d6a7 !important;
    border-color: #a5d6a7 !important;
}

body.dark-theme .dsui-tutorial-tag.green .label:hover {
    background-color: rgba(56, 142, 60, 0.15) !important;
}

body.dark-theme .dsui-tutorial-label {
    color: #fff !important;
}

body.dark-theme .dsui-tutorial-wrapper.red .dsui-tutorial-label {
    background-color: #c62828;
}

body.dark-theme .dsui-tutorial-wrapper.blue .dsui-tutorial-label {
    background-color: #1565c0;
}

body.dark-theme .dsui-tutorial-wrapper.green .dsui-tutorial-label {
    background-color: #2e7d32;
}

body.dark-theme .dsui-tutorial-line {
    background-color: var(--muted-3-color) !important;
    opacity: 0.5;
}

body.dark-theme .dsui-tutorial-wrapper.red .dsui-tutorial-line {
    background-color: #c62828;
}

body.dark-theme .dsui-tutorial-wrapper.blue .dsui-tutorial-line {
    background-color: #1565c0;
}

body.dark-theme .dsui-tutorial-wrapper.green .dsui-tutorial-line {
    background-color: #2e7d32;
}