/* =========================================================
   孜然工具箱 · 深色主题（dark.css）
   由 head 内 early script 在首屏前设置 <html data-theme="dark|light">
   data-theme-mode = auto | light | dark（auto 跟随系统）
   仅覆盖颜色与阴影，不改布局。
   ========================================================= */
html[data-theme="dark"]{
  color-scheme: dark;
  --brand:#818cf8;
  --brand-dark:#a5b4fc;
  --brand-soft:#1e1b4b;
  --ink:#e5e7eb;
  --ink-2:#cbd5e1;
  --muted:#94a3b8;
  --line:#243044;
  --bg:#0b1120;
  --card:#111827;
  --bg-soft:#0f172a;
  --shadow:0 1px 2px rgba(0,0,0,.5);
  --shadow-hover:0 14px 34px rgba(0,0,0,.55);
  /* 磨砂玻璃令牌（theme.css 的玻璃拟态皮肤） */
  --glass:rgba(17,24,39,.74);
  --glass-2:rgba(30,41,59,.62);
  --glass-3:rgba(17,24,39,.92);
  --glass-edge:rgba(148,163,184,.16);
  --glass-shadow:0 12px 36px -14px rgba(0,0,0,.6);
  --glass-inset:inset 0 1px 0 rgba(255,255,255,.05);
}
html[data-theme="dark"] body{
  background:radial-gradient(1200px 600px at 50% -180px, #172554 0%, #0b1120 52%) no-repeat, var(--bg);
  color:var(--ink);
}
html[data-theme="dark"] ::selection{background:#4338ca;color:#fff;}
html[data-theme="dark"] ::-webkit-scrollbar{width:10px;height:10px;}
html[data-theme="dark"] ::-webkit-scrollbar-track{background:#0b1120;}
html[data-theme="dark"] ::-webkit-scrollbar-thumb{background:#334155;border-radius:6px;border:2px solid #0b1120;}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover{background:#475569;}

/* ---------- 顶部导航 ---------- */
html[data-theme="dark"] .site-header{
  background:rgba(11,17,32,.86);
  border-bottom-color:var(--line);
  box-shadow:0 1px 0 rgba(255,255,255,.03);
}
html[data-theme="dark"] .brand{color:var(--ink);}
html[data-theme="dark"] .site-search{background:#0f172a;border-color:#243044;}
html[data-theme="dark"] .site-search input{color:var(--ink);}
html[data-theme="dark"] .site-search input::placeholder{color:#64748b;}
html[data-theme="dark"] .site-search:focus-within{border-color:var(--brand);box-shadow:0 0 0 3px rgba(129,140,248,.18);}
html[data-theme="dark"] .site-nav a{color:var(--ink-2);}
html[data-theme="dark"] .site-nav a:hover{background:#1e293b;color:#c7d2fe;}
html[data-theme="dark"] .site-admin{color:var(--muted);border-color:var(--line);}
html[data-theme="dark"] .site-admin:hover{background:#1e293b;border-color:#3730a3;color:#c7d2fe;}
html[data-theme="dark"] .search-tip{background:#1e1b4b;color:#c7d2fe;border-color:#3730a3;}

/* ---------- Hero / 搜索 ---------- */
html[data-theme="dark"] .hero{
  background:linear-gradient(180deg,#0f172a 0%,#0b1120 100%);
  border-bottom-color:var(--line);
}
html[data-theme="dark"] .hero__glow{
  background:
    radial-gradient(900px 420px at 50% -12%, rgba(99,102,241,.22), transparent 68%),
    radial-gradient(600px 280px at 85% 10%, rgba(168,85,247,.10), transparent 70%);
}
html[data-theme="dark"] .hero__badge{background:#111c33;border-color:#243044;color:#c7d2fe;}
html[data-theme="dark"] .hero__title{color:#f1f5f9;}
html[data-theme="dark"] .hero__sub{color:var(--muted);}
html[data-theme="dark"] .hero__sub strong{color:#c7d2fe;}
html[data-theme="dark"] .hero-search{background:#0f172a;border-color:#243044;}
html[data-theme="dark"] .hero-search input{color:var(--ink);}
html[data-theme="dark"] .hero-search input::placeholder{color:#64748b;}
html[data-theme="dark"] .hero-search:focus-within{border-color:var(--brand);box-shadow:0 0 0 4px rgba(129,140,248,.16);}
html[data-theme="dark"] .hero-quick__item{background:#111827;border-color:#243044;}
html[data-theme="dark"] .hero-quick__item:hover{background:#1e293b;border-color:#3730a3;}
html[data-theme="dark"] .hero-quick__label{color:var(--muted);}
html[data-theme="dark"] .preset-link{background:#111827;border-color:#243044;}
html[data-theme="dark"] .preset-link:hover{background:#1e293b;border-color:#3730a3;}

/* ---------- 统计 / 分类卡片 ---------- */
html[data-theme="dark"] .stats{background:#111827;border-color:#243044;}
html[data-theme="dark"] .stat b{color:#f1f5f9;}
html[data-theme="dark"] .stat span{color:var(--muted);}
html[data-theme="dark"] .cat-card{background:#111827;border-color:#243044;box-shadow:var(--shadow);}
html[data-theme="dark"] .cat-card:hover{background:#151f33;border-color:#3730a3;box-shadow:var(--shadow-hover);}
html[data-theme="dark"] .cat-name{color:#f1f5f9;}
html[data-theme="dark"] .cat-desc{color:var(--muted);}
html[data-theme="dark"] .cat-count{background:#1e1b4b;color:#c7d2fe;}
html[data-theme="dark"] .cat-ico{background:#1e1b4b;color:#a5b4fc;}

/* ---------- 工具卡片 ---------- */
html[data-theme="dark"] .tool-item,
html[data-theme="dark"] .tool-tile,
html[data-theme="dark"] .all-tool,
html[data-theme="dark"] .rank-item,
html[data-theme="dark"] .rank-cat,
html[data-theme="dark"] .rel-list a{
  background:#111827;border-color:#243044;
}
html[data-theme="dark"] .tool-item:hover,
html[data-theme="dark"] .tool-tile:hover,
html[data-theme="dark"] .all-tool:hover,
html[data-theme="dark"] .rank-item:hover,
html[data-theme="dark"] .rel-list a:hover{background:#1a2438;border-color:#3730a3;}
html[data-theme="dark"] .tool-item .t-name,
html[data-theme="dark"] .tool-tile__name,
html[data-theme="dark"] .rank-name{color:#e2e8f0;}
html[data-theme="dark"] .tool-item .t-desc,
html[data-theme="dark"] .rank-cnt{color:var(--muted);}
html[data-theme="dark"] .rank-bar{background:#1e293b;}
html[data-theme="dark"] .rank-no{color:#64748b;}

/* ---------- 面板 / 区块 ---------- */
html[data-theme="dark"] .panel,
html[data-theme="dark"] .rel-wrap,
html[data-theme="dark"] .block,
html[data-theme="dark"] .rich-block,
html[data-theme="dark"] .rich-faq__item,
html[data-theme="dark"] .ai-block{background:#111827;border-color:#243044;box-shadow:var(--shadow);}
html[data-theme="dark"] .rel-wrap h3,
html[data-theme="dark"] .rich-h2,
html[data-theme="dark"] .tool-seo h2,
html[data-theme="dark"] .tool-seo h3,
html[data-theme="dark"] .ai-block__title{color:#e2e8f0;}
html[data-theme="dark"] .rich-intro,
html[data-theme="dark"] .rich-features li,
html[data-theme="dark"] .rich-steps li,
html[data-theme="dark"] .rich-crowd li,
html[data-theme="dark"] .rich-faq__a,
html[data-theme="dark"] .tool-seo p,
html[data-theme="dark"] .tool-seo li,
html[data-theme="dark"] .ai-text{color:var(--ink-2);}
html[data-theme="dark"] .rich-features b,
html[data-theme="dark"] .rich-steps b,
html[data-theme="dark"] .rich-faq__q{color:#c7d2fe;}
html[data-theme="dark"] .rich-updated{color:#64748b;border-top-color:#1e293b;}
html[data-theme="dark"] .rich-tip{background:#1c1917;border-color:#3f3f46;color:#fcd34d;}
html[data-theme="dark"] .ai-err{background:#2a1a05;border-color:#78350f;color:#fcd34d;}
html[data-theme="dark"] .alert{background:#0f172a;border-color:#243044;border-left-color:var(--brand);color:var(--ink-2);}
html[data-theme="dark"] .ctrld{background:#111827;border-top-color:#243044;color:var(--ink-2);}
html[data-theme="dark"] .ctrld kbd{background:#1e293b;color:#e2e8f0;border-color:#334155;}

/* ---------- 表单 / 按钮 ---------- */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] input.form-control,
html[data-theme="dark"] textarea.form-control,
html[data-theme="dark"] select.form-control{
  background:#0f172a;border-color:#243044;color:#e2e8f0;
}
html[data-theme="dark"] .form-control::placeholder{color:#64748b;}
html[data-theme="dark"] .form-control:focus{background:#0f172a;border-color:var(--brand);box-shadow:0 0 0 3px rgba(129,140,248,.16);}
html[data-theme="dark"] .btn-default{background:#1e293b;color:#e2e8f0;border-color:#334155;}
html[data-theme="dark"] .btn-default:hover{background:#273449;border-color:#475569;color:#f1f5f9;}
html[data-theme="dark"] .btn-success{background:linear-gradient(135deg,#6366f1,#8b5cf6);border-color:#6366f1;color:#fff;}
html[data-theme="dark"] .btn-success:hover{background:linear-gradient(135deg,#818cf8,#a78bfa);border-color:#818cf8;}
html[data-theme="dark"] .btn-info{background:#0ea5e9;border-color:#0ea5e9;color:#fff;}
html[data-theme="dark"] .btn-warning{background:#f59e0b;border-color:#f59e0b;color:#1c1917;}
html[data-theme="dark"] .btn-danger{background:#ef4444;border-color:#ef4444;color:#fff;}

/* ---------- 代码 / 表格 ---------- */
html[data-theme="dark"] pre,
html[data-theme="dark"] code,
html[data-theme="dark"] .hljs{background:#0f172a;color:#e2e8f0;border-color:#243044;}
html[data-theme="dark"] .table{color:var(--ink-2);}
html[data-theme="dark"] .table th,
html[data-theme="dark"] .table>thead>tr>th,
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table .titcolor{background:#0f172a !important;color:#cbd5e1 !important;border-color:#243044 !important;}
html[data-theme="dark"] .table>tbody>tr>td{border-top-color:#1e293b;}
html[data-theme="dark"] .table-striped>tbody>tr:nth-of-type(odd){background:#0f172a;}
html[data-theme="dark"] .table-hover>tbody>tr:hover{background:#1e293b;}
html[data-theme="dark"] .table-bordered,
html[data-theme="dark"] .table-bordered>tbody>tr>td,
html[data-theme="dark"] .table-bordered>thead>tr>th{border-color:#243044;}

/* ---------- 旧版 Bootstrap 组件 ---------- */
html[data-theme="dark"] .panel-default,
html[data-theme="dark"] .panel-heading{background:#111827;border-color:#243044;color:#e2e8f0;}
html[data-theme="dark"] .panel-title{color:#e2e8f0;}
html[data-theme="dark"] .nav-tabs.hbflag{border-bottom-color:#243044;background:transparent;}
html[data-theme="dark"] .nav-tabs.hbflag>li>a{background:#111827;border-color:#243044;color:var(--ink-2);}
html[data-theme="dark"] .nav-tabs.hbflag>li>a:hover{background:#1e293b;color:#c7d2fe;}
html[data-theme="dark"] .nav-tabs.hbflag>li.active>a{background:#1e1b4b;border-color:#3730a3;color:#c7d2fe;}
html[data-theme="dark"] .accordion-group{background:transparent;border-color:#243044;}
html[data-theme="dark"] .accordion-toggle{color:#e2e8f0;}
html[data-theme="dark"] .well{background:#0f172a;border-color:#243044;}
html[data-theme="dark"] .list-group-item{background:#111827;border-color:#243044;color:var(--ink-2);}
html[data-theme="dark"] .list-group-item:hover{background:#1e293b;}
html[data-theme="dark"] .dropdown-menu{background:#111827;border-color:#243044;box-shadow:0 12px 28px rgba(0,0,0,.5);}
html[data-theme="dark"] .dropdown-menu>li>a{color:var(--ink-2);}
html[data-theme="dark"] .dropdown-menu>li>a:hover{background:#1e293b;color:#e2e8f0;}
html[data-theme="dark"] .modal-content{background:#111827;border-color:#243044;color:var(--ink-2);}
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer{border-color:#243044;}
html[data-theme="dark"] .close{color:#94a3b8;text-shadow:none;}
html[data-theme="dark"] .pagination>li>a,
html[data-theme="dark"] .pagination>li>span{background:#111827;border-color:#243044;color:var(--ink-2);}
html[data-theme="dark"] .pagination>li>a:hover{background:#1e293b;}
html[data-theme="dark"] .breadcrumb{background:transparent;color:#64748b;}
html[data-theme="dark"] .breadcrumb>.active{color:#94a3b8;}
html[data-theme="dark"] .alert-success{background:#052e1a;border-color:#166534;color:#86efac;}
html[data-theme="dark"] .alert-info{background:#082f49;border-color:#075985;color:#7dd3fc;}
html[data-theme="dark"] .alert-warning{background:#2a1a05;border-color:#78350f;color:#fcd34d;}
html[data-theme="dark"] .alert-danger{background:#2a0a0a;border-color:#7f1d1d;color:#fca5a5;}
html[data-theme="dark"] .label-default{background:#334155;color:#e2e8f0;}
html[data-theme="dark"] .btn-link{color:#a5b4fc;}
html[data-theme="dark"] hr{border-top-color:#243044;}
html[data-theme="dark"] blockquote{border-left-color:#334155;color:#94a3b8;}

/* ---------- 页脚 ---------- */
html[data-theme="dark"] .site-footer{background:#070c16;border-top-color:#1e293b;color:#94a3b8;}
html[data-theme="dark"] .site-footer a{color:#a5b4fc;}
html[data-theme="dark"] .site-footer a:hover{color:#c7d2fe;}
html[data-theme="dark"] .site-footer h4{color:#e2e8f0;}
html[data-theme="dark"] .site-footer__desc{color:#94a3b8;}
html[data-theme="dark"] .site-footer__bottom{border-top-color:#1e293b;color:#64748b;}
html[data-theme="dark"] .site-footer .site-footer__logo{background:#111827;}
html[data-theme="dark"] .site-footer__qr-ph{background:#111827;color:#64748b;}
html[data-theme="dark"] .site-stats{color:#64748b;}

/* ---------- 悬浮按钮 / 提示 ---------- */
html[data-theme="dark"] .fab__btn{background:#1e293b;color:#c7d2fe;box-shadow:0 10px 24px rgba(0,0,0,.45);}
html[data-theme="dark"] .fab__qq{background:#1d4ed8;color:#fff;}
html[data-theme="dark"] .fab__btn:hover{background:#273449;}
html[data-theme="dark"] .search-tip{background:#1e1b4b;color:#c7d2fe;border-color:#3730a3;}

/* ---------- 工具引擎内联样式适配（JS 生成的浅色底/深色字） ---------- */
html[data-theme="dark"] #tool-app [style*="background:#f8fafc"],
html[data-theme="dark"] #tool-app [style*="background: #f8fafc"],
html[data-theme="dark"] #tool-app [style*="background:#ffffff"],
html[data-theme="dark"] #tool-app [style*="background:#fff"]{background:#0f172a !important;}
html[data-theme="dark"] #tool-app [style*="background:#eef2ff"]{background:#1e1b4b !important;}
html[data-theme="dark"] #tool-app [style*="border:1px solid #e2e8f0"],
html[data-theme="dark"] #tool-app [style*="border: 1px solid #e2e8f0"],
html[data-theme="dark"] #tool-app [style*="border:1px solid #cbd5e1"]{border-color:#243044 !important;}
html[data-theme="dark"] #tool-app [style*="color:#0f172a"],
html[data-theme="dark"] #tool-app [style*="color:#334155"]{color:#e2e8f0 !important;}
html[data-theme="dark"] #tool-app [style*="color:#475569"],
html[data-theme="dark"] #tool-app [style*="color:#64748b"],
html[data-theme="dark"] #tool-app [style*="color:#94a3b8"]{color:#94a3b8 !important;}
html[data-theme="dark"] #tool-app [style*="background:#fff;"],
html[data-theme="dark"] #tool-app [style*="background: #fff;"]{background:#111827 !important;}
html[data-theme="dark"] #tool-app canvas{background:#0f172a;}
html[data-theme="dark"] .rich-block [style*="background:#f8fafc"],
html[data-theme="dark"] .panel [style*="background:#f8fafc"]{background:#0f172a !important;}

/* ---------- 主题切换按钮 ---------- */
.theme-toggle{
  width:36px;height:36px;border-radius:10px;border:1px solid var(--line);
  background:var(--card);color:var(--muted);display:inline-flex;align-items:center;justify-content:center;
  cursor:pointer;flex:0 0 auto;transition:background .18s,color .18s,border-color .18s,transform .18s;
}
.theme-toggle:hover{color:var(--brand);border-color:#c7d2fe;background:var(--brand-soft);transform:translateY(-1px);}
.theme-toggle svg{width:17px;height:17px;display:none;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
html[data-theme-mode="auto"] .theme-toggle .tt-auto,
html[data-theme-mode="dark"] .theme-toggle .tt-moon,
html[data-theme-mode="light"] .theme-toggle .tt-sun{display:block;}
html[data-theme="dark"] .theme-toggle{background:#111827;border-color:#243044;color:#c7d2fe;}
html[data-theme="dark"] .theme-toggle:hover{background:#1e293b;border-color:#3730a3;}

/* ---------- 老版科学计算器 / 子网计算器（subnetmask.css） ---------- */
html[data-theme="dark"] .CalculatorWrap .CalculTable{
  background:#0f172a !important;border-color:#243044 !important;
}
html[data-theme="dark"] .CalculatorWrap .ShowArea{
  background:#111827 !important;color:#e2e8f0 !important;border-color:#243044 !important;
}
html[data-theme="dark"] .CalculatorWrap .heachackWrap,
html[data-theme="dark"] .CalculatorWrap .heachackWrap label,
html[data-theme="dark"] .CalculatorWrap .heachackWrap li,
html[data-theme="dark"] .CalculatorWrap .CentChackLeft li,
html[data-theme="dark"] .CalculatorWrap .CentChackSide li,
html[data-theme="dark"] .CalculatorWrap .CentChackRight li{color:#cbd5e1 !important;}
html[data-theme="dark"] .CalculatorWrap .heachackWrap li input.HTxt01{
  background:#1e293b !important;color:#e2e8f0 !important;border-color:#334155 !important;
}
html[data-theme="dark"] .CalculatorWrap input[type="radio"],
html[data-theme="dark"] .CalculatorWrap input[type="checkbox"]{accent-color:#818cf8;}
html[data-theme="dark"] .CalculatorWrap .CentChackLeft li input.Lcolor01,
html[data-theme="dark"] .CalculatorWrap .CentChackRight li input.Rcolor01{background:#4f46e5;border-color:#6366f1;}
html[data-theme="dark"] .CalculatorWrap .CentChackLeft li input.Lcolor02,
html[data-theme="dark"] .CalculatorWrap .CentChackSide input,
html[data-theme="dark"] .CalculatorWrap .CentChackRight li input.Rcolor02,
html[data-theme="dark"] .CalculatorWrap .heachackWrap li input.Hcolor01{background:#334155;border-color:#475569;}
html[data-theme="dark"] .CalculatorWrap .CodChangCent .CodCBtnWrap input.GBtn{background:#1e293b;color:#c7d2fe;border-color:#334155;}
html[data-theme="dark"] .CalculatorWrap .CodChangCent .CodCBtnWrap input.GLOkBtn{background:#4f46e5;color:#fff;}
