:root {
    /* =========================================
       1. 品牌色 (全局通用，红配黑/白都很搭)
       ========================================= */
    --primary-color: #C30A0B;
    --primary-hover: #a30809;

    /* =========================================
       2. 基础颜色 (浅色/默认模式)
       ========================================= */
    --bg-body: #F5F5F7;           /* 页面底色 */
    --bg-panel: #ffffff;          /* 卡片/Footer/弹窗底色 */
    --bg-input: #f9f9f9;          /* 输入框底色 */
    --bg-tab: #F5F5F7;            /* 分段控制器底色 */

    --text-main: #1D1D1F;         /* 主文字 */
    --text-secondary: #86868B;    /* 次要文字 */

    --border-light: rgba(0, 0, 0, 0.05); /* 弱边框线 */
    --border-strong: #eeeeee;            /* 强边框线 */

    /* =========================================
       3. iOS 风格玻璃态体系 (浅色)
       ========================================= */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);

    /* 组件专属特殊背景 */
    --header-scroll-bg: rgba(255, 255, 255, 0.85);
    --mobile-menu-bg: rgba(255, 255, 255, 0.95);
    --loading-bg: #ffffff;
    --mask-bg: rgba(255, 255, 255, 0.7);
    --icon-color: #000000; /* 滚动后图标颜色 */

    /* =========================================
       4. 布局变量 (不随主题改变)
       ========================================= */
    --container-width: 1400px;
    --header-height: 80px;
    --radius-lg: 24px;
}

body.dark-mode {
    --bg-body: #0d0d0d;           /* Todo同款极暗背景 */
    --bg-panel: #1a1a1a;          /* 暗色卡片 */
    --bg-input: #252525;          /* 暗色输入框 */
    --bg-tab: #000000;            /* 分段控制器纯黑 */

    --text-main: #ffffff;         /* 白字 */
    --text-secondary: #8e8e93;    /* 灰字 */

    --border-light: rgba(255, 255, 255, 0.05);
    --border-strong: #333333;

    /* 玻璃态暗色版 */
    --glass-bg: rgba(26, 26, 26, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

    /* 组件专属特殊背景暗色版 */
    --header-scroll-bg: rgba(20, 20, 20, 0.85);
    --mobile-menu-bg: rgba(13, 13, 13, 0.95);
    --loading-bg: #0d0d0d;
    --mask-bg: rgba(0, 0, 0, 0.7);
    --icon-color: #ffffff;
}

/* --- 基础重置 --- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s; /* 添加平滑过渡 */
}
a { text-decoration: none; color: inherit; transition: color 0.3s; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* --- 核心特效 --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}
.container {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
}

/* --- Header (PC端逻辑) --- */
header {
    position: fixed;
    top: 0; left: 0; width: 100%;
    height: var(--header-height);
    z-index: 1000;
    transition: all 0.4s ease;
    background: transparent;
    color: #fff; /* 透明状态始终保持白色 */
}

/* 滚动后的 Header */
header.scrolled {
    background: var(--header-scroll-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    height: 60px;
    color: var(--text-main); /* 自动根据主题变黑或白 */
    box-shadow: 0 4px 20px var(--border-light);
}

header.scrolled svg path {
    fill: var(--icon-color) !important;
}

header .container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header .container a {
    text-shadow: 0 0 10px var(--icon-color);
}

header.scrolled .container a {
    text-shadow: initial;
}

/* Logo */
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; color: inherit; z-index: 1002; }
.logo-icon { color: var(--primary-color); font-size: 24px; }

/* PC 菜单 */
.nav-menu { display: flex; gap: 24px; align-items: center; }
.nav-menu a {
    font-size: 15px;
    font-weight: 500;
    color: inherit;
    padding: 8px 16px;
    border-radius: 20px;
}
.nav-menu a:hover, .nav-menu a.active {
    background: rgba(150,150,150,0.2);
}
header.scrolled .nav-menu a:hover, header.scrolled .nav-menu a.active {
    background: var(--primary-color);
    color: #fff;
}

.nav-menu .search,
.nav-menu .btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-menu .btn-login svg path { fill: #fff; }
.nav-menu .search:hover, .nav-menu .btn-login:hover { background: none !important; }
.nav-menu .btn-login:hover svg path { fill: var(--primary-color); }

/* --- 移动端切换按钮 --- */
.mobile-toggle {
    display: none;
    font-size: 24px; cursor: pointer; color: inherit; z-index: 1002;
}

@media (max-width: 768px) {
    .mobile-toggle { display: block; }
    .nav-menu {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100vh;
        background: var(--mobile-menu-bg);
        backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
        flex-direction: column; align-items: center; gap: 30px;
        transform: translateY(-100%); transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1001; opacity: 0;
    }
    .nav-menu.open { transform: translateY(0); opacity: 1; padding: 120px 0; overflow: auto; }
    .nav-menu a { font-size: 1rem; color: var(--text-main); font-weight: 600; }
    .nav-menu a svg path { fill: var(--text-main) !important; }
    header.mobile-open { color: var(--text-main); }
}

/* --- Footer --- */
footer {
    background: var(--bg-panel);
    padding: 60px 0 30px;
    border-top: 1px solid var(--border-light);
    transition: background 0.3s;
}
.footer-content { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 40px; margin-bottom: 40px; }
.footer-col h4 { margin-bottom: 20px; font-size: 16px; font-weight: 600; color: var(--text-main); }
.footer-col a { display: block; margin-bottom: 12px; color: var(--text-secondary); font-size: 14px; }
.footer-col a:hover { color: var(--primary-color); }
.copyright { text-align: center; color: var(--text-secondary); font-size: 12px; border-top: 1px solid var(--border-strong); padding-top: 20px; }

@media (max-width: 768px) {
    .footer-content { flex-direction: column; text-align: center; }
}

/* --- 通用 UI 组件 --- */
.btn {
    display: inline-block; padding: 12px 30px; background: var(--primary-color);
    color: #fff; border-radius: 50px; font-size: 15px; font-weight: 500;
    transition: all 0.3s; border: none; cursor: pointer;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(195, 10, 11, 0.25); }
.btn-outline { background: transparent; border: 1px solid var(--primary-color); color: var(--primary-color); }
.btn-outline:hover { background: var(--primary-color); color: #fff; }

.section-title { text-align: center; margin-bottom: 50px; }
.section-title h2 { font-size: 36px; margin-bottom: 10px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-main); }
.section-title p { color: var(--text-secondary); font-size: 16px; }

/* --- Auth Modal (登录弹窗) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    z-index: 2000; display: none; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s;
}
.modal-overlay.show { display: flex; opacity: 1; }

.auth-modal {
    background: var(--bg-panel); width: 420px; border-radius: 24px; padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3); position: relative; max-width: 86%;
    transform: scale(0.95); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border-light);
}
.modal-overlay.show .auth-modal { transform: scale(1); }

.auth-header { text-align: center; margin-bottom: 12px; }
.auth-title { font-size: 22px; font-weight: 700; color: var(--text-main); }

/* 登录面板容器 */
.auth-panel { display: none; animation: fadeIn 0.3s ease; }
.auth-panel.active { display: block; }

/* 输入框组 */
.input-group { position: relative; margin-bottom: 20px; }
.auth-input {
    width: 100%; padding: 12px 20px; background: var(--bg-input); color: var(--text-main);
    height: 60px;
    border: 1px solid var(--border-light); border-radius: 12px; font-size: 15px; outline: none; transition: 0.3s;
}
.auth-input:focus { background: var(--bg-panel); border-color: var(--primary-color); }

.code-btn {
    border: none;
    outline: none;
    position: absolute; right: 10px; font-size: 13px; font-weight: bold;
    background: transparent; color: var(--primary-color); cursor: pointer; transition: 0.2s;
}
.code-btn:hover { color: var(--primary-color); }
.code-btn.disabled { color: var(--text-secondary); background: transparent; cursor: not-allowed; }

.auth-btn { width: 100%; padding: 18px 12px; border-radius: 12px; font-size: 16px; font-weight: 600; border: none; background: var(--primary-color); color: #fff; cursor: pointer; box-shadow: 0 5px 15px rgba(195,10,11,0.3); transition: 0.2s; }
.auth-btn:hover { background: var(--primary-hover); transform: translateY(-2px); }

.auth-links { margin-top: 20px; text-align: center; font-size: 13px; display: flex; justify-content: space-between; }
.auth-links a { color: var(--text-secondary); text-decoration: none; }
.auth-links a:hover { color: var(--primary-color); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.not-more { padding: 50px 0; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--text-secondary);}
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-secondary);}

/* --- Loading 组件 --- */
#global-loading {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--loading-bg); z-index: 99999; display: flex;
    flex-direction: column; align-items: center; justify-content: center;
    transition: background 0.3s;
}
.loader-spinner {
    width: 40px; height: 40px; border: 4px solid var(--border-strong);
    border-top: 4px solid var(--primary-color); border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.inline-loading-mask {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--mask-bg); z-index: 9999; display: none;
    align-items: center; justify-content: center; border-radius: inherit;
    backdrop-filter: blur(4px); /* 额外加上一点模糊效果更高级 */
}

.ph-content { position: relative; z-index: 2; text-align: center; animation: fadeIn 1s ease; }

@keyframes fadeIn { from {opacity:0; transform:translateY(30px);} to {opacity:1; transform:translateY(0);} }


/* --- Toast 核心容器 --- */
#toast-manager {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* =========================================
   PC 端样式 (TDesign 风格)
   ========================================= */
@media (min-width: 769px) {
    #toast-manager { top: 20px; left: 0; }

    .toast-item {
        display: flex;
        align-items: center;
        justify-content: center;
        width: max-content;
        padding: 10px 20px;
        background: rgba(28, 28, 30, 0.9);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        color: #fff;
        font-size: 14px;
        min-width: 80px;
        max-width: 450px;
        animation: pcToastIn 0.3s ease-out forwards;
    }

    .toast-icon { margin-right: 12px; font-size: 16px; display: flex; align-items: center; }
    .toast-item.hide { animation: pcToastOut 0.3s ease-in forwards; }

    @keyframes pcToastIn {
        from { opacity: 0; transform: translateY(-20px); }
        to { opacity: 1; transform: translateY(0); }
    }
    @keyframes pcToastOut {
        to { opacity: 0; transform: translateY(-20px); }
    }
}

/* =========================================
   移动端样式 (微信风格)
   ========================================= */
@media (max-width: 768px) {
    #toast-manager {
        top: 0; left: 0; height: 100vh;
        justify-content: center; /* 垂直居中 */
    }

    .toast-item {
        display: flex;
        flex-direction: column; /* 上下结构 */
        align-items: center;
        justify-content: center;
        min-width: 120px;
        min-height: 120px;
        max-width: 220px;
        padding: 20px;
        background: rgba(0, 0, 0, 0.85);
        border-radius: 12px;
        color: #fff;
        text-align: center;
        animation: mbToastIn 0.2s ease-out forwards;
    }

    /* 移动端纯文本模式：自动切回横向 pill 样式 */
    .toast-item.no-icon {
        flex-direction: row;
        min-width: auto;
        min-height: auto;
        padding: 10px 20px;
    }

    .toast-icon {
        display: inline-flex;
        margin-bottom: 12px;
        font-size: 36px; /* 大图标 */
    }
    .toast-item.hide { animation: mbToastOut 0.3s ease-in forwards; }

    .toast-item.no-icon .toast-icon { display: none; }

    .toast-text { font-size: 14px; line-height: 1.4; }

    @keyframes mbToastIn {
        from { opacity: 0; transform: scale(0.9); }
        to { opacity: 1; transform: scale(1); }
    }

    @keyframes mbToastOut {
        to { opacity: 0; transform: scale(0.9); }
    }
}

/* =========================================
   通用状态颜色
   ========================================= */
.toast-success .toast-icon { color: var(--todo-lime); }
.toast-danger .toast-icon  { color: #ff453a; }
.toast-warning .toast-icon { color: #ff9f0a; }
.toast-info .toast-icon    { color: #0a84ff; }

/* 微信/TDesign 风格 Loading 转圈 */
.toast-loading-spinner {
    width: 24px; height: 24px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: toastSpin 0.8s linear infinite;
}
@media (max-width: 768px) { .toast-loading-spinner { width: 35px; height: 35px; } }
@keyframes toastSpin { to { transform: rotate(360deg); } }