/* 123工具箱 全站样式 */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #5c6780;
  --border: #e3e8f2;
  --accent: #2563eb;
  --accent-weak: #e8efff;
  --accent-text: #1d4fd7;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(28, 35, 51, .06), 0 4px 14px rgba(28, 35, 51, .05);
}
[data-theme="dark"] {
  --bg: #12161f;
  --card: #1b212e;
  --text: #e6eaf3;
  --muted: #98a2ba;
  --border: #2a3142;
  --accent: #5b8cff;
  --accent-weak: #22304d;
  --accent-text: #8fb0ff;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.main { min-height: 60vh; padding-bottom: 48px; }

/* ---------- 顶栏 ---------- */
.hd { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.hd-in { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.logo { font-size: 19px; font-weight: 700; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-ico { margin-right: 4px; }
.hd-search { position: relative; flex: 1; }
.hd-search input, .hero-search input {
  width: 100%; padding: 9px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text); font-size: 14px; outline: none;
}
.hd-search input:focus, .hero-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.theme-btn { border: 1px solid var(--border); background: var(--bg); border-radius: 50%; width: 38px; height: 38px; cursor: pointer; font-size: 16px; flex: none; }
.cat-nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.cat-nav::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; padding: 5px 14px; border-radius: 999px; font-size: 14px;
  border: 1px solid var(--border); color: var(--muted); background: var(--card);
}
.chip:hover { text-decoration: none; color: var(--accent-text); border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 搜索结果浮层 ---------- */
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; max-height: 70vh; overflow-y: auto;
}
.search-results a { display: flex; gap: 8px; align-items: baseline; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--accent-weak); text-decoration: none; }
.search-results .sr-cat { font-size: 12px; color: var(--muted); flex: none; }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 40px 0 8px; }
.hero h1 { font-size: 30px; margin: 0 0 10px; }
.hero-sub { color: var(--muted); margin: 0 auto 22px; max-width: 640px; }
.hero-search { position: relative; max-width: 520px; margin: 0 auto; }
.hero-search input { padding: 13px 18px; font-size: 15px; }
.recent { margin-top: 18px; display: flex; gap: 8px; justify-content: center; align-items: baseline; flex-wrap: wrap; }
.recent-t { font-size: 13px; color: var(--muted); }
.recent-list { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.recent-list a { font-size: 13px; padding: 3px 12px; border-radius: 999px; background: var(--accent-weak); color: var(--accent-text); }
.home-sec { margin-top: 38px; }
.home-sec h2 { font-size: 21px; margin: 0 0 4px; }
.sec-desc { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 3px; padding: 15px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease;
}
.card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.card-emoji { font-size: 22px; line-height: 1.2; }
.card-name { font-weight: 600; font-size: 15.5px; }
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.55; }
.about-blurb { margin-top: 44px; padding: 22px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.about-blurb h2 { font-size: 18px; margin: 0 0 8px; }
.about-blurb p { color: var(--muted); font-size: 14.5px; margin: 0; }

/* ---------- 工具页 ---------- */
h1 { font-size: 25px; margin: 18px 0 6px; line-height: 1.4; }
.page-lead { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
.crumbs { font-size: 13px; color: var(--muted); margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.crumbs i { font-style: normal; color: var(--border); }
.tool-box {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 20px; margin: 0 0 26px;
}
.doc h2 { font-size: 19px; margin: 26px 0 8px; }
.doc p { margin: 8px 0; }
.doc .intro-first { margin-top: 4px; }
.faq details { border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; margin: 10px 0; background: var(--card); }
.faq summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.faq-a { color: var(--muted); padding-top: 6px; }
.related { margin-top: 34px; }
.related h2 { font-size: 19px; }
.page-note { color: var(--muted); font-size: 14px; margin-top: 16px; }
.map-list { columns: 2; gap: 24px; }
@media (max-width: 640px) { .map-list { columns: 1; } }

/* ---------- 工具控件 ---------- */
.tw { display: flex; flex-direction: column; gap: 14px; }
.tw-row { display: grid; grid-template-columns: 1fr 150px; gap: 10px; }
.tw-row .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .tw-row { grid-template-columns: 1fr 120px; } }
.tw label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.tw input[type="text"], .tw input[type="number"], .tw input[type="date"], .tw input[type="datetime-local"], .tw select, .tw textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 16px; outline: none;
}
.tw input:focus, .tw select:focus, .tw textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.tw textarea { min-height: 140px; resize: vertical; font-size: 15px; }
.tw .btn {
  border: 0; background: var(--accent); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 15px; cursor: pointer; font-weight: 600;
}
.tw .btn:hover { filter: brightness(1.08); }
.tw .btn.ghost { background: var(--accent-weak); color: var(--accent-text); }
.tw .btn.small { padding: 6px 14px; font-size: 13px; }
.tw .swap { align-self: center; border: 1px solid var(--border); background: var(--bg); color: var(--muted); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; }
.tw-out { background: var(--accent-weak); border-radius: 10px; padding: 14px 16px; }
.tw-out .big { font-size: 26px; font-weight: 700; color: var(--accent-text); word-break: break-all; line-height: 1.4; }
.tw-out .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tw-formula { font-size: 13.5px; color: var(--muted); }
.tw-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tw-table th, .tw-table td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.tw-table th { background: var(--bg); font-weight: 600; }
.tw-table tr:nth-child(even) td { background: color-mix(in srgb, var(--bg) 50%, transparent); }
.tw-result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tw-stat { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.tw-stat .k { font-size: 12.5px; color: var(--muted); }
.tw-stat .v { font-size: 19px; font-weight: 700; }
.tw-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tw-tabs button { border: 1px solid var(--border); background: var(--bg); color: var(--muted); border-radius: 999px; padding: 6px 16px; cursor: pointer; font-size: 14px; }
.tw-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tw-note { font-size: 13px; color: var(--muted); }
.score-bar { height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.score-bar i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #eab308, #ef4444); }

/* ---------- 页脚 ---------- */
.ft { background: var(--card); border-top: 1px solid var(--border); margin-top: 30px; padding: 30px 0 18px; }
.ft-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 22px; font-size: 13.5px; }
@media (max-width: 720px) { .ft-grid { grid-template-columns: 1fr 1fr; } }
.ft h4 { margin: 0 0 8px; font-size: 14px; }
.ft p { color: var(--muted); margin: 0; }
.ft-links { display: flex; flex-direction: column; gap: 4px; }
.ft-base { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; text-align: center; }
.btn { display: inline-block; background: var(--accent); color: #fff; padding: 9px 22px; border-radius: 10px; font-weight: 600; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.ghost { background: var(--accent-weak); color: var(--accent-text); }
