/* ==========================================================================
   内网工具集 · 设计系统 v1
   基线来源：jwt-decoder.html / json-toolkit.html / password-generator.html
   原则：单一数据源，所有工具只允许使用本文件的类，禁止内联颜色与字号
   ========================================================================== */

:root {
  /* 底与面
     三级灰阶必须拉开：底 236 / 面 255 / 凹槽 244，相邻差 4%~8%。
     2026-11 之前底是 #f6f8fb（与白卡只差 3.5%），凹槽 #fbfcfe 只差 1.6%，
     结果整站白卡悬在一片白上，只能靠 1px 描边划界——不要改回去。 */
  --bg: #eaedf3;
  --panel: #ffffff;
  --panel-sunken: #f4f6fa;
  --border: #e3e8ef;
  --border-strong: #cdd5df;

  /* 文字 */
  --text: #1f2937;
  --text-dim: #6b7280;
  --text-faint: #9ca3af;

  /* 主色 */
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff4ff;
  --accent-border: #bfdbfe;

  /* 语义色 */
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --ok-border: #a7f3d0;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;
  --err: #dc2626;
  --err-soft: #fef2f2;
  --err-border: #fecaca;

  /* 形状 */
  --mono: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 3px 8px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 60px;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶部横幅 ---------- */
/* 页头：跟首页同一套排法 —— 深色 h1 + 一行说明 + 承诺胶囊，没有色块。
   原来是一整条 140px 高的蓝渐变（#1e3a8a→#2563eb→#3b82f6），占 900px 视口的 15.5%。
   首页刻意做柔和了，一点进工具就撞回高饱和色，像是换了个站。
   承诺徽章是这个页头里唯一必须被看见的信息，保留但降为浅底语义色。 */
.hero {
  padding: 32px 0 2px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: 23px; font-weight: 600; letter-spacing: .2px;
  color: var(--text); line-height: 1.4;
}
.hero .sub {
  margin-top: 10px; font-size: 13.5px; color: var(--text-dim);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
}
.hero .badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ok-soft); color: var(--ok);
  border: 1px solid var(--ok-border);
  padding: 3px 11px; border-radius: 999px; font-size: 12.5px;
}
.hero .badge .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}
/* 需要联网的工具：换成琥珀色，和「不上传」的绿色一眼区分开 */
.hero .badge.is-net {
  background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border);
}
.hero .badge .dot.warn { background: currentColor; box-shadow: none; }
/* 第二个及以后是功能点（ssl-ca 的「完整证书链」「RSA / ECDSA」之类），
   不是安全承诺 —— 染成绿色等于把功能点包装成保证，用中性色 */
.hero .badge ~ .badge {
  background: var(--panel-sunken); color: var(--text-dim); border-color: var(--border);
}
.hero a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-border); }
.hero a:hover { border-bottom-color: var(--accent); }

/* ---------- 面板 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.panel-title {
  font-size: 15px; font-weight: 650; margin-bottom: 14px;
  display: flex; align-items: center; gap: 9px;
}
.panel-title .num {
  width: 22px; height: 22px; border-radius: var(--radius-xs); font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
  flex-shrink: 0;
}
.panel-title .right { margin-left: auto; font-size: 12.5px; font-weight: 400; color: var(--text-dim); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.label,
.field > label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-dim); margin-bottom: 6px;
}
input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
  width: 100%;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--panel-sunken);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { resize: vertical; min-height: 110px; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
  background: var(--panel);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
select { cursor: pointer; font-family: var(--sans); }

/* 复选框行 */
.check-row {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 13px; border: 1.5px solid var(--border);
  border-radius: 10px; cursor: pointer; background: var(--panel-sunken);
  transition: border-color .15s, background .15s;
}
.check-row:hover { border-color: var(--accent-border); }
.check-row.on { border-color: var(--accent); background: var(--accent-soft); }
.check-row input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.check-row .t { display: block; font-size: 13.5px; font-weight: 550; }
.check-row .d { display: block; font-size: 11.5px; color: var(--text-dim); margin-top: 2px; line-height: 1.5; }

/* ---------- 按钮 ---------- */
button {
  font-family: inherit; font-size: 13.5px; font-weight: 550;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; padding: 8px 16px;
  transition: background .15s, border-color .15s, transform .05s;
  line-height: 1.4;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-ghost { background: var(--panel); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-sunken); border-color: var(--border-strong); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover:not(:disabled) { background: #047857; }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }

/* 小复制按钮（贴在输出框右上） */
.copy-btn {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent);
  border: none; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.copy-btn:hover { background: var(--accent-border); }

/* ---------- 状态胶囊 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 560; border: 1px solid transparent;
}
.pill.ok   { background: var(--ok-soft);   color: var(--ok);   border-color: var(--ok-border); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.pill.err  { background: var(--err-soft);  color: var(--err);  border-color: var(--err-border); }
.pill.info { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.pill .ico { font-size: 13px; }
.status-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }

/* ---------- 输出块 ---------- */
.code-box {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.9;
  background: var(--panel-sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  word-break: break-all;
  white-space: pre-wrap;
  max-height: 420px;
  overflow: auto;
}
.code-box.scroll-x { white-space: pre; overflow-x: auto; word-break: normal; }

/* 带标题条的输出框 */
.out-block { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.out-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 12.5px; font-weight: 600;
  color: var(--text-dim); background: var(--panel-sunken);
  border-bottom: 1px solid var(--border);
}
.out-head .right { margin-left: auto; }
.out-body { padding: 14px 16px; }

/* ---------- 布局 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 920px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row > * { flex: 1; min-width: 140px; }
.row > .shrink { flex: 0 0 auto; min-width: 0; }

/* hidden 属性必须压过组件自身的 display:flex / grid */
[hidden] { display: none !important; }

/* ---------- 数据表 ---------- */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left; font-weight: 600; font-size: 12.5px;
  color: var(--text-dim); background: var(--panel-sunken);
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
.data-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--panel-sunken); }
.data-table td.mono, .mono { font-family: var(--mono); font-size: 12.5px; }
.data-table-wrap { max-height: 480px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }

/* ---------- 小统计卡 ---------- */
.stat-card {
  background: var(--panel-sunken); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.stat-card .k { font-size: 12px; color: var(--text-dim); font-weight: 600; margin-bottom: 4px; }
.stat-card .v { font-size: 20px; font-weight: 700; font-family: var(--mono); }

/* ---------- 文本 ---------- */
.hint { margin-top: 10px; font-size: 12.5px; color: var(--text-dim); }
.hint code, .about code {
  font-family: var(--mono); background: var(--panel-sunken);
  padding: 1px 6px; border-radius: 4px; font-size: 12px;
}
.about { font-size: 12.5px; color: var(--text-dim); line-height: 1.9; }
.about b { color: var(--text); font-weight: 600; }
.about ul { margin: 6px 0 0 18px; }
.about li { margin-bottom: 4px; }

/* ---------- 空状态 / 错误 ---------- */
.empty {
  padding: 26px 18px; text-align: center;
  color: var(--text-dim); font-size: 13.5px;
  border: 1px dashed var(--border); border-radius: 10px;
  background: var(--panel-sunken);
}
.err-box {
  background: var(--err-soft); border: 1px solid var(--err-border);
  color: var(--err); border-radius: 10px; padding: 12px 14px;
  font-size: 13px; line-height: 1.7;
}
.err-box .loc { margin-top: 6px; font-size: 12.5px; color: var(--text-dim); }
.err-box .caret {
  font-family: var(--mono); color: var(--err);
  background: var(--panel); border-radius: 4px; padding: 2px 6px; display: inline-block; margin-top: 4px;
}

/* ---------- 分段选择器 ---------- */
.seg {
  display: inline-flex; background: var(--panel-sunken);
  border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px;
}
.seg button {
  background: transparent; border: none; border-radius: 7px;
  padding: 6px 14px; font-size: 13px; color: var(--text-dim);
}
.seg button.on { background: var(--panel); color: var(--accent); box-shadow: 0 1px 2px rgba(16,24,40,.08); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(12px);
  background: #1f2937; color: #fff; font-size: 13.5px;
  padding: 10px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #059669; }
.toast.err { background: #dc2626; }

/* ---------- 手动复制兜底浮层 ---------- */
/* 自动复制被浏览器拦下时弹出，内容是已选中的，用户按 Ctrl+C 就能完成 */
.mcopy {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 99998;
  background: rgba(17, 24, 39, .42);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.mcopy-box {
  width: 100%; max-width: 520px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 18px 48px rgba(16, 24, 40, .22);
  padding: 18px 20px;
}
.mcopy-t { font-size: 14px; font-weight: 650; line-height: 1.5; margin-bottom: 12px; }
.mcopy-sub {
  font-size: 12.5px; font-weight: 400; color: var(--text-dim);
  margin-top: 5px; line-height: 1.8;
}
.mcopy-t kbd {
  font-family: var(--mono); font-size: 11.5px; padding: 1px 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 4px; background: var(--panel-sunken); color: var(--text-dim);
}
.mcopy-ta {
  width: 100%; min-height: 76px; max-height: 180px; resize: vertical;
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
  padding: 10px 12px;
  border: 1.5px solid var(--accent); border-radius: 9px;
  background: var(--accent-soft); color: var(--text);
  outline: none; word-break: break-all;
}
.mcopy-act { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ---------- 工具页导航 ----------
   内容由 scripts/toolnav.js 在构建时注入，样式在这里统一维护。
   为什么要插在页面里而不是纯靠浏览器后退：公网主要流量是搜索引擎直达工具页，
   退回去是搜索结果，不是本站——没有这条导航，用户看完一个工具就走了。 */
.tool-nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin: 18px 0 14px; font-size: 12.5px; color: var(--text-dim);
}
.tool-back {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px; text-decoration: none;
  color: var(--text-dim); background: var(--panel);
  border: 1px solid var(--border); transition: all .14s;
}
.tool-back:hover, .tool-back:focus-visible {
  color: var(--accent); border-color: var(--accent-border);
  background: var(--accent-soft); outline: none;
}
.tool-back .ar { font-size: 13px; line-height: 1; }
.tool-crumb { min-width: 0; }
.tool-crumb a {
  color: var(--text-dim); text-decoration: none;
  border-bottom: 1px solid transparent;
}
.tool-crumb a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.tool-crumb .sp { margin: 0 6px; opacity: .45; }
.tool-crumb em { font-style: normal; color: var(--text); }
/* 右侧这一组（收藏 + 主题）由收藏按钮的 margin-left:auto 推过去。
   面包屑和返回在左，两个「环境级」的开关在右，不抢正文。 */
.tool-nav .theme-btn { margin-left: 6px; width: 30px; height: 30px; border-radius: 8px; }

/* 收藏按钮：和主题按钮同一排，但它是文字按钮 —— 一颗光秃秃的星星，
   普通用户不知道点了会发生什么；「收藏 / 已收藏」把话说清楚。
   状态完全由 aria-pressed 驱动，不再另存一个 .is-on 类，少一处会不同步的地方。 */
.fav-btn {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  margin-left: auto; height: 30px; padding: 0 10px;
  font-family: var(--sans); font-size: 12.5px;
  color: var(--text-dim); background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: color .14s, border-color .14s, background .14s;
}
.fav-btn svg { width: 14px; height: 14px; }
.fav-btn:hover, .fav-btn:focus-visible {
  color: var(--accent); border-color: var(--accent-border);
  background: var(--accent-soft); outline: none;
}
/* 已收藏：星星填实 + 琥珀色。用 warn 而不用 accent，是为了和「点一下会变」
   的蓝色按钮区分开 —— 已收藏是「一个状态」，不是一个可点的动作。 */
.fav-btn[aria-pressed="true"] {
  color: var(--warn); border-color: var(--warn-border); background: var(--warn-soft);
}
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
@media (max-width: 640px) {
  /* 窄屏只留星星：面包屑已经折行了，再加两个字会把按钮挤出去 */
  .fav-btn { padding: 0 8px; }
  .fav-btn .fav-tx { display: none; }
}

/* 底部：同类的还有 */
.tool-more {
  margin: 34px 0 8px; padding-top: 20px; border-top: 1px solid var(--border);
}
.tool-more-h {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--text);
}
.tool-more-h span { font-size: 12px; font-weight: 400; color: var(--text-faint); }
.tool-more-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 10px;
}
.tool-more-card {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px;
  text-decoration: none; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: all .14s;
}
.tool-more-card:hover, .tool-more-card:focus-visible {
  border-color: var(--accent); outline: none; box-shadow: 0 2px 10px rgba(37, 99, 235, .09);
}
.tool-more-card .ico {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border);
}
.tool-more-card .body { min-width: 0; }
.tool-more-card .nm { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.tool-more-card .br { display: block; font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.tool-more-foot { margin-top: 12px; font-size: 12.5px; }
.tool-more-foot a { color: var(--accent); text-decoration: none; }
.tool-more-foot a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .tool-nav { margin: 14px 0 12px; }
  .tool-crumb { flex: 1 0 100%; order: 2; }
  .tool-more-grid { grid-template-columns: 1fr; }
}

/* ---------- 页脚 ----------
   内容由 scripts/footer.js 在构建时注入，样式在这里统一维护 */
.foot {
  max-width: 1180px; margin: 36px auto 0; padding: 18px 20px 34px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-faint); text-align: center; line-height: 1.9;
}
.foot-row {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 0 4px;
}
.foot-row + .foot-row { margin-top: 2px; }
/* 分隔符用伪元素挂在每项前面：flex 换行时它跟内容一起走，
   不会像独立的 <span>·</span> 那样孤零零留在行尾 */
.foot-row > * + *::before {
  content: '·'; margin-right: 7px; color: var(--border); font-weight: 400;
}
.foot a {
  color: var(--text-dim); text-decoration: none;
  border-bottom: 1px solid transparent; transition: color .15s, border-color .15s;
}
.foot a:hover { color: var(--accent); border-bottom-color: var(--accent); }
/* 公安备案：图标在前、编号在右，图标随链接一起可点（公安要求）
   图标是 36×40 的国徽盾牌，按 18×20 显示（原图正好一半，像素不糊）
   注意 ::before 的分隔符：.beian 变成 inline-flex 后伪元素成了 flex 项，
   它自带的 margin-right:7px 会和 flex gap 叠加，左边 4px、右边 11px 不对称，
   所以这里把 margin 归零，两边都交给 gap 管 */
.foot a.beian { display: inline-flex; align-items: center; gap: 4px; }
.foot a.beian::before { margin-right: 0; }
.foot .beian-ico {
  display: block; width: 18px; height: 20px; flex: 0 0 auto;
  vertical-align: middle;
}
.foot-notice { font-size: 11.5px; }

/* ---------- 建议在电脑上使用 ----------
   只有交互依赖鼠标精度的工具才有这一条（数据在 scripts/desk-hint.js）。
   桌面不显示：能用鼠标的人不需要被告知这件事，显示了反而是噪音。
   900px 起提示，因为平板上拖节点也已经很难对准。 */
.desk-hint { display: none; }

@media (max-width: 900px) {
  .desk-hint {
    display: flex; align-items: flex-start; gap: 10px;
    margin-bottom: 14px; padding: 12px 14px;
    background: var(--accent-soft); border: 1px solid var(--accent-border);
    border-radius: 10px; color: var(--text-dim);
    font-size: 12.5px; line-height: 1.7;
  }
  .desk-hint .dh-ico { flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
  .desk-hint .dh-body { min-width: 0; }
  .desk-hint b { display: block; color: var(--text); font-size: 13px; margin-bottom: 2px; }
  .desk-hint span { display: block; }
  .desk-hint em { display: block; margin-top: 3px; font-style: normal; color: var(--text-faint); }
}

/* ---------- 手机端（≤640px） ----------
   改这套规则时守住三条：
   ① 任何内容不许撑出视口横向滚动；② 输入框字号 ≥16px（iOS 聚焦时不放大整页）；
   ③ 可点元素高度 ≥40px（拇指能点中）。 */
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }

  .hero { padding: 22px 0 18px; margin-bottom: 16px; }
  .hero h1 { font-size: 21px; line-height: 1.35; }
  .hero .sub { font-size: 12.5px; gap: 6px 10px; margin-top: 6px; }
  .hero .badge { padding: 2px 9px; font-size: 12px; }

  .panel { padding: 15px 14px; border-radius: 10px; margin-bottom: 14px; }
  /* 标题和右上角说明抢位置时，说明换到下一行，标题不被挤断字
     （「工资与五险一金」曾在 390px 下断成「工资与基 / 金」） */
  .panel-title { font-size: 14.5px; margin-bottom: 12px; flex-wrap: wrap; row-gap: 3px; }
  .panel-title .right { font-size: 11.5px; margin-left: 0; flex: 1 0 100%; }

  /* iOS Safari：font-size < 16px 的输入框聚焦时会强制放大整页。
     !important 是必要的：各工具页有自己的 `.opts input`、内联 style 之类
     更高优先级规则，不加就会被压回 13px（实测 40 个页面中招）。
     用 :not() 排除不可输入的类型，而不是只列举 type="text"——
     很多老页面写的是 <input id="x"> 不带 type，属性选择器匹配不到。 */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
  textarea, select { font-size: 16px !important; }

  .btn, .btn-primary, .btn-ghost, .btn-ok, .btn-danger { min-height: 40px; }
  .btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; }
  .btn-row { gap: 8px; margin-top: 10px; }

  /* 分段按钮：默认 30px 高，手机上不好点 */
  .seg button { min-height: 36px; padding: 6px 12px; font-size: 13px; }

  /* 原生复选框/单选在手机上只有 16px，放大到能点中 */
  input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; }
  .check-row { padding: 10px 11px; gap: 10px; }

  /* 滑块整条加高：拇指本身不变，但可点区域从 16px 变成 30px，
     手指点在轨道任意位置都能跳转，不再「拖半天没反应」 */
  input[type="range"] { height: 30px; }
  input[type="color"] { min-height: 40px; padding: 3px; }

  /* 表格缩小内边距，让更多列挤进一屏；仍然依赖外层 overflow 横向滚动 */
  .data-table { font-size: 12.5px; }
  .data-table th, .data-table td { padding: 8px 9px; }
  .data-table th { font-size: 11.5px; }
  .data-table td.mono, .mono { font-size: 11.5px; }

  .hint, .about { font-size: 12px; }
  .verdict { font-size: 13px; line-height: 1.75; }

  /* 长 URL / 哈希 / 证书链这类不可断词的内容，窄屏下允许从任意位置断开 */
  .out-body, .hint, .verdict { overflow-wrap: anywhere; }
}

/* 窄屏：换行后「·」会跑成行首，改用间距区分更干净 */
@media (max-width: 560px) {
  .foot-row { gap: 2px 14px; }
  .foot-row > * + *::before { content: none; }
  .foot-row + .foot-row { margin-top: 4px; }
}

/* ---------- 打印 ---------- */
@media print {
  .hero, .btn-row, .copy-btn, .foot { display: none !important; }
  body { background: #fff; padding: 0; }
  .panel { box-shadow: none; border-color: #ddd; page-break-inside: avoid; }
}

/* ==========================================================================
   深浅色主题（v3.37.0）
   --------------------------------------------------------------------------
   深色只覆盖 :root 里的变量，不改任何组件规则：126 个工具页的面板、表格、
   输入框、结果区都吃 var()，所以主题能一路穿进每个工具，不用逐页改。
   「跟随系统」由 assets/js/theme.js 在首屏前折算成 data-theme，CSS 里只认
   两个显式值，避免同一套变量写两遍、以后改一处漏一处。
   ========================================================================== */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

html[data-theme="dark"] {
  --bg: #0a0d12;
  --panel: #161b22;
  --panel-sunken: #1b212a;
  --border: #252c37;
  --border-strong: #333c49;

  --text: #e4e9f0;
  --text-dim: #9aa5b5;
  --text-faint: #6b7686;

  --accent: #6b9bff;
  --accent-dark: #8cb2ff;
  --accent-soft: #16233a;
  --accent-border: #2b4270;

  --ok: #35c48f;
  --ok-soft: #10281f;
  --ok-border: #1e4b39;
  --warn: #e0a03a;
  --warn-soft: #2a2010;
  --warn-border: #4a3a1a;
  --err: #f0736a;
  --err-soft: #2a1414;
  --err-border: #4a2222;

  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .4);
}

/* 页头已经不带背景色，深色下不需要单独的压暗版本 */

/* 主题切换按钮 */
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); color: var(--text-dim);
  cursor: pointer; transition: color .14s, border-color .14s, background .14s;
}
.theme-btn:hover, .theme-btn:focus-visible {
  color: var(--accent); border-color: var(--accent-border);
  background: var(--accent-soft); outline: none;
}
.theme-btn svg { width: 16px; height: 16px; }
/* 深色模式下按钮显示「太阳」，浅色显示「月亮」，靠这个类切换图标 */
html[data-theme="dark"] .theme-btn .ico-sun { display: block; }
html[data-theme="dark"] .theme-btn .ico-moon { display: none; }
.theme-btn .ico-sun { display: none; }
.theme-btn .ico-moon { display: block; }

/* 横幅里的按钮跟着恢复默认浅底样式（页头不再是深蓝色块了） */

/* 重点标记：用户视角的「这条你必须看见」。
   一屏最多两处，用多了等于没用。 */
.hi { font-weight: 600; color: var(--text); }
.hi-amber { font-weight: 600; color: var(--warn); }

/* ---------- 深色补丁 ----------
   126 个工具页里有 40 个把浅色写死在局部 <style> 或行内 style 上（表格表头、
   文本框、说明卡片、画布提示条…）。逐页改是 40 处且改不干净——行内 style
   的优先级最高，只能靠 !important 兜底。这里只兜「面」的颜色，
   不碰文字色，也不碰品牌色和色卡（web-safe-color 那类要显示真实颜色）。
   规则由 tests/_tmp/darkaudit.js 扫全站列出，改完再扫一遍确认没漏。 */
html[data-theme="dark"] th,
html[data-theme="dark"] tr.row-sep {
  background: var(--panel-sunken) !important;
  color: var(--text-dim);
}
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .seg button.on,
html[data-theme="dark"] a.tool-back {
  background: var(--panel) !important;
  color: var(--text);
}
html[data-theme="dark"] code,
html[data-theme="dark"] pre,
html[data-theme="dark"] .ychip,
html[data-theme="dark"] .keybox {
  background: var(--panel-sunken) !important;
  color: var(--text);
}
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] input:not([type]),
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="url"] {
  background-color: var(--panel-sunken) !important;
  color: var(--text);
}
html[data-theme="dark"] .type-card,
html[data-theme="dark"] .scope-c,
html[data-theme="dark"] .mode-card,
html[data-theme="dark"] .hl,
html[data-theme="dark"] .ed-pane,
html[data-theme="dark"] .seg-wrap,
html[data-theme="dark"] .acell.ctrl,
html[data-theme="dark"] .panel {
  background-color: var(--panel) !important;
}
/* 画布类工具的浮动提示条：浅色玻璃改成深色玻璃 */
html[data-theme="dark"] .canvas-tip,
html[data-theme="dark"] .zoom-hud {
  background: rgba(22, 27, 34, .92) !important;
  color: var(--text-dim);
  border-color: var(--border);
}
html[data-theme="dark"] .ok-line {
  background: var(--ok-soft) !important; border-color: var(--ok-border) !important;
  color: var(--ok) !important;
}
html[data-theme="dark"] .warn-line {
  background: var(--warn-soft) !important; border-color: var(--warn-border) !important;
  color: var(--warn) !important;
}

/* 万年历用了「暖纸」配色：整块容器自己覆盖了一套令牌（.wnl）。
   深色下不把它刷成通用深蓝，而是保留纸的暖调、只压暗——它本来就该像一张深色宣纸。 */
html[data-theme="dark"] .wnl {
  --bg: #14110c;
  --panel: #1b1712;
  --panel-sunken: #201b15;
  --border: #2e2820;
  --border-strong: #3b3327;
  --text: #ece5d8;
  --text-dim: #a89e8d;
  --text-faint: #7c7364;
  /* 纸纹里那层暖白光晕是写死的 #FDFAF4，压暗令牌换不掉它 ——
     深色下页面顶部会有一大块暖白。换成极暗的暖光，纸纹的质感留着。 */
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 236, 200, .012) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 236, 200, .008) 0 1px, transparent 1px 4px),
    radial-gradient(130% 68% at 50% -8%, #1c1710 0%, rgba(28, 23, 16, 0) 62%);
}

/* 第二轮审计补漏（darkaudit.js 扫出来的最后几处） */
html[data-theme="dark"] label.check,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .trail-row,
html[data-theme="dark"] button.on {
  background-color: var(--panel-sunken) !important;
  color: var(--text);
}
html[data-theme="dark"] .bad-line {
  background: var(--err-soft) !important; border-color: var(--err-border) !important;
  color: var(--err) !important;
}
html[data-theme="dark"] .result-row { background-color: var(--panel-sunken) !important; }
[data-theme="dark"] .acell.del { background-color: var(--err-soft) !important; color: var(--err) !important; }
html[data-theme="dark"] .meter { background-color: var(--border) !important; }
