/* ========== 主题系统：浅色 / 深色 ==========
   用法：html[data-theme="dark"] 切换深色。js 记忆到 localStorage 的 chonger-theme。 */
:root{
  --d-text:#1d1d1f; --d-muted:#8a8a8f; --d-line:rgba(0,0,0,.1);
  --d-card:#ffffff; --d-sub:#f5f5f7; --d-accent:#06c; --d-accent-soft:rgba(0,102,204,.08);
  --d-shadow:0 20px 55px rgba(0,0,0,.12);
  --d-bg1:#f5f7fa; --d-bg2:#dbe4f0;
}
html[data-theme="dark"]{
  --d-text:#e6edf3; --d-muted:#8b98a5; --d-line:rgba(255,255,255,.12);
  --d-card:#161c23; --d-sub:#1c232c; --d-accent:#4da3ff; --d-accent-soft:rgba(77,163,255,.12);
  --d-shadow:0 20px 55px rgba(0,0,0,.45);
  --d-bg1:#0d1117; --d-bg2:#161c23;
}

/* 背景与基础文字 */
html[data-theme="dark"] body{background:linear-gradient(135deg,var(--d-bg1) 0%,var(--d-bg2) 55%,var(--d-bg1) 100%) !important;color:var(--d-text) !important;}
html[data-theme="dark"] a{color:var(--d-accent) !important;}
html[data-theme="dark"] nav{background:rgba(13,17,23,.9) !important;box-shadow:0 1px 3px rgba(0,0,0,.5) !important;}

/* 标题 */
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3,html[data-theme="dark"] h4,
html[data-theme="dark"] .logo,html[data-theme="dark"] .article-title,html[data-theme="dark"] .topic-title,
html[data-theme="dark"] .sr-title,html[data-theme="dark"] .sp-t,html[data-theme="dark"] .section-title,
html[data-theme="dark"] .stat-number,html[data-theme="dark"] .quota-label,html[data-theme="dark"] .card h2,
html[data-theme="dark"] .sr-head b{color:var(--d-text) !important;}
html[data-theme="dark"] .hero h1{color:var(--d-text) !important;-webkit-text-fill-color:currentColor !important;background:none !important;}

/* 次要文本 */
html[data-theme="dark"] .sub,html[data-theme="dark"] .subtitle,html[data-theme="dark"] .muted,
html[data-theme="dark"] .article-meta,html[data-theme="dark"] .sr-meta,html[data-theme="dark"] .sp-x,
html[data-theme="dark"] .about-log,html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .result-excerpt,html[data-theme="dark"] .article-excerpt,html[data-theme="dark"] .login-note{color:var(--d-muted) !important;}

/* 卡片与容器 */
html[data-theme="dark"] .card,
html[data-theme="dark"] .resource-card,html[data-theme="dark"] .stat-card,html[data-theme="dark"] .about-content,
html[data-theme="dark"] .more-card,html[data-theme="dark"] .topic-item,html[data-theme="dark"] .reply-item,
html[data-theme="dark"] .article-item,html[data-theme="dark"] .article-cover,html[data-theme="dark"] .file-item,
html[data-theme="dark"] .search-panel,html[data-theme="dark"] .notice-body,html[data-theme="dark"] .md-preview,
html[data-theme="dark"] .work-card,html[data-theme="dark"] .skill-card,html[data-theme="dark"] .timeline-card,
html[data-theme="dark"] .admin-box,html[data-theme="dark"] .profile-box,html[data-theme="dark"] .login-box,
html[data-theme="dark"] .post-box input,html[data-theme="dark"] .post-box textarea,
html[data-theme="dark"] input[type=text],html[data-theme="dark"] input[type=password],html[data-theme="dark"] input[type=email],
html[data-theme="dark"] input[type=number],html[data-theme="dark"] textarea,html[data-theme="dark"] select,
html[data-theme="dark"] .hero-search input{background:var(--d-card) !important;color:var(--d-text) !important;border-color:var(--d-line) !important;box-shadow:var(--d-shadow) !important;}
html[data-theme="dark"] input:focus,html[data-theme="dark"] textarea:focus{border-color:var(--d-accent) !important;}
html[data-theme="dark"] ::placeholder{color:var(--d-muted) !important;opacity:.7;}

/* hero 渐变 */
html[data-theme="dark"] .hero{background:linear-gradient(135deg,var(--d-bg1) 0%,#1a2430 50%,var(--d-bg1) 100%) !important;}

/* 列表项 hover / 分割 */
html[data-theme="dark"] .topic-item:hover,html[data-theme="dark"] .reply-item:hover,html[data-theme="dark"] .article-item:hover,
html[data-theme="dark"] .file-item:hover,html[data-theme="dark"] .sr-item:hover,html[data-theme="dark"] .sp-item:hover{background:var(--d-sub) !important;}

/* Markdown / 代码 */
html[data-theme="dark"] .markdown-body code{background:var(--d-sub) !important;color:#f0a35e !important;}
html[data-theme="dark"] .markdown-body pre{background:var(--d-sub) !important;}
html[data-theme="dark"] .markdown-body blockquote{background:var(--d-sub) !important;color:var(--d-muted) !important;border-left-color:var(--d-accent) !important;}
html[data-theme="dark"] .markdown-body th,html[data-theme="dark"] .markdown-body td{border-color:var(--d-line) !important;}
html[data-theme="dark"] .markdown-body hr{border-color:var(--d-line) !important;}
html[data-theme="dark"] .code-copy{background:rgba(255,255,255,.1) !important;color:var(--d-muted) !important;border-color:var(--d-line) !important;}

/* 标签 */
html[data-theme="dark"] .tag{background:var(--d-accent-soft) !important;color:var(--d-accent) !important;}
html[data-theme="dark"] .pin-tag{background:rgba(224,168,0,.18) !important;color:#e8b800 !important;}

/* 组件微调 */
html[data-theme="dark"] .quota-bar{background:var(--d-sub) !important;}
html[data-theme="dark"] .btn-outline{background:var(--d-sub) !important;color:var(--d-text) !important;border-color:var(--d-line) !important;}
html[data-theme="dark"] .chip{background:var(--d-accent-soft) !important;color:var(--d-accent) !important;border-color:var(--d-line) !important;}
html[data-theme="dark"] .gb-avatar{opacity:.9;}

/* 公告横幅 */
html[data-theme="dark"] .notice-bar{background:linear-gradient(135deg,#2a2410,#241f0d) !important;border-color:#4a3d14 !important;}
html[data-theme="dark"] .notice-bar:hover{background:#332c14 !important;}
html[data-theme="dark"] .notice-text,html[data-theme="dark"] .notice-body h4{color:#e6c25a !important;}
html[data-theme="dark"] .notice-body{color:var(--d-text) !important;}

/* 提示框 */
html[data-theme="dark"] .msg.ok{background:#14231a !important;color:#3fb76a !important;border-color:#1f4030 !important;}
html[data-theme="dark"] .msg.err{background:#2a1414 !important;color:#ff6b6b !important;border-color:#5a2626 !important;}

/* 页脚 */
html[data-theme="dark"] footer,html[data-theme="dark"] .footer{background:#0a0e13 !important;color:var(--d-text) !important;}
html[data-theme="dark"] footer a,html[data-theme="dark"] .footer a{color:var(--d-muted) !important;}

/* 主题切换按钮（导航栏 logo 旁边） */
#themeToggle{width:36px;height:36px;border-radius:50%;border:1px solid rgba(0,102,204,.35);background:transparent;color:#06c;font-size:17px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:all .3s;flex-shrink:0;margin:0 6px 0 14px;vertical-align:middle;}
#themeToggle:hover{background:#06c;color:#fff;transform:scale(1.06);}
#themeToggle svg{display:block;}
html[data-theme="dark"] #themeToggle{background:rgba(255,255,255,.08);border-color:rgba(255,255,255,.16);color:#e6edf3;}
html[data-theme="dark"] #themeToggle:hover{background:rgba(255,255,255,.18);color:#fff;}
@media (max-width:720px){ #themeToggle{width:32px;height:32px;margin-left:6px;font-size:15px;} }

/* ========== 补充覆盖：各页残留浅色/白底容器 ========== */
/* 页面大区块背景（主页关于/资料/更多、关于我各板块、经历等） */
html[data-theme="dark"] .about-section,
html[data-theme="dark"] .resources-section,
html[data-theme="dark"] .more-section,
html[data-theme="dark"] .exp-section,
html[data-theme="dark"] .works-section{background:var(--d-bg1) !important;}

/* 白底卡片/容器补充 */
html[data-theme="dark"] .contact-item,
html[data-theme="dark"] .about-card,
html[data-theme="dark"] .skill-item,
html[data-theme="dark"] .exp-item,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .auth-tabs .tab.active,
html[data-theme="dark"] .modal-box,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .edit-card,
html[data-theme="dark"] .inline-reply,
html[data-theme="dark"] .stat-pill,
html[data-theme="dark"] .btn-like{background:var(--d-card) !important;color:var(--d-text) !important;border-color:var(--d-line) !important;}
html[data-theme="dark"] .auth-tabs .tab.active{box-shadow:var(--d-shadow) !important;}
html[data-theme="dark"] .about-text p{color:var(--d-muted) !important;}

/* 编辑器工具栏 / 折叠发帖按钮 / 小按钮 */
html[data-theme="dark"] .md-btn,
html[data-theme="dark"] .post-toggle{background:var(--d-sub) !important;color:var(--d-text) !important;border-color:var(--d-line) !important;}
html[data-theme="dark"] .post-toggle{color:var(--d-accent) !important;}
html[data-theme="dark"] .stat-pill,html[data-theme="dark"] .btn-like{color:var(--d-muted) !important;}
html[data-theme="dark"] .btn-like.liked{color:#ff9f43 !important;border-color:#5a4020 !important;}

/* 删除 / 置顶按钮（浅红浅黄 → 深红深黄） */
html[data-theme="dark"] .btn-del{background:#2a1414 !important;color:#ff6b6b !important;border-color:#5a2626 !important;}
html[data-theme="dark"] .btn-pin{background:#2a2410 !important;color:#e8b800 !important;border-color:#4a3d14 !important;}

/* SVIP 徽标 */
html[data-theme="dark"] .badge.svip{background:rgba(224,168,0,.15) !important;color:#e8b800 !important;}

/* 登录/提交错误提示（粉底 → 深红底） */
html[data-theme="dark"] .auth-error{background:#2a1414 !important;color:#ff6b6b !important;border-color:#5a2626 !important;}
html[data-theme="dark"] .auth-success{background:#14231a !important;color:#3fb76a !important;border-color:#1f4030 !important;}

/* ========== 深色补全：选项卡/胶囊/标签条/验证码/徽标 ========== */
/* 浅灰底容器统一 → 深灰底 */
html[data-theme="dark"] .auth-tabs,
html[data-theme="dark"] .cat-chip,
html[data-theme="dark"] .file-label,
html[data-theme="dark"] .user-chip,
html[data-theme="dark"] .soon,
html[data-theme="dark"] .img-cell,
html[data-theme="dark"] .topic-thumb,
html[data-theme="dark"] .strength,
html[data-theme="dark"] .progress-bar,
html[data-theme="dark"] .captcha .q{background:var(--d-sub) !important;}
html[data-theme="dark"] .auth-tabs .tab{color:var(--d-muted) !important;}
html[data-theme="dark"] .auth-tabs .tab.active{background:var(--d-card) !important;color:var(--d-accent) !important;box-shadow:var(--d-shadow) !important;}
html[data-theme="dark"] .cat-chip,
html[data-theme="dark"] .file-label,
html[data-theme="dark"] .user-chip,
html[data-theme="dark"] .soon,
html[data-theme="dark"] .captcha .q{color:var(--d-text) !important;}
html[data-theme="dark"] .sort-chip{background:var(--d-accent-soft) !important;color:var(--d-accent) !important;}
html[data-theme="dark"] .sp-ic{background:var(--d-accent-soft) !important;}
html[data-theme="dark"] .sp-divider{background:var(--d-line) !important;}
html[data-theme="dark"] .msg{background:var(--d-card) !important;color:var(--d-text) !important;border-color:var(--d-line) !important;}

/* 云盘分类彩色徽标 → 半透明深底 + 亮色 */
html[data-theme="dark"] .cat-badge.pdf{background:rgba(194,65,12,.16) !important;color:#f2a17a !important;}
html[data-theme="dark"] .cat-badge.image{background:rgba(0,102,204,.18) !important;color:#4da3ff !important;}
html[data-theme="dark"] .cat-badge.video{background:rgba(90,90,214,.18) !important;color:#a5a5e8 !important;}
html[data-theme="dark"] .cat-badge.archive{background:rgba(146,96,10,.18) !important;color:#d9b45c !important;}
html[data-theme="dark"] .cat-badge.doc{background:rgba(10,143,92,.16) !important;color:#57c99a !important;}
html[data-theme="dark"] .cat-badge.audio{background:rgba(122,63,208,.18) !important;color:#b08ee8 !important;}
html[data-theme="dark"] .cat-badge.other{background:var(--d-sub) !important;color:var(--d-muted) !important;}

/* 用户管理徽标 */
html[data-theme="dark"] .badge.normal{background:var(--d-sub) !important;color:var(--d-muted) !important;}
html[data-theme="dark"] .badge.vip{background:rgba(0,102,204,.18) !important;color:#4da3ff !important;}
html[data-theme="dark"] .badge.admin{background:rgba(215,0,21,.16) !important;color:#ff7a7a !important;}

/* 关于我页作品标签 */
html[data-theme="dark"] .work-tag{background:rgba(77,163,255,.15) !important;color:#4da3ff !important;}

/* 登录提示条背景 */
html[data-theme="dark"] .login-note{background:var(--d-sub) !important;}

/* 移动端卡片式表格行（云盘/讨论区文件列表 <720px） */
@media (max-width:720px){
  html[data-theme="dark"] tr{background:var(--d-sub) !important;border-color:var(--d-line) !important;}
}

/* ========== 深色补全：友情链接 + 趋势图 + 后台统计 ========== */
html[data-theme="dark"] .links-section{background:var(--d-bg1) !important;}
html[data-theme="dark"] .link-card{background:var(--d-card) !important;border-color:var(--d-line) !important;color:var(--d-text) !important;}
html[data-theme="dark"] .link-intro{color:var(--d-muted) !important;}
html[data-theme="dark"] .link-arrow{color:var(--d-muted) !important;}
html[data-theme="dark"] .link-card:hover .link-arrow{color:var(--d-accent) !important;}
html[data-theme="dark"] .week-chart,
html[data-theme="dark"] .mini-chart{background:rgba(255,255,255,.04) !important;border-color:var(--d-line) !important;}
html[data-theme="dark"] .week-num,
html[data-theme="dark"] .week-day,
html[data-theme="dark"] .m-day{color:var(--d-muted) !important;}
html[data-theme="dark"] .del-btn{background:#2a1414 !important;color:#ff6b6b !important;border-color:#5a2626 !important;}
html[data-theme="dark"] .inp{background:var(--d-sub) !important;color:var(--d-text) !important;border-color:var(--d-line) !important;}
html[data-theme="dark"] .inp::placeholder{color:var(--d-muted) !important;}
html[data-theme="dark"] th{color:var(--d-muted) !important;border-color:var(--d-line) !important;}
html[data-theme="dark"] td{color:var(--d-text) !important;border-color:var(--d-line) !important;}
html[data-theme="dark"] .block-title{color:var(--d-text) !important;border-color:var(--d-accent) !important;}
html[data-theme="dark"] .ov-card{background:var(--d-sub) !important;}
html[data-theme="dark"] .ov-num{color:var(--d-accent) !important;}
html[data-theme="dark"] .ov-label{color:var(--d-muted) !important;}
html[data-theme="dark"] .line-chart{background:var(--d-sub) !important;}
html[data-theme="dark"] .lc-day{color:var(--d-muted) !important;}
html[data-theme="dark"] .site-intro{background:rgba(255,255,255,.05) !important;border-color:var(--d-line) !important;}
html[data-theme="dark"] .site-intro p{color:var(--d-text) !important;}
html[data-theme="dark"] .site-intro b{color:var(--d-accent) !important;}
html[data-theme="dark"] .drop-menu{background:var(--d-card) !important;box-shadow:0 12px 32px rgba(0,0,0,.4) !important;}
html[data-theme="dark"] .drop-menu a{color:var(--d-text) !important;}
html[data-theme="dark"] .drop-menu a:hover{background:var(--d-sub) !important;color:var(--d-accent) !important;}
html[data-theme="dark"] .drop-toggle .arr{color:var(--d-muted) !important;}

/* 移动端侧栏菜单（≤480px）：深色下整块改深色背景，避免下拉项浅色文字在白底上看不见 */
@media (max-width:480px){
  html[data-theme="dark"] #nav-menu{background:rgba(13,17,23,.97) !important;box-shadow:-2px 0 10px rgba(0,0,0,.4) !important;}
  html[data-theme="dark"] #nav-menu > li > a{color:var(--d-text) !important;}
  html[data-theme="dark"] .drop-menu a{color:var(--d-muted) !important;}
  html[data-theme="dark"] .drop-menu a:hover{background:transparent !important;color:var(--d-accent) !important;}
}

/* ========== 深色补全：讨论区 / 云盘正文与次级文字 ========== */
/* 近黑正文（深色卡片上原本不可见）→ 浅色 */
html[data-theme="dark"] .content,
html[data-theme="dark"] .f-name,
html[data-theme="dark"] .modal-msg{color:var(--d-text) !important;}

/* 次级灰色文字 → muted */
html[data-theme="dark"] .topic-meta,
html[data-theme="dark"] .time,
html[data-theme="dark"] .reply-meta,
html[data-theme="dark"] .img-label,
html[data-theme="dark"] .img-picker-sub,
html[data-theme="dark"] .empty,
html[data-theme="dark"] .f-meta,
html[data-theme="dark"] .f-stat,
html[data-theme="dark"] .login-hint,
html[data-theme="dark"] .upload-tip,
html[data-theme="dark"] .progress-text,
html[data-theme="dark"] .quota-num,
html[data-theme="dark"] .sort-sep{color:var(--d-muted) !important;}

/* 蓝色链接 / 作者名 / 回复按钮 → 深色亮蓝 */
html[data-theme="dark"] .author,
html[data-theme="dark"] .reply-to,
html[data-theme="dark"] .inline-reply-head,
html[data-theme="dark"] .btn-reply,
html[data-theme="dark"] .clear-link{color:var(--d-accent) !important;}

/* 通用小按钮（浅色浅边框灰字） */
html[data-theme="dark"] .btn{color:var(--d-text) !important;border-color:var(--d-line) !important;}

/* 移动端汉堡菜单按钮（深色导航上原本看不见） */
html[data-theme="dark"] .hamburger{color:var(--d-text) !important;}
