[hidden] { display: none !important; }
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a919f;
  --line: #e5e8ed;
  --brand: #1664ff;
  --brand-dark: #0e4fd6;
  --brand-soft: #eaf1ff;
  --hero: linear-gradient(135deg, #5b2ee6, #2f66ee); /* 与 logo 背景一致 */
  color-scheme: light;
}
/* 默认白天；只有用户手动切到夜间才变暗 */
:root[data-theme="dark"] {
  --bg: #111418; --card: #1a1e24; --text: #e6e8eb; --muted: #8a919f;
  --line: #2a2f37; --brand: #4c8bff; --brand-dark: #3a78f0; --brand-soft: #1c2a44;
  --hero: linear-gradient(135deg, #3d1fa6, #1f47ad); color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-weight: 400; font-size: 20px; display: flex; gap: 10px; white-space: nowrap; align-items: center; color: var(--text); }
.logo-img { width: 44px; height: 44px; border-radius: 10px; display: block; }
.topnav { display: flex; gap: 24px; height: 100%; }
.topnav a { display: flex; align-items: center; color: var(--text); border-bottom: 2px solid transparent; }
.topnav a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.topbar-right { display: flex; align-items: center; gap: 20px; height: 100%; }
.theme-btn {
  width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 6px;
}
.theme-btn:hover { background: transparent; color: var(--brand); border-color: var(--brand); }
.theme-btn .ico { width: 18px; height: 18px; vertical-align: 0; }

/* 搜索区 */
.hero { background: var(--hero); color: #fff; padding: 36px 0 28px; }
.hero h1 { margin: 0 0 16px; font-size: 22px; font-weight: 600; text-align: center; }
.search { display: flex; max-width: 640px; margin: 0 auto; }
.search input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 0; border-radius: 4px;
  font-size: 15px; outline: none; color: #1f2329; background: #fff;
}
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 16px; }
.chips a { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; opacity: .9; }
.chips a:hover { opacity: 1; text-decoration: underline; }
.chips .ico { vertical-align: 0; }

/* 图标 */
.ico { width: 16px; height: 16px; vertical-align: -3px; flex-shrink: 0; }

/* 分类 */
.sec-title { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; margin: 28px 0 12px; padding-left: 10px; border-left: 3px solid var(--brand); line-height: 1.2; }
.sec-title .ico { color: var(--brand); }
.cat { scroll-margin-top: 80px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card {
  position: relative; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px;
}
.card:hover { border-color: var(--brand); }
.card:hover h3 { color: var(--brand); }
.card h3 { margin: 0 0 2px; font-size: 14px; font-weight: 600; padding-right: 40px; }
.card p { margin: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { position: absolute; top: 12px; right: 12px; font-size: 11px; line-height: 18px; color: var(--brand); background: var(--brand-soft); padding: 0 5px; border-radius: 2px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.empty .ico { color: var(--muted); }

/* 工具 */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.tool { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; min-width: 0; }
.tool.wide { grid-column: 1 / -1; }
.tool h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; min-width: 0; }
input, select, textarea {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); color: var(--text); font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { width: 100%; height: auto; padding: 8px 10px; resize: vertical; margin-bottom: 8px; }
#fx-amt { max-width: 110px; }
button { height: 34px; background: var(--brand); color: #fff; border: 0; border-radius: 4px; padding: 0 16px; font: inherit; cursor: pointer; }
button:hover { background: var(--brand-dark); }
.btns button { height: 30px; background: var(--card); color: var(--text); border: 1px solid var(--line); padding: 0 12px; font-size: 13px; }
.btns button:hover { color: var(--brand); border-color: var(--brand); background: var(--card); }
.out { background: var(--bg); border-radius: 4px; padding: 10px 12px; margin: 10px 0 0; white-space: pre-wrap; word-break: break-all; font: 12px/1.7 ui-monospace, Menlo, Consolas, monospace; max-height: 220px; overflow: auto; }
.tfa { display: flex; align-items: baseline; gap: 12px; margin-top: 12px; }
#tfa-code { font: 600 28px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 3px; color: var(--brand); cursor: pointer; }
#tfa-left { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* 资讯 */
.news { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.news li { display: flex; gap: 10px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.news li:last-child { border-bottom: 0; }
.news .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news .t:hover { color: var(--brand); }
.news .d { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* 页脚 */
.footer { margin-top: 40px; padding: 20px 0; background: var(--card); border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 12px; }
.footer p { margin: 4px 0; }
.foot-logo { width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; }

@media (max-width: 560px) {
  .topnav { gap: 12px; font-size: 13px; }
  .topbar-right { gap: 10px; }
  .hero h1 { font-size: 18px; }
  .tool-grid { grid-template-columns: 1fr; }
}
.news .tag { position: static; flex-shrink: 0; }
@media (max-width: 560px) {
  .logo { font-size: 16px; gap: 8px; }
  .logo-img { width: 36px; height: 36px; border-radius: 8px; }
  .topnav { display: none; }
}

/* ========== 左侧栏 ========== */
:root { --side-w: 232px; }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); z-index: 30;
  display: flex; flex-direction: column; background: var(--card); border-right: 1px solid var(--line);
}
.side-logo {
  display: flex; align-items: center; gap: 10px; height: 68px; flex-shrink: 0; padding: 0 16px;
  border-bottom: 1px solid var(--line); font-weight: 400; font-size: 18px; white-space: nowrap;
}
.side-logo img { width: 40px; height: 40px; border-radius: 9px; }
.side-nav { flex: 1; overflow-y: auto; padding: 8px; }
.side-nav a, .side-foot a {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 14px; border-radius: 6px;
  color: var(--text); font-size: 14px;
}
.side-nav a .ico, .side-foot a .ico { width: 18px; height: 18px; vertical-align: 0; color: var(--muted); }
.side-nav a:hover, .side-foot a:hover { background: var(--bg); color: var(--brand); }
.side-nav a:hover .ico, .side-foot a:hover .ico { color: var(--brand); }
.side-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-nav a.active .ico { color: var(--brand); }
.side-foot { flex-shrink: 0; padding: 8px; border-top: 1px solid var(--line); }
.side-mask { display: none; }

.page { margin-left: var(--side-w); min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.page > main { flex: 1; width: 100%; }
.top-logo, .menu-btn { display: none; }
.topbar-right { margin-left: auto; }
#tools, #news { scroll-margin-top: 80px; }

/* 平板 / 手机：侧栏变成抽屉 */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.side-open .sidebar { transform: none; }
  body.side-open .side-mask { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .4); }
  .page { margin-left: 0; }
  .top-logo, .menu-btn { display: inline-flex; }
  .topbar-inner { gap: 12px; }
}

/* logo 旁的品牌名 + 副标题 */
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-sub { font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: .5px; }
@media (max-width: 560px) { .brand-sub { font-size: 11px; letter-spacing: 0; } }

/* 产品卡片 logo */
.card { display: flex; align-items: center; gap: 12px; }
.card-body { flex: 1; min-width: 0; }
.card-logo {
  position: relative; flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 17px;
}
.card-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--card); } /* 不裁切：图标自带的形状（如 WhatsApp 气泡尾巴）完整显示 */
.card p { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.5; }
.side-logo .brand-sub { font-size: 13px; }

/* ========== 收藏按钮 ========== */
.fav-btn {
  position: absolute; right: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  opacity: 0; transition: opacity .15s;
}
.fav-btn .ico { width: 15px; height: 15px; vertical-align: 0; }
.card:hover .fav-btn, .fav-btn.on { opacity: 1; }
.fav-btn:hover { background: var(--bg); color: #e5484d; }
.fav-btn.on { color: #e5484d; }
.fav-btn.on .ico { fill: currentColor; }
@media (hover: none) { .fav-btn { opacity: 1; } }
.link-btn { margin-left: auto; height: auto; padding: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 400; }
.link-btn:hover { background: none; color: var(--brand); }

/* ========== 右下角悬浮按钮 ========== */
.float-bar { position: fixed; right: 20px; bottom: 24px; z-index: 20; display: flex; flex-direction: column; gap: 10px; }
.float-btn {
  position: relative; width: 50px; height: 50px; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  transition: transform .2s ease, box-shadow .2s ease;
}
.float-btn .ico { width: 22px; height: 22px; vertical-align: 0; }
.float-btn .fi { width: 26px; height: 26px; }
.float-btn.telegram .fi { width: 27px; margin-left: -2px; }
.float-btn.telegram { background: linear-gradient(180deg, #37bbfe, #007dbb); box-shadow: 0 6px 16px rgba(0, 125, 187, .35); }
.float-btn.whatsapp { background: linear-gradient(180deg, #5fe07f, #1fb855); box-shadow: 0 6px 16px rgba(31, 184, 85, .35); }
.float-btn.top { background: var(--card); color: var(--text); border: 1px solid var(--line); display: none; }
.float-btn.top.show { display: flex; }
.float-btn.top:hover { background: var(--card); color: var(--brand); }
.float-btn:hover { transform: translateY(-3px); }
.float-btn.telegram:hover { box-shadow: 0 10px 22px rgba(0, 125, 187, .45); }
.float-btn.whatsapp:hover { box-shadow: 0 10px 22px rgba(31, 184, 85, .45); }
.float-tip {
  position: absolute; right: 56px; top: 50%; transform: translateY(-50%); white-space: nowrap;
  background: #1f2329; color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 4px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.float-btn:hover .float-tip { opacity: 1; }
@media (max-width: 560px) { .float-bar { right: 12px; bottom: 16px; } .float-btn { width: 44px; height: 44px; } .float-btn .fi { width: 23px; height: 23px; } }

/* ========== 工具：标题副文字 / 次按钮 ========== */
.h3-sub { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.btn-ghost {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 4px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); font-size: 14px; cursor: pointer;
}
.btn-ghost:hover { background: var(--card); color: var(--brand); border-color: var(--brand); }

/* ========== 时区时钟 ========== */
.tz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tz { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.tz-name { font-size: 12px; color: var(--muted); }
.tz-time { font: 600 22px/1.3 ui-monospace, Menlo, Consolas, monospace; }
.tz-meta { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.tz-meta i { width: 7px; height: 7px; border-radius: 50%; background: #c4c8cf; }
.tz.work .tz-meta i { background: #23a55a; }
.tz.work .tz-meta { color: #23a55a; }
.tz.free .tz-meta i { background: #f0a020; }

/* ========== WhatsApp 生成器 ========== */
.wa { display: flex; gap: 16px; align-items: flex-start; }
.wa-form { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.wa-form input { width: 100%; }
.wa-form textarea { margin: 0; }
.wa-form .out { margin: 0; }
.wa-qr { width: 150px; height: 150px; flex-shrink: 0; border: 1px dashed var(--line); border-radius: 6px; background: #fff; display: flex; align-items: center; justify-content: center; }
.wa-qr:empty::after { content: "二维码"; color: #b0b5bf; font-size: 12px; }
.wa-qr svg { width: 100%; height: 100%; }
@media (max-width: 560px) { .wa { flex-direction: column; } .wa-qr { align-self: center; } }

/* ========== 侧栏：数量 / 收藏 ========== */
.side-nav a span { flex: 1; min-width: 0; }
.side-count { font-style: normal; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 0 7px; line-height: 18px; }
.side-nav a.active .side-count { color: var(--brand); background: var(--card); }
.side-fav .ico { color: #e5484d !important; }

/* ========== 搜索结果里的工具 ========== */
.tool-hits { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-hit { padding: 8px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.tool-hit:hover { border-color: var(--brand); color: var(--brand); }
.tool { scroll-margin-top: 80px; }
@keyframes flash { 0%, 60% { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); } 100% { box-shadow: none; } }
.tool.flash { animation: flash 1.6s ease-out; }

/* ========== 分类页 / 文章页 ========== */
.hero-sm { padding: 26px 0 22px; }
.hero-sm h1, .hero-title { margin: 0 0 8px; font-size: 22px; font-weight: 600; text-align: center; }
.hero-desc { margin: 0 auto 16px; max-width: 720px; text-align: center; font-size: 14px; opacity: .88; }
.hero-sm .search { margin-top: 14px; }
.sec-title a { color: inherit; }
.sec-title a:hover { color: var(--brand); }
.sec-more { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--muted); }
.sec-more:hover { color: var(--brand); }
.crumbs { margin: 18px 0 -8px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }
.crumbs i { font-style: normal; margin: 0 4px; }
.crumbs span { color: var(--text); }

.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-chips a {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 6px; font-size: 14px; color: var(--text);
}
.cat-chips a:hover { border-color: var(--brand); color: var(--brand); }
.cat-chips .ico { width: 16px; height: 16px; color: var(--brand); }
.cat-chips em { font-style: normal; font-size: 12px; color: var(--muted); }

.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 10px; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--brand); }

/* 文章列表 */
.art-list { display: grid; gap: 12px; margin-top: 28px; }
.art-item { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; color: var(--text); }
.art-item:hover { border-color: var(--brand); }
.art-item h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.art-item:hover h2 { color: var(--brand); }
.art-item p { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.art-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.art-meta .tag { position: static; }

/* 文章正文 */
.article { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 28px 32px; margin-top: 28px; }
.article > h1 { margin: 0 0 10px; font-size: 24px; line-height: 1.4; }
.article > .art-meta { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.art-body { font-size: 15px; line-height: 1.9; word-wrap: break-word; }
.art-body h2 { font-size: 19px; margin: 28px 0 10px; }
.art-body h3 { font-size: 16px; margin: 22px 0 8px; }
.art-body h4 { font-size: 15px; margin: 18px 0 6px; }
.art-body p, .art-body ul, .art-body ol { margin: 12px 0; }
.art-body ul, .art-body ol { padding-left: 22px; }
.art-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.art-body img { display: block; max-width: 100%; height: auto; margin: 14px auto; border-radius: 6px; border: 1px solid var(--line); }
.art-body blockquote { margin: 14px 0; padding: 8px 14px; border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 0 4px 4px 0; }
.art-body code { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.art-body pre { background: var(--bg); padding: 12px 14px; border-radius: 6px; overflow-x: auto; }
.art-body pre code { padding: 0; background: none; }
.art-body hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.art-more h2 { font-size: 16px; margin: 28px 0 12px; }

.nf { text-align: center; padding: 60px 0 20px; }
.nf h2 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.nf .btn { display: inline-block; margin-top: 10px; padding: 8px 20px; border-radius: 6px; background: var(--brand); color: #fff; }

@media (max-width: 560px) {
  .article { padding: 20px 16px; }
  .article > h1 { font-size: 20px; }
  .hero-sm h1, .hero-title { font-size: 18px; }
}

/* ========== 投手计算器 ========== */
.tool-pair { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; }
.tool-trio { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tool-pair .tool { display: flex; flex-direction: column; }
.tool-pair .tool .hint { margin-top: auto; padding-top: 10px; }
.calc input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.calc input::-webkit-inner-spin-button, .calc input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.calc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; }
.calc label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.calc input { width: 100%; }
.utm-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 10px; }
.calc .span-all { grid-column: 1 / -1; }
.utm-presets { gap: 6px; }
.utm-presets .btn-ghost { height: 28px; font-size: 12px; padding: 0 10px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }
.kv div { background: var(--bg); border-radius: 4px; padding: 8px 10px; min-width: 0; }
.kv span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv b { display: block; font-size: 17px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kv .good b { color: #16a34a; }
.kv .bad b { color: #e5484d; }
#m-out { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kv .hl { background: var(--brand-soft); }
.kv .hl b { color: var(--brand); }
.tool .hint code { font-size: 11px; background: var(--bg); padding: 0 4px; border-radius: 3px; }
@media (max-width: 1100px) { .tool-pair { grid-template-columns: 1fr; } .utm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .tool-trio { grid-template-columns: 1fr; } .utm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .calc { grid-template-columns: repeat(2, minmax(0, 1fr)); } #m-out { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* 自营标签：绿色 */
.tag.self { color: #15803d; background: #dcfce7; }
:root[data-theme="dark"] .tag.self { color: #4ade80; background: #14301f; }
#tool-fx .row input { flex: 1 1 100%; max-width: none; }
#tool-fx .row select { flex: 1; min-width: 0; }

/* 时区国旗 */
.tz-name { display: flex; align-items: center; gap: 6px; }
.tz-name .flags { display: inline-flex; gap: 3px; flex-shrink: 0; }
.flag { width: 21px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); display: block; }
:root[data-theme="dark"] .flag { box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
#r-out { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 560px) { #r-out { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 侧栏「实用工具」子菜单 */
.side-caret { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 4px; color: var(--muted); }
.side-caret:hover { background: var(--card); color: var(--brand); }
.side-nav .side-caret .ico { width: 16px; height: 16px; transition: transform .2s ease; }
.side-group.open .side-caret .ico { transform: rotate(180deg); }
.side-sub { display: none; position: relative; margin: 2px 0 4px 23px; padding-left: 12px; border-left: 1px solid var(--line); }
.side-group.open .side-sub { display: block; }
.side-nav .side-sub a { height: 34px; padding: 0 10px; font-size: 13px; color: var(--muted); gap: 0; }
.side-nav .side-sub a:hover { color: var(--brand); background: var(--bg); }
.side-nav .side-sub a.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.side-group.in > a:first-child { color: var(--brand); }
.side-group.in > a:first-child .ico { color: var(--brand); }
#tools .tool, #tools .tool-pair .tool, #tools .tool-trio .tool { scroll-margin-top: 80px; }

/* ========== 工具入口卡片 / 工具独立页 ========== */
.tool-card .tool-ic { background: var(--brand-soft); color: var(--brand); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.tool-card .tool-ic .ico { width: 22px; height: 22px; }
.tool-card p { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tool-card:hover .tool-ic { background: var(--brand); color: #fff; }
.tool-page { margin-top: 28px; }
.tool-page > .tool { padding: 20px 22px; }
.tool-help { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px 22px; }
.tool-help h2 { margin: 0 0 6px; font-size: 15px; }
.tool-help ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.tool-help strong { color: var(--text); }
.tz-name { white-space: nowrap; overflow: hidden; }
.tz-name .flags + * , .tz-name { text-overflow: ellipsis; }

/* 品牌名字体：小米 MiSans Regular（MiSans 字体许可，可免费商用，https://hyperos.mi.com/font）
   只打包了品牌名用到的 7 个字，每个文件约 1KB；后台改了品牌名后，新字会用系统字体显示，需要重新生成字体子集 */
@font-face { font-family: "MiSans Brand"; src: url(/assets/fonts/misans-brand-0.woff2) format("woff2"); unicode-range: U+51FA,U+751F; font-display: swap; }  /* 出生 */
@font-face { font-family: "MiSans Brand"; src: url(/assets/fonts/misans-brand-1.woff2) format("woff2"); unicode-range: U+6D77; font-display: swap; }  /* 海 */
@font-face { font-family: "MiSans Brand"; src: url(/assets/fonts/misans-brand-2.woff2) format("woff2"); unicode-range: U+6001; font-display: swap; }  /* 态 */
@font-face { font-family: "MiSans Brand"; src: url(/assets/fonts/misans-brand-3.woff2) format("woff2"); unicode-range: U+5883; font-display: swap; }  /* 境 */
@font-face { font-family: "MiSans Brand"; src: url(/assets/fonts/misans-brand-4.woff2) format("woff2"); unicode-range: U+732B; font-display: swap; }  /* 猫 */
@font-face { font-family: "MiSans Brand"; src: url(/assets/fonts/misans-brand-5.woff2) format("woff2"); unicode-range: U+8DE8; font-display: swap; }  /* 跨 */
#brand, #side-brand { font-family: "MiSans Brand", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-weight: 400; letter-spacing: 1px; }

/* ========== 左侧栏：和 logo 一样的紫蓝渐变底色 ========== */
:root { --side-bg: linear-gradient(180deg, #5b2ee6 0%, #2f66ee 100%); }
:root[data-theme="dark"] { --side-bg: linear-gradient(180deg, #3d1fa6 0%, #1f47ad 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --side-bg: linear-gradient(180deg, #3d1fa6 0%, #1f47ad 100%); } }
.sidebar { background: var(--side-bg); border-right: 0; color: #fff; }
.side-logo { color: #fff; border-bottom-color: rgba(255, 255, 255, .16); }
.side-logo img { box-shadow: 0 0 0 2px rgba(255, 255, 255, .28); }
.side-logo .brand-sub { color: rgba(255, 255, 255, .72); }
.side-foot { border-top-color: rgba(255, 255, 255, .16); }
.side-nav { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .3) transparent; }
.side-nav a, .side-foot a { color: rgba(255, 255, 255, .9); }
.side-nav a .ico, .side-foot a .ico { color: rgba(255, 255, 255, .72); }
.side-nav a:hover, .side-foot a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.side-nav a:hover .ico, .side-foot a:hover .ico { color: #fff; }
.side-nav a.active { background: rgba(255, 255, 255, .2); color: #fff; }
.side-nav a.active .ico { color: #fff; }
.side-count { color: rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .15); }
.side-nav a.active .side-count { color: #fff; background: rgba(255, 255, 255, .25); }
.side-fav .ico { color: #ff9ba0 !important; }
.side-caret { color: rgba(255, 255, 255, .72); }
.side-caret:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.side-sub { border-left-color: rgba(255, 255, 255, .25); }
.side-nav .side-sub a { color: rgba(255, 255, 255, .72); }
.side-nav .side-sub a:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.side-nav .side-sub a.active { color: #fff; background: rgba(255, 255, 255, .2); }
.side-group.in > a:first-child, .side-group.in > a:first-child .ico { color: #fff; }
/* 侧栏 logo：直接一只白猫，不要底框 */
.side-logo img { width: 40px; height: 40px; border-radius: 0; box-shadow: none; }

/* ========== 搜索弹窗 ========== */
.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; }
.topbar-right { gap: 10px; }
body.sdlg-open { overflow: hidden; }
.sdlg {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 16vh 16px 24px; background: rgba(15, 18, 30, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.sdlg-box { width: 100%; max-width: 760px; background: var(--card); border-radius: 10px; padding: 22px 22px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.sdlg-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.sdlg-tabs button {
  height: 34px; padding: 0 14px; border-radius: 6px 6px 0 0; background: transparent; color: var(--muted); font-size: 14px;
}
.sdlg-tabs button:hover { background: transparent; color: var(--text); }
.sdlg-tabs button.on { background: var(--bg); color: var(--text); font-weight: 500; }
.sdlg-form { display: flex; gap: 8px; padding: 10px; background: var(--bg); border-radius: 0 8px 8px 8px; }
.sdlg-form input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; font-size: 16px; padding: 0 8px; color: var(--text); max-width: none; }
.sdlg-form input:focus { border: 0; }
.sdlg-form button { width: 64px; height: 44px; padding: 0; border-radius: 6px; background: var(--hero); display: inline-flex; align-items: center; justify-content: center; }
.sdlg-form button:hover { filter: brightness(1.08); }
.sdlg-form button .ico { width: 20px; height: 20px; vertical-align: 0; }
.sdlg-sug { margin-top: 10px; max-height: 46vh; overflow-y: auto; }
.sdlg-sug a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.sdlg-sug a:hover { background: var(--bg); }
.sdlg-sug a:hover .sug-n { color: var(--brand); }
.sdlg-sug .card-logo { width: 30px; height: 30px; border-radius: 7px; font-size: 13px; }
.sdlg-sug .tool-ic .ico { width: 16px; height: 16px; }
.sug-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.sug-c { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.sug-more { display: block; width: 100%; margin-top: 4px; background: transparent; color: var(--brand); font-size: 13px; }
.sug-more:hover { background: var(--bg); }
.sug-empty { margin: 6px 10px; color: var(--muted); font-size: 13px; }
.sdlg-hot { margin-top: 18px; }
.sdlg-hot-t { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.sdlg-hot-t .ico { width: 18px; height: 18px; color: #f53f3f; fill: #f53f3f; vertical-align: 0; }
.sdlg-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.sdlg-chips a { padding: 6px 16px; border-radius: 16px; background: var(--bg); color: var(--text); font-size: 13px; }
.sdlg-chips a:hover { background: var(--brand-soft); color: var(--brand); }
.sdlg-close {
  margin-top: 16px; width: 40px; height: 40px; padding: 0; border-radius: 8px; background: var(--card); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sdlg-close:hover { background: var(--card); color: var(--text); }
.sdlg-close .ico { width: 20px; height: 20px; vertical-align: 0; }
@media (max-width: 560px) { .sdlg { padding-top: 10vh; } .sdlg-box { padding: 16px 14px 18px; } .sdlg-tabs button { padding: 0 10px; font-size: 13px; } }

/* 搜索结果顶部：关键词 + 清除 */
.search-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; margin: 24px 0 -8px; padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.search-bar b { color: var(--brand); }
.search-bar .link-btn:first-of-type { margin-left: auto; }
.search-bar .link-btn { margin-left: 0; font-size: 13px; }
.search-bar .link-btn:first-of-type { margin-left: auto; }
#nav { scroll-margin-top: 64px; }

/* 侧栏更宽、logo 区更大气（顶栏同高，保持对齐） */
:root { --side-w: 256px; --bar-h: 76px; }
.topbar-inner { height: var(--bar-h); }
.side-logo { height: var(--bar-h); padding: 0 22px; gap: 12px; }
.side-logo img { width: 50px; height: 50px; }
.side-logo #side-brand { font-size: 22px; letter-spacing: 2px; line-height: 1.2; }
.side-logo .brand-sub { font-size: 13px; letter-spacing: 1.5px; margin-top: 2px; }
.side-nav { padding: 10px 12px; }
.side-foot { padding: 8px 12px; }
#nav, #tools, #news { scroll-margin-top: calc(var(--bar-h) + 8px); }
/* 侧栏品牌名：左右留白均衡，副标题两端对齐到和品牌名一样宽 */
.side-logo { padding: 0 24px 0 22px; gap: 12px; }
.side-logo img { width: 46px; height: 46px; }
.side-logo #side-brand { font-size: 20px; letter-spacing: 1.5px; line-height: 1.25; }
.side-logo .brand-sub { display: block; font-size: 12px; letter-spacing: 0; margin-top: 3px; text-align: justify; text-align-last: justify; }
/* 顶栏导航、搜索、夜间模式靠左，和下方内容左边对齐（窄屏时左边是 logo，仍靠右） */
@media (min-width: 901px) {
  .topbar-inner { justify-content: flex-start; }
  .topbar-right { margin-left: 0; gap: 28px; }
  .topnav { gap: 28px; font-size: 15px; }
  .topbar-right .theme-btn { margin-left: -14px; }
  .topbar-right .theme-btn:first-of-type { margin-left: 0; }
}
/* 图标按钮里的图标严格居中（放大镜外面多包了一层 span） */
.theme-btn > span { display: flex; align-items: center; justify-content: center; line-height: 0; }
.theme-btn .ico { display: block; }
