/* ===== ToolBox 工具盒子 - Global Styles ===== */
:root {
  --bg: #f5f7fb;
  --bg-soft: #ffffff;
  --bg-mute: #eef1f8;
  --text: #16181d;
  --text-soft: #5b6070;
  --text-dim: #8b90a0;
  --line: #e3e7f0;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef0ff;
  --ok: #0f9d58;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1160px;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --bg: #0d0f15;
  --bg-soft: #151824;
  --bg-mute: #1c2030;
  --text: #eef1f8;
  --text-soft: #a9b0c4;
  --text-dim: #767e94;
  --line: #262c3c;
  --brand: #7c8bff;
  --brand-2: #a78bfa;
  --brand-soft: #1e2340;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text); letter-spacing: -.2px; }
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff; font-size: 16px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--text-dim); letter-spacing: .4px; }
.header-nav { display: flex; gap: 4px; margin-left: 12px; }
.header-nav a { color: var(--text-soft); font-size: 14px; padding: 7px 11px; border-radius: 8px; }
.header-nav a:hover { background: var(--bg-mute); text-decoration: none; color: var(--text); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  height: 36px; min-width: 36px; padding: 0 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text-soft);
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: .16s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Hero ---------- */
.hero { padding-top: 56px; padding-bottom: 26px; text-align: center; }
.hero h1 {
  margin: 0 0 12px; font-size: clamp(24px, 4.4vw, 42px); line-height: 1.3;
  letter-spacing: -.9px; font-weight: 800;
}
.hero h1 em {
  font-style: normal; display: inline-block;
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0 auto 26px; max-width: 660px; color: var(--text-soft); font-size: 15.5px; }
.hero-stats { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; color: var(--text-dim); font-size: 13px; }
.hero-stats b { color: var(--text); font-size: 15px; }

/* ---------- Search ---------- */
.search-box {
  position: relative; max-width: 560px; margin: 0 auto 26px;
}
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); opacity: .5; }
.search-box input {
  width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg-soft); padding: 0 44px 0 44px; font-size: 15px; color: var(--text);
  box-shadow: var(--shadow); outline: none; transition: .18s;
}
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search-box kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; background: var(--bg-mute);
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 24px; }
.tab {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text-soft);
  padding: 8px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: .16s; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { border-color: var(--brand); color: var(--brand); }
.tab.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .3); }
.tab .count { font-size: 11px; opacity: .65; font-weight: 500; }

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card {
  position: relative; text-align: left; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; transition: .18s; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px transparent; transition: .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.card-icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  font-size: 20px; background: var(--brand-soft); color: var(--brand); margin-bottom: 2px;
}
.card h3 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; display: flex; align-items: center; gap: 6px; }
.card p { margin: 0; font-size: 13px; color: var(--text-soft); line-height: 1.55; }
.card .hot { font-size: 10px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #f97316, #ef4444); padding: 1px 6px; border-radius: 5px; letter-spacing: .2px; }

/* ---------- 分类分块 + 翻页 ---------- */
.cat-list { display: block; }
.cat-block { margin-bottom: 38px; }
.cat-block:last-child { margin-bottom: 0; }/* 首页热门区块（按使用热度排序的那一块） */
.hot-block {
  padding: 18px 18px 8px;
  margin-bottom: 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(99,102,241,.055), rgba(99,102,241,0));
}
.hot-block .cat-head h3 { font-size: 19px; }
.cat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cat-head h3 { margin: 0; font-size: 18.5px; letter-spacing: -.3px; }
.cat-head .cnt {
  font-size: 11.5px; color: var(--text-dim); background: var(--bg-mute);
  padding: 3px 9px; border-radius: 999px; font-weight: 600;
}
.cat-jump {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--brand); padding: 4px 2px;
}
.cat-jump:hover { text-decoration: underline; }
.cat-more { display: flex; justify-content: center; margin-top: 16px; }
.cat-more .btn { min-width: 180px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 28px; }
.pg-btn {
  min-width: 36px; height: 36px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text-soft);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: .16s;
}
.pg-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pg-btn.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-info { font-size: 12.5px; color: var(--text-dim); padding: 0 6px; }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 20px 0; min-height: 92px; border: 1px dashed var(--line); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px;
  background: var(--bg-soft); color: var(--text-dim); font-size: 12px; text-align: center;
  padding: 14px; overflow: hidden;
}
.ad-slot span.tag { font-size: 10px; letter-spacing: .8px; text-transform: uppercase; opacity: .55; white-space: nowrap; font-weight: 600; }
.ad-slot .hint { font-size: 11px; opacity: .62; }
.ad-slot.in-grid { grid-column: 1 / -1; margin: 4px 0; min-height: 100px; }

/* ---------- Sections ---------- */
.section, section[id] { scroll-margin-top: 84px; }

.section { padding-top: 46px; padding-bottom: 46px; }
.hero + .wrap > .ad-slot, .wrap > .ad-slot[data-slot="top"] { margin-bottom: 4px; }
.wrap > .ad-slot + .section { padding-top: 22px; }
#tools.section { padding-top: 44px; }
.section-head { text-align: center; margin-bottom: 28px; }
.section-head h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.6px; }
.section-head p { margin: 0; color: var(--text-soft); }
.prose { max-width: 860px; margin: 0 auto; }
.prose h3 { font-size: 17px; margin: 26px 0 8px; }
.prose h3:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--text-soft); font-size: 14.5px; }
.prose ul { padding-left: 20px; }

.feature-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.feature {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px;
}
.feature .fi { font-size: 22px; margin-bottom: 8px; }
.feature h4 { margin: 0 0 6px; font-size: 15px; }
.feature p { margin: 0; font-size: 13px; color: var(--text-soft); }

/* ---------- FAQ ---------- */
.faq { max-width: 860px; margin: 0 auto; display: grid; gap: 10px; }
.faq details {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 18px;
}
.faq summary { cursor: pointer; font-weight: 650; font-size: 14.5px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--text-dim); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 10px 0 0; color: var(--text-soft); font-size: 14px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 34px 0 40px; margin-top: 40px; }
.footer-grid { display: flex; gap: 30px; flex-wrap: wrap; justify-content: space-between; }
.footer-col h5 { margin: 0 0 10px; font-size: 13px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.footer-col a { display: block; color: var(--text-soft); font-size: 13.5px; padding: 3px 0; }
.footer-brand { max-width: 300px; }
.footer-brand p { font-size: 13px; color: var(--text-dim); margin: 8px 0 0; }
.copyright { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-dim); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 18, .55);
  backdrop-filter: blur(4px); display: none; align-items: flex-start; justify-content: center;
  padding: 32px 16px; overflow-y: auto;
}
.modal-mask.open { display: flex; }
.modal {
  width: 100%; max-width: 880px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; margin: auto 0;
  animation: pop .2s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px;
  border-bottom: 1px solid var(--line); background: var(--bg-soft);
  position: sticky; top: 0; z-index: 2;
}
.modal-head .card-icon { width: 36px; height: 36px; font-size: 18px; border-radius: 10px; margin: 0; }
.modal-title { flex: 1; min-width: 0; }
.modal-title h2 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.modal-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-dim); }
.modal-close {
  border: 1px solid var(--line); background: transparent; color: var(--text-soft);
  width: 32px; height: 32px; border-radius: 9px; cursor: pointer; font-size: 16px; flex: 0 0 auto;
}
.modal-close:hover { color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 20px; }

/* ---------- Form controls ---------- */
.ta, .inp, select.inp {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-soft); color: var(--text); padding: 11px 13px; font-size: 14px;
  font-family: inherit; outline: none; transition: .15s; resize: vertical;
}
.ta { font-family: var(--mono); font-size: 13px; line-height: 1.55; min-height: 120px; }
.ta:focus, .inp:focus, select.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
select.inp { cursor: pointer; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.help { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

.btn {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.06); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-soft); cursor: pointer; user-select: none; }
.check input { accent-color: var(--brand); width: 15px; height: 15px; }

.out {
  background: var(--bg-mute); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow: auto; margin: 0;
  color: var(--text);
}
.out:empty::before { content: attr(data-empty); color: var(--text-dim); font-family: inherit; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 20px; letter-spacing: -.5px; }
.stat span { font-size: 11.5px; color: var(--text-dim); }
table.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.kv td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; word-break: break-word; }
table.kv tr:last-child td { border-bottom: 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; background: var(--bg-soft); }
mark { background: #fde68a; color: #111; border-radius: 3px; padding: 0 1px; }
html[data-theme="dark"] mark { background: #a16207; color: #fff; }

.diff-line { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; padding: 1px 8px; border-radius: 4px; }
.diff-add { background: rgba(15, 157, 88, .13); color: var(--ok); }
.diff-del { background: rgba(220, 38, 38, .12); color: var(--danger); }
.diff-same { color: var(--text-soft); }

.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 30px 18px;
  text-align: center; color: var(--text-soft); cursor: pointer; transition: .15s; background: var(--bg-soft);
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.dropzone strong { display: block; font-size: 14px; margin-bottom: 4px; color: var(--text); }
.dropzone small { font-size: 12px; color: var(--text-dim); }
.preview-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background:
  repeating-conic-gradient(var(--bg-mute) 0% 25%, var(--bg-soft) 0% 50%) 50% / 16px 16px; }
.preview-wrap img { margin: 0 auto; max-height: 320px; width: auto; }
.file-info { font-size: 12.5px; color: var(--text-soft); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #16181d; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: .22s; z-index: 200;
  box-shadow: var(--shadow-lg); max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Language toggle ---------- */
html[data-lang="zh"] .lang-en { display: none !important; }
html[data-lang="en"] .lang-zh { display: none !important; }

.hidden { display: none !important; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); grid-column: 1 / -1; }

@media (max-width: 720px) {
  .header-nav { display: none; }
  .hero { padding-top: 34px; padding-bottom: 18px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 14px; }
  .card p { display: none; }
  .card h3 { font-size: 13.5px; }
  .card-icon { width: 34px; height: 34px; font-size: 17px; }
  .modal-mask { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .section { padding-top: 34px; padding-bottom: 34px; }
  /* 表单在窄屏一律换行占满，避免滑块被压成一条线 */
  .row > .grow { flex: 1 1 100%; }
  .row > .field, .row > div > .field { width: 100%; }
  .row { gap: 10px; }
  .modal-body { padding: 16px; }
}

/* ---------- 独立工具页（SEO 静态页） ---------- */
.tool-pg { max-width: 1080px; padding: 22px 20px 60px; }
.crumb { font-size: 12.5px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.crumb a { color: var(--text-dim); text-decoration: none; }
.crumb a:hover { color: var(--brand); }
.crumb em { font-style: normal; color: var(--text-soft); }
.tool-h1 { font-size: 26px; line-height: 1.3; margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
.tool-h1 .tool-ico { font-size: 26px; }
.tool-lead { font-size: 15px; color: var(--text-soft); margin: 0 0 6px; }
.tool-note { font-size: 12.5px; color: var(--text-dim); margin: 0 0 22px; }
.tool-mount { border: 1px solid var(--line); border-radius: 16px; background: var(--bg-card, #fff); padding: 20px; box-shadow: var(--shadow); }
.tool-inline-body { min-height: 60px; }
.tool-inline-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.tool-inline-bar .btn { font-size: 13px; padding: 7px 14px; text-decoration: none; }
.related { margin-top: 44px; }
.related h2 { font-size: 18px; margin: 0 0 6px; }
.related-list { list-style: none; padding: 0; margin: 14px 0 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.related-list li a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; font-size: 13.5px; background: var(--bg-soft); }
.related-list li a:hover { border-color: var(--brand); color: var(--brand); }
.foot-line { font-size: 13px; color: var(--text-dim); margin: 0 0 8px; }
.foot-line a { color: var(--text-soft); text-decoration: none; }
.foot-line a:hover { color: var(--brand); }
@media (max-width: 720px) {
  .tool-pg { padding: 16px 14px 44px; }
  .tool-h1 { font-size: 21px; }
  .tool-mount { padding: 14px; border-radius: 12px; }
  .related-list { grid-template-columns: 1fr 1fr; }
}
.card h3 .card-a { color: inherit; text-decoration: none; }
.card h3 .card-a:hover { color: var(--brand); }
