/* ==========================================================
   云狐工具 — 设计系统
   ========================================================== */
:root {
  --bg: #f5f6f9;
  --bg-elev: #ffffff;
  --bg-soft: #fafbfc;
  --bg-inset: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #98a2b3;
  --brand: #2f5bea;
  --brand-strong: #1f43c4;
  --brand-soft: #eef2ff;
  --green: #079455;
  --green-soft: #ecfdf3;
  --red: #d92d20;
  --red-soft: #fef3f2;
  --amber: #b54708;
  --amber-soft: #fffaeb;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 6px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 18px 40px -12px rgba(16, 24, 40, .18);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  --max: 1180px;
}

html[data-theme="dark"] {
  --bg: #0b0e14;
  --bg-elev: #131822;
  --bg-soft: #171d28;
  --bg-inset: #0f141d;
  --border: #232b38;
  --border-strong: #313b4c;
  --text: #e9eef6;
  --text-2: #a3aec0;
  --text-3: #6b7789;
  --brand: #7c97ff;
  --brand-strong: #a3b8ff;
  --brand-soft: #1a2240;
  --green: #4ade80;
  --green-soft: #10241a;
  --red: #f87171;
  --red-soft: #2a1414;
  --amber: #fbbf24;
  --amber-soft: #271e0d;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  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; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
img { max-width: 100%; }
::selection { background: var(--brand); color: #fff; }

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

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  height: 62px; display: flex; align-items: center; gap: 18px;
  max-width: var(--max); margin: 0 auto; padding: 0 22px;
  position: relative;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 17px; color: var(--text); letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(140deg, #4a72ff, #2f5bea 55%, #1640b8);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 2px 8px rgba(47, 91, 234, .35);
}
.logo-mark svg { width: 17px; height: 17px; }
.logo em { font-style: normal; color: var(--brand); }
.nav { display: flex; gap: 2px; margin-left: 6px; align-items: center; }
.nav-item { position: static; }
.nav-top {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 9px; border-radius: 8px; color: var(--text-2);
  font-size: 13.8px; font-weight: 500; transition: .15s; white-space: nowrap; cursor: pointer;
}
.nav-top svg { width: 11px; height: 11px; opacity: .5; transition: transform .18s; }
.nav-top:hover { background: var(--bg-inset); color: var(--text); text-decoration: none; }
.nav-top.on { background: var(--brand-soft); color: var(--brand); }
.nav-item:hover .nav-top svg { transform: rotate(180deg); }
/* 悬停下拉：小分类横向铺开 + 各自工具清单（宽度随内容自适应，left 由脚本按触发项对齐并夹在视口内） */
.nav-drop {
  position: absolute; top: 100%; left: 22px; right: auto;
  display: flex; align-items: flex-start; justify-content: flex-start;
  gap: 8px 22px; flex-wrap: wrap;
  width: max-content; max-width: calc(100vw - 40px);
  padding: 12px 18px 14px; margin-top: 5px; border-radius: 14px;
  background: var(--bg-elev); border: 1px solid var(--border);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .15);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s .16s;
  z-index: 70;
}
.nav-drop::before { content: ""; position: absolute; top: -12px; left: 0; right: 0; height: 13px; }
.nav-item:hover .nav-drop,
.nav-item:focus-within .nav-drop { opacity: 1; visibility: visible; transform: translateY(0); transition-delay: 0s; }
.drop-col { min-width: 0; flex: 0 0 auto; }
.drop-cat {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 13px; font-weight: 650; color: var(--text);
  padding: 5px 2px 6px; margin-bottom: 6px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.drop-cat:hover { color: var(--brand); text-decoration: none; }
.drop-cat span { font-size: 11px; font-weight: 500; color: var(--text-3); background: var(--bg-inset); padding: 1px 7px; border-radius: 100px; }
.drop-links { display: grid; gap: 1px; }
/* 工具多的分类自动分成两小列竖排，避免整块下拉过高 */
.drop-links.long {
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--rows, 10), auto);
  gap: 1px 14px;
}
.drop-links a {
  display: block;
  font-size: 12.8px; color: var(--text-2); padding: 4px 7px;
  border-radius: 6px; white-space: nowrap; transition: .12s;
}
.drop-links.long a { min-width: 120px; }
/* 窄屏压缩两小列宽度，保证四块小分类仍排在同一行 */
@media (max-width: 1120px) {
  .nav-drop { gap: 8px 10px; padding: 10px 10px 12px; }
  .drop-links.long { gap: 1px 6px; }
  .drop-links.long a { min-width: 0; padding: 4px 4px; font-size: 12px; }
  .drop-cat { font-size: 12.4px; gap: 6px; }
}
/* 更窄时下拉改为单列纵排（每行一个分类块），避免挤压折行 */
@media (max-width: 1010px) and (min-width: 941px) {
  .nav-drop { flex-direction: column; gap: 6px; max-height: calc(100vh - 120px); overflow-y: auto; }
}
.drop-links a:hover { background: var(--bg-inset); color: var(--text); text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-trigger {
  display: flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 9px 0 11px; min-width: 178px;
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text-3); font-size: 13.5px;
  cursor: pointer; transition: .15s; font-family: inherit;
}
.search-trigger:hover { border-color: var(--border-strong); background: var(--bg-soft); }
.search-trigger svg { width: 15px; height: 15px; flex: 0 0 auto; }
.search-trigger span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbd {
  font-family: var(--mono); font-size: 10.5px; padding: 2px 6px;
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; background: var(--bg-elev); color: var(--text-3); line-height: 1.4;
}
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-2); cursor: pointer; transition: .15s; padding: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 17px; height: 17px; }

@media (max-width: 940px) {
  .nav { display: none; }
  .search-trigger { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger .kbd { display: none; }
}

/* ---------- 移动端汉堡导航（≤940px 显示） ---------- */
.menu-btn { display: none; }
.m-nav { display: none; }
@media (max-width: 940px) {
  html.js .menu-btn { display: grid; }
  .menu-btn svg { width: 19px; height: 19px; }
  .menu-btn.on { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
  .m-nav {
    display: block; position: fixed; top: 62px; left: 0; right: 0; bottom: 0;
    background: var(--bg);
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 12px 18px calc(24px + env(safe-area-inset-bottom));
    z-index: 55; opacity: 0; transform: translateY(-10px);
    transition: opacity .18s ease, transform .18s ease; pointer-events: none;
  }
  .m-nav.open { opacity: 1; transform: none; pointer-events: auto; }
  .m-nav[hidden] { display: none; }
  .m-nav-in { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; }
  .m-search {
    display: flex; align-items: center; gap: 9px; height: 42px;
    padding: 0 12px; margin: 2px 0 10px;
    background: var(--bg-inset); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-3); font-size: 14px; font-family: inherit; cursor: pointer;
  }
  .m-search svg { width: 16px; height: 16px; }
  .m-group { border-bottom: 1px solid var(--border); }
  .m-group-btn {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 14px 2px; background: none; border: 0;
    font-size: 15.5px; font-weight: 600; color: var(--text);
    font-family: inherit; cursor: pointer; text-align: left;
  }
  .m-group-btn svg { width: 13px; height: 13px; opacity: .45; transition: transform .18s; flex: 0 0 auto; }
  .m-group.open .m-group-btn svg { transform: rotate(180deg); }
  .m-group-body { display: none; padding: 0 2px 14px; }
  .m-group.open .m-group-body { display: block; }
  /* 抽屉里的分组内容由桌面 .nav-drop 克隆而来，这里把下拉态还原成静态列表 */
  .m-group-body .nav-drop {
    position: static; display: block; opacity: 1; visibility: visible; transform: none;
    width: auto; max-width: none; margin: 0; padding: 0;
    background: none; border: 0; box-shadow: none;
  }
  .m-group-body .nav-drop::before { display: none; }
  .m-group-body .drop-col { margin-bottom: 6px; }
  .m-group-body .drop-cat {
    font-size: 13.5px; color: var(--brand); border-bottom: 0;
    padding: 6px 0 4px; margin-bottom: 2px;
  }
  .m-group-body .drop-links,
  .m-group-body .drop-links.long {
    display: grid; grid-template-columns: 1fr 1fr;
    grid-auto-flow: row; grid-template-rows: none; gap: 0 14px;
  }
  .m-group-body .drop-links a,
  .m-group-body .drop-links.long a {
    min-width: 0; font-size: 13.5px; padding: 7px 2px; border-radius: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border-bottom: 1px dashed var(--border);
  }
  .m-all {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    height: 44px; margin-top: 14px; border-radius: 11px;
    background: var(--brand-soft); color: var(--brand);
    font-size: 14.5px; font-weight: 600; text-decoration: none;
  }
}
html.mnav-lock, html.mnav-lock body { overflow: hidden; }

/* ---------- 今日金价 ---------- */
.gp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 260px)); gap: 14px; margin: 14px 0; }
.gp-tag { font-size: 12.5px; font-weight: 650; color: var(--text-3); letter-spacing: .04em; }
.gp-big { font-size: 34px; font-weight: 750; line-height: 1.2; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.gp-big small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.gp-up { color: #d5304f; }
.gp-down { color: #0a9d58; }
.gp-chg { font-size: 13.5px; font-weight: 650; margin-bottom: 4px; }
.gp-mid { font-size: 14px; color: var(--text-2); margin: 2px 0; }
.gp-sub { font-size: 12.5px; color: var(--text-3); }
.gp-metals { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 180px)); gap: 10px 18px; }
.gp-metal { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--bg-inset); border-radius: 10px; }
.gp-mname { font-size: 12.5px; color: var(--text-3); }
.gp-mval { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gp-mval span { font-size: 12.5px; margin-left: 4px; }
.gp-mnote { font-size: 11.5px; color: var(--text-3); }
.gp-conv { margin-top: 10px; }
.gp-conv-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 2px; border-bottom: 1px dashed var(--border); font-size: 13.5px; color: var(--text-2); }
.gp-conv-row b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.gp-conv-row.gp-strong { border-bottom: 0; font-size: 15px; }
.gp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.gp-table th, .gp-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.gp-table th { font-size: 12px; color: var(--text-3); font-weight: 600; }
.gp-table td.gp-strong { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- 首页 ---------- */
.hero { padding: 58px 0 30px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -120px 0 auto 50%; translate: -50% 0;
  width: 720px; height: 380px; pointer-events: none;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--brand) 13%, transparent), transparent 68%);
}
.hero > * { position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  height: 27px; padding: 0 11px; border-radius: 100px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12.5px; font-weight: 600; margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
}
.hero-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.hero h1 {
  font-size: clamp(30px, 5vw, 46px); font-weight: 780; letter-spacing: -.035em;
  margin-bottom: 14px;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #2f5bea, #6d8bff 60%, #2f5bea);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-2); font-size: 16px; max-width: 620px; margin: 0 auto; }

.big-search { max-width: 620px; margin: 30px auto 0; position: relative; }
.big-search input {
  width: 100%; height: 54px; padding: 0 118px 0 48px;
  border-radius: 14px; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text);
  font-size: 15.5px; font-family: inherit; outline: none; transition: .18s;
  box-shadow: var(--shadow-sm);
}
.big-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 13%, transparent); }
.big-search .s-icon { position: absolute; left: 17px; top: 50%; translate: 0 -50%; width: 19px; height: 19px; color: var(--text-3); }
.big-search .s-btn {
  position: absolute; right: 7px; top: 7px; height: 40px; padding: 0 20px;
  border-radius: 10px; border: 0; background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .15s;
}
.big-search .s-btn:hover { background: var(--brand-strong); }

.hot-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.hot-tags a {
  font-size: 12.5px; color: var(--text-2); padding: 4px 11px;
  border-radius: 100px; border: 1px solid var(--border); background: var(--bg-elev);
  transition: .15s;
}
.hot-tags a:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); text-decoration: none; }
.today-line { margin-top: 14px !important; font-size: 12.5px !important; color: var(--text-3) !important; }

.section { padding: 26px 0; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 19px; }
.section-head span { color: var(--text-3); font-size: 13px; }
.section-head .more { margin-left: auto; font-size: 13px; color: var(--text-2); }

.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 12px;
}
.cat-card {
  display: flex; gap: 13px; padding: 15px 16px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r); transition: .18s; color: var(--text);
  box-shadow: var(--shadow-xs);
}
.cat-card:hover {
  text-decoration: none; border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.cat-ico {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; color: var(--brand);
  /* 底色取分类主题色的淡色（12% 不透明度），图标用主题色，各分区一眼可辨 */
  background: color-mix(in srgb, var(--c, var(--brand)) 12%, var(--bg-inset));
}
.cat-ico svg { width: 19px; height: 19px; }
.cat-card h3 { font-size: 14.5px; margin-bottom: 2px; }
.cat-card p { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.cat-card .n { font-size: 11.5px; color: var(--text-3); margin-top: 6px; display: block; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 12px; }
.tool-card {
  display: flex; gap: 12px; padding: 14px 15px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--r); color: var(--text);
  transition: .18s; box-shadow: var(--shadow-xs);
}
.tool-card:hover {
  text-decoration: none; border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.tool-card .t-ico {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; transition: .18s;
  background: color-mix(in srgb, var(--c, var(--text-2)) 10%, var(--bg-inset));
}
.tool-card:hover .t-ico { background: color-mix(in srgb, var(--c, var(--brand)) 20%, var(--bg-inset)); }
.tool-card .t-ico svg { width: 17px; height: 17px; }
.tool-card h3 { font-size: 14px; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.tool-card p { font-size: 12.5px; color: var(--text-3); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill-hot {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; color: #fff;
  background: linear-gradient(120deg, #ff7a45, #f5222d);
  padding: 1px 5px; border-radius: 4px; flex: 0 0 auto;
}

/* ---------- 工具页 ---------- */
.crumb { padding: 20px 0 0; font-size: 13px; color: var(--text-3); display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--brand); }
.crumb .sep { opacity: .5; }

.tool-head { padding: 14px 0 20px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tool-head .th-top { display: flex; align-items: center; gap: 13px; }
.tool-head .big-ico {
  width: 46px; height: 46px; border-radius: 13px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
}
.tool-head .big-ico svg { width: 23px; height: 23px; }
.tool-head h1 { font-size: clamp(22px, 3.4vw, 29px); letter-spacing: -.025em; }
.tool-head .lede { color: var(--text-2); font-size: 14.5px; margin-top: 10px; max-width: 760px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 252px; gap: 26px; align-items: start; }
.layout-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.side { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 14px; }
.side-box { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; }
.side-box h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 9px; font-weight: 650; }
.side-list { display: flex; flex-direction: column; gap: 1px; }
.side-list a {
  font-size: 13.5px; color: var(--text-2); padding: 6px 8px; border-radius: 7px;
  display: flex; align-items: center; gap: 8px; transition: .13s;
}
.side-list a:hover { background: var(--bg-inset); color: var(--text); text-decoration: none; }
.side-list a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-list a svg { width: 14px; height: 14px; opacity: .65; flex: 0 0 auto; }
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .side-box.related-side { display: none; }
}

/* ---------- 通用面板 ---------- */
.panel {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-xs);
}
.panel.tight { padding: 12px; }
.panel-flat { background: var(--bg-soft); }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.panel-head h3 { font-size: 13.5px; font-weight: 650; color: var(--text-2); }
.panel-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.nowrap { flex-wrap: nowrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.grow { flex: 1 1 0; min-width: 0; }

label.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
label.lbl .opt { font-weight: 400; color: var(--text-3); }

textarea, input[type="text"], input[type="number"], input[type="url"], input[type="password"], select {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 9px 11px; outline: none; transition: .15s;
}
textarea:focus, input:focus, select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}
textarea {
  min-height: 168px; resize: vertical; line-height: 1.6;
  font-family: var(--mono); font-size: 13px;
}
textarea.plain { font-family: var(--sans); font-size: 14px; }
textarea.tall { min-height: 260px; }
textarea.short { min-height: 84px; }
input[type="number"] { font-family: var(--mono); }
select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2.5' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}
.mono { font-family: var(--mono); font-size: 12.8px; }

/* 滑块：轨道要看得见、手指要点得到（原 5px 高 + 浅灰底在浅色卡片上几乎隐形） */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px;
  background: transparent; outline: none; cursor: pointer; padding: 0; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px; background: var(--border); box-sizing: border-box;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--bg-elev); border: 2px solid var(--brand); cursor: pointer;
  box-shadow: var(--shadow-sm); margin-top: -6px;
}
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 99px; background: var(--border);
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: var(--bg-elev);
  border: 2px solid var(--brand); box-shadow: var(--shadow-sm); cursor: pointer;
}
input[type="range"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
input[type="color"] {
  width: 42px; height: 34px; padding: 3px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--bg-elev); cursor: pointer;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; margin: 0; vertical-align: -2px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-2); cursor: pointer; user-select: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 35px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  font-family: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--bg-inset); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-inset); color: var(--text); }
.btn-sm { height: 29px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-inset); border-radius: 9px; border: 1px solid var(--border); }
.seg button {
  height: 27px; padding: 0 12px; border: 0; background: transparent; border-radius: 6px;
  font-family: inherit; font-size: 12.5px; font-weight: 550; color: var(--text-2); cursor: pointer; transition: .13s;
}
.seg button.on { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-xs); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs button {
  padding: 8px 13px; border: 0; background: transparent; color: var(--text-2);
  font-family: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

.hint { font-size: 12.5px; color: var(--text-3); line-height: 1.6; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; text-align: center;
}
.stat b { display: block; font-size: 21px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--text-3); }
.stat.accent b { color: var(--brand); }

.out {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 12px; min-height: 90px; font-family: var(--mono); font-size: 12.8px;
  white-space: pre-wrap; word-break: break-word; overflow: auto; max-height: 460px; line-height: 1.65;
}
.out.plain { font-family: var(--sans); font-size: 14px; }
.out.big { font-size: 15px; }
.out:empty::before { content: "结果会显示在这里"; color: var(--text-3); font-family: var(--sans); font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px;
  border-radius: 100px; font-size: 11.5px; font-weight: 600;
  background: var(--bg-inset); color: var(--text-2);
}
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.err { background: var(--red-soft); color: var(--red); }

.notice {
  display: flex; gap: 9px; padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 12.8px; line-height: 1.6; background: var(--bg-inset); color: var(--text-2);
  border: 1px solid var(--border);
}
.notice.ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); }
.notice.err { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); }
.notice.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
table.tbl th { font-size: 12px; color: var(--text-3); font-weight: 600; background: var(--bg-soft); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.mono { font-family: var(--mono); font-size: 12.5px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }

/* ---------- 说明 / FAQ ---------- */
.prose-box { margin-top: 26px; }
.prose-box h2 { font-size: 17px; margin: 26px 0 10px; }
.prose-box h2:first-child { margin-top: 0; }
.prose-box p { color: var(--text-2); font-size: 14px; line-height: 1.75; }
.faq { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.faq details {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 14px; transition: .15s;
}
.faq details[open] { border-color: var(--border-strong); }
.faq summary {
  cursor: pointer; font-size: 13.8px; font-weight: 600; color: var(--text);
  list-style: none; display: flex; justify-content: space-between; gap: 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--text-3); font-weight: 400; font-size: 16px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq p { margin-top: 7px; font-size: 13.5px; color: var(--text-2); }

/* ---------- 搜索弹层 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: color-mix(in srgb, #05070c 52%, transparent);
  backdrop-filter: blur(4px); padding: 12vh 16px 16px;
}
.modal.on { display: block; animation: fade .14s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal-card {
  max-width: 580px; margin: 0 auto; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s ease;
}
@keyframes pop { from { transform: translateY(-6px) scale(.99); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-input { display: flex; align-items: center; gap: 11px; padding: 14px 17px; border-bottom: 1px solid var(--border); }
.modal-input svg { width: 18px; height: 18px; color: var(--text-3); flex: 0 0 auto; }
.modal-input input {
  border: 0; background: transparent; padding: 0; font-size: 15.5px; outline: none; box-shadow: none;
}
.modal-input input:focus { box-shadow: none; }
.modal-list { max-height: 56vh; overflow: auto; padding: 7px; }
.s-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: 9px; color: var(--text); cursor: pointer;
}
.s-item:hover, .s-item.sel { background: var(--brand-soft); text-decoration: none; }
.s-item .s-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-inset); color: var(--text-2); flex: 0 0 auto; }
.s-item.sel .s-ico, .s-item:hover .s-ico { background: var(--bg-elev); color: var(--brand); }
.s-item .s-ico svg { width: 15px; height: 15px; }
.s-item b { display: block; font-size: 13.8px; font-weight: 600; }
.s-item small { color: var(--text-3); font-size: 12px; }
.s-item .cat-tag { margin-left: auto; font-size: 11px; color: var(--text-3); }
.s-empty { padding: 34px 16px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.modal-foot { display: flex; gap: 14px; padding: 9px 15px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); background: var(--bg-soft); }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 30px; translate: -50% 0; z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #101828; color: #fff; font-size: 13.2px; padding: 9px 16px;
  border-radius: 9px; box-shadow: var(--shadow-lg); animation: tin .18s ease;
  display: flex; align-items: center; gap: 7px;
}
html[data-theme="dark"] .toast { background: #e9eef6; color: #101828; }
@keyframes tin { from { transform: translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- 图片工具 ---------- */
.drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r);
  padding: 30px 20px; text-align: center; cursor: pointer; transition: .16s;
  background: var(--bg-soft);
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop svg { width: 30px; height: 30px; color: var(--text-3); margin-bottom: 8px; }
.drop b { display: block; font-size: 14px; margin-bottom: 3px; }
.drop small { color: var(--text-3); font-size: 12.5px; }

/* 文件已添加反馈（上传区下方） */
.wbf-tip { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-soft); padding: 10px 12px; }
.wbf-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); min-width: 0; }
.wbf-head svg { width: 15px; height: 15px; color: var(--green); flex: none; }
.wbf-head b { color: var(--text); font-weight: 650; }
.wbf-head i { font-style: normal; color: var(--text-3); font-size: 12px; margin-left: 2px; }
.wbf-items { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.wbf-item { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-elev); }
.wbf-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--bg-inset); flex: none; }
.wbf-badge { width: 40px; height: 40px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: .2px; flex: none; }
.wbf-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wbf-name { font-size: 12.5px; color: var(--text); max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wbf-sub { font-size: 11px; color: var(--text-3); }
@media (max-width: 560px) { .wbf-name { max-width: 150px; } }
.img-preview { border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: repeating-conic-gradient(var(--bg-inset) 0 25%, transparent 0 50%) 50%/16px 16px; display: grid; place-items: center; }
.img-preview img { display: block; max-width: 100%; max-height: 360px; object-fit: contain; }
.canvas-stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.canvas-stage canvas { max-width: 100%; height: auto; border-radius: var(--r-sm); cursor: crosshair; }

/* ---------- diff ---------- */
.diff-list { font-family: var(--mono); font-size: 12.6px; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: auto; max-height: 460px; background: var(--bg-elev); }
.diff-line { display: flex; gap: 0; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.diff-line .ln { flex: 0 0 46px; text-align: right; padding: 1px 8px; color: var(--text-3); background: var(--bg-soft); user-select: none; font-size: 11.5px; }
.diff-line .sg { flex: 0 0 18px; text-align: center; color: var(--text-3); user-select: none; }
.diff-line .tx { flex: 1; padding: 1px 8px 1px 0; }
.diff-line.add { background: color-mix(in srgb, var(--green) 12%, transparent); }
.diff-line.add .tx { color: var(--green); }
.diff-line.del { background: color-mix(in srgb, var(--red) 12%, transparent); }
.diff-line.del .tx { color: var(--red); }
.diff-line.same .tx { color: var(--text-2); }

/* ---------- 页脚 ---------- */
footer {
  margin-top: 56px; border-top: 1px solid var(--border); padding: 26px 0 32px;
  color: var(--text-3); font-size: 12.8px;
}
.foot-in { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.foot-brand { flex: 1 1 260px; }
.foot-brand b { color: var(--text); font-size: 14px; display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.foot-brand p { max-width: 620px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.no-sel { user-select: none; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }


/* ==========================================================
   站点公告 / 页脚扩展 / 全部工具 / 反馈弹窗
   ========================================================== */
#wb-notice:empty { display: none; }
.wb-notice {
  border-bottom: 1px solid var(--border); font-size: 13px;
  background: var(--brand-soft); color: var(--brand-strong);
}
.wb-notice.success { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 22%, transparent); }
.wb-notice.warn { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 26%, transparent); }
.wb-notice .ni { display: flex; align-items: center; gap: 9px; padding: 9px 0; }
.wb-notice .ni svg { width: 16px; height: 16px; flex: 0 0 auto; }
.wb-notice .ni span { flex: 1; min-width: 0; }
.wb-notice .ni button {
  border: 0; background: transparent; color: inherit; opacity: .65; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 4px;
}
.wb-notice .ni button:hover { opacity: 1; }

.foot-bottom {
  border-top: 1px solid var(--border); margin-top: 22px; padding-top: 14px;
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: space-between;
}
.foot-meta { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--text-3); }
.foot-meta a:hover { color: var(--brand); }
.foot-meta button {
  border: 0; background: none; padding: 0; color: var(--text-3); font-size: 12.5px; cursor: pointer;
}
.foot-meta button:hover { color: var(--brand); }
.foot-links-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
.foot-links-row:empty { display: none; }
.foot-links-row b { color: var(--text-3); font-weight: 600; }
.foot-links-row a { color: var(--text-3); }
.foot-links-row a:hover { color: var(--brand); }

/* 全部工具索引 */
.all-index { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 4px; }
.all-index a {
  padding: 5px 12px; border-radius: 20px; background: var(--bg-inset); border: 1px solid var(--border);
  font-size: 12.8px; color: var(--text-2);
}
.all-index a:hover { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 26%, transparent); color: var(--brand); text-decoration: none; }
.all-group { margin: 30px 0; }
.all-group h2 {
  font-size: 16px; display: flex; align-items: baseline; gap: 9px; margin-bottom: 12px;
  padding-bottom: 9px; border-bottom: 1px solid var(--border);
}
.all-group h2 span { font-size: 12px; color: var(--text-3); font-weight: 400; }
.all-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.all-item {
  display: block; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-elev); transition: .15s; overflow: hidden;
}
.all-item:hover { border-color: color-mix(in srgb, var(--brand) 34%, transparent); box-shadow: var(--shadow-sm); text-decoration: none; transform: translateY(-1px); }
.all-item b { display: block; font-size: 13.5px; color: var(--text); margin-bottom: 2px; }
.all-item span { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 反馈弹窗 */
.wb-fb-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(16, 24, 40, .42);
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(2px);
}
.wb-fb {
  width: 100%; max-width: 460px; background: var(--bg-elev); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border);
}
.wb-fb-hd { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.wb-fb-hd b { font-size: 15px; }
.wb-fb-hd button { margin-left: auto; border: 0; background: none; color: var(--text-3); font-size: 20px; cursor: pointer; line-height: 1; }
.wb-fb-bd { padding: 16px 18px; }
.wb-fb-bd label { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 600; margin: 0 0 5px; }
.wb-fb-bd input, .wb-fb-bd textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-soft);
  padding: 9px 11px; font-size: 13.5px; color: var(--text); font-family: inherit; margin-bottom: 12px;
}
.wb-fb-bd textarea { min-height: 96px; resize: vertical; }
.wb-fb-bd input:focus, .wb-fb-bd textarea:focus { outline: none; border-color: var(--brand); background: var(--bg-elev); }
.wb-fb-ft { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--bg-soft); }

/* 工具下架提示 */
.wb-offline {
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  background: var(--amber-soft); color: var(--amber);
  border-radius: var(--r); padding: 14px 16px; font-size: 13.5px; margin-bottom: 16px;
}
.wb-offline b { display: block; margin-bottom: 4px; color: var(--text); }

@media (max-width: 980px) {
  .all-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .all-grid { grid-template-columns: 1fr; }
}


/* ==========================================================
   广告位
   ========================================================== */
.ad-slot { position: relative; margin: 18px auto; text-align: center; max-width: 100%; }
.ad-slot:empty { display: none; }
.ad-slot .ad-link { display: inline-block; max-width: 100%; line-height: 0; }
.ad-slot .ad-link:hover { text-decoration: none; }
.ad-slot img {
  max-width: 100%; height: auto; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-inset);
  transition: opacity .15s;
}
.ad-slot .ad-link:hover img { opacity: .92; }
.ad-slot .ad-tag {
  position: absolute; top: 5px; left: 5px; z-index: 2;
  font-size: 10px; line-height: 1; padding: 3px 5px; border-radius: 4px;
  background: rgba(16, 24, 40, .5); color: #fff; letter-spacing: .5px;
  pointer-events: none; font-weight: 500;
}
.ad-slot .ad-html { display: inline-block; max-width: 100%; }
.ad-slot.ad-float {
  position: fixed; right: 18px; bottom: 18px; z-index: 55; margin: 0;
  width: 268px; padding: 4px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.ad-slot.ad-float img { border-radius: 9px; border: 0; }
.ad-slot.ad-float .ad-close {
  position: absolute; top: -9px; right: -9px; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-3); font-size: 14px; line-height: 1; padding: 0;
  box-shadow: var(--shadow-sm);
}
.ad-slot.ad-float .ad-close:hover { color: var(--text); }
.ad-wrap-top { margin-top: 16px; }

@media (max-width: 860px) {
  .ad-slot { margin: 14px auto; }
}
@media (max-width: 720px) {
  .ad-slot.ad-float { display: none; }
}

/* ---- 后台自定义工具：沙箱 iframe ---- */
#tool-root[data-kind="custom"] {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; box-shadow: var(--shadow-sm);
}
.tool-frame {
  display: block; width: 100%; min-height: 320px; height: 320px;
  border: 0; background: transparent;
}
.tool-loading { padding: 40px 0; text-align: center; color: var(--text-3); font-size: 13.5px; }
.tool-loading::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  border: 2px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; vertical-align: -2px; animation: wb-spin .8s linear infinite;
}
@keyframes wb-spin { to { transform: rotate(360deg); } }

/* ---------- 工具页正文：核心功能 / 使用步骤 / 适用场景 ---------- */
.prose-box .tick,
.prose-box .steps { margin: 10px 0 6px; padding: 0; list-style: none; }
.prose-box .tick li {
  position: relative; padding-left: 20px; margin: 7px 0;
  font-size: 13.8px; line-height: 1.72; color: var(--text-2);
}
.prose-box .tick li::before {
  content: ""; position: absolute; left: 3px; top: 9px;
  width: 6px; height: 6px; border-radius: 2px; background: var(--brand); opacity: .7;
}
.prose-box .steps { counter-reset: st; }
.prose-box .steps li {
  counter-increment: st; position: relative; padding-left: 30px; margin: 10px 0;
  font-size: 13.8px; line-height: 1.72; color: var(--text-2);
}
.prose-box .steps li::before {
  content: counter(st); position: absolute; left: 0; top: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  font-size: 11.5px; font-weight: 700; font-family: var(--sans);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 正文内相关工具（内链） ---------- */
.rel-block { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--border); }
.rel-block h2 { font-size: 17px; margin: 0 0 14px; }
.rel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rel-grid a {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-elev); transition: border-color .15s, transform .15s;
}
.rel-grid a:hover { border-color: var(--brand); transform: translateY(-1px); }
.rel-grid .ri {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 8px; background: var(--brand-soft); color: var(--brand);
}
.rel-grid .ri svg { width: 17px; height: 17px; }
.rel-grid .rt { min-width: 0; flex: 1 1 auto; overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.rel-grid b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.rel-grid em {
  font-style: normal; font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rel-more { margin-top: 12px; font-size: 13px; }
.rel-more a { color: var(--brand); font-weight: 500; }
@media (max-width: 640px) {
  .rel-grid { grid-template-columns: minmax(0, 1fr); }
  .prose-box .steps li { margin: 9px 0; }
}

/* ---------- PDF 工具 ---------- */
.drop .dz-ico { display: inline-flex; width: 34px; height: 34px; margin-bottom: 8px; }
.drop .dz-ico::before {
  content: "+"; width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 22px; font-weight: 400; line-height: 1;
}

.f-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.f-list:empty { display: none; }
.f-row, .f-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-elev);
}
.f-idx {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}
.f-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.f-main b {
  font-size: 13.4px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.f-main em { font-style: normal; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.f-name { flex: 1; min-width: 0; font-size: 13.4px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-meta { flex: none; font-size: 12px; color: var(--text-3); }
.f-ops { flex: none; display: flex; gap: 4px; }
.f-ops .btn { padding: 3px 8px; font-size: 12px; }

.ip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 10px; margin-top: 14px; }
.ip-grid:empty { display: none; }
.ip-card {
  position: relative; border: 1px solid var(--border); border-radius: var(--r-sm);
  overflow: hidden; background: var(--bg-inset); cursor: grab;
}
.ip-card:active { cursor: grabbing; }
.ip-card img { display: block; width: 100%; height: 108px; object-fit: cover; }
.ip-no {
  position: absolute; left: 6px; top: 6px; width: 20px; height: 20px; border-radius: 6px;
  background: rgba(6, 10, 20, .66); color: #fff; font-size: 11.5px; display: grid; place-items: center;
}
.ip-del {
  position: absolute; right: 6px; top: 6px; width: 20px; height: 20px; border-radius: 50%;
  border: 0; background: rgba(6, 10, 20, .66); color: #fff; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0;
}
.ip-del:hover { background: var(--red); }
.ip-dim {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 7px;
  font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(6, 10, 20, .66));
}

.po-bar { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; flex-wrap: wrap; }
.po-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; }
.po-grid:empty { display: none; }
.po-item {
  position: relative; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-elev); padding: 8px; transition: opacity .16s;
}
.po-item.is-del { opacity: .36; }
.po-item.is-del::after {
  content: "已删除"; position: absolute; left: 0; right: 0; top: 0;
  padding: 4px 0; text-align: center; font-size: 11.5px; color: #fff;
  background: rgba(214, 51, 44, .82); border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.po-thumb {
  display: grid; place-items: center; min-height: 118px;
  background: var(--bg-inset); border-radius: 6px; overflow: hidden;
}
.po-thumb canvas { display: block; max-width: 100%; max-height: 158px; transition: transform .18s; }
.po-load { color: var(--text-3); font-size: 12px; }
.po-ops { display: flex; gap: 2px; justify-content: space-between; margin-top: 7px; }
.po-ops .btn { padding: 2px 6px; font-size: 12px; line-height: 1.5; }
.po-pg {
  position: absolute; left: 12px; top: 12px; padding: 0 5px; border-radius: 4px;
  font-size: 11px; color: var(--text-2); background: var(--bg); opacity: .9;
}

.kv { border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; margin-top: 14px; }
.kv-row { display: flex; gap: 12px; padding: 9px 13px; font-size: 13px; border-top: 1px solid var(--border); }
.kv-row:first-child { border-top: 0; }
.kv-row > span { flex: 0 0 86px; color: var(--text-3); }
.kv-row > b { flex: 1; min-width: 0; font-weight: 500; color: var(--text); word-break: break-word; }

.hint.err-text { color: var(--red); }

@media (max-width: 640px) {
  .po-grid { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); }
  .ip-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .kv-row > span { flex: 0 0 70px; }
}

/* ---------- 文件转换工具 ---------- */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-top: 4px; }
/* 子项等分拉伸：一行只有一个就占满整行，两个各占一半，三个各占三分之一 */
.form-row > div { min-width: 160px; flex: 1 1 0; }
.form-row > div > textarea { width: 100%; }
.form-row .lbl { display: block; margin-bottom: 6px; }
.ar-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; max-height: 340px; overflow: auto; }
.ar-list li {
  font-size: 12.6px; font-family: var(--mono); color: var(--text-2);
  padding: 6px 10px; background: var(--bg-soft); border-radius: 6px;
  display: flex; justify-content: space-between; gap: 12px; min-width: 0;
}
.ar-list li > span:first-child, .ar-list li { word-break: break-all; }
.ar-list li .hint { flex: none; font-family: var(--font); }

/* ---------- 结果卡片 / 键盘测试 / 尺子 ---------- */
.kv-card { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-elev); overflow: hidden; }
.kv-card > div:first-child { padding: 14px 14px 12px; }
.kv-card .kv-row > span { flex: 0 0 96px; }
.kb-wrap { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft); overflow-x: auto; }
.kb-row { display: flex; gap: 6px; min-width: 660px; }
.kb-key {
  flex: 1 1 0; min-width: 0; height: 42px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg-elev);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 600;
  color: var(--text-3); user-select: none; transition: .1s;
  box-shadow: 0 1px 0 var(--border);
}
.kb-key.down { background: var(--brand); border-color: var(--brand); color: #fff; transform: translateY(1px); box-shadow: none; }
.kb-key span { pointer-events: none; }
#sr-stage { min-height: 100px; }
@media (max-width: 640px) {
  .kb-row { min-width: 560px; }
  .kb-key { height: 36px; font-size: 11px; }
}
