:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --brand: #4f46e5;
  --brand-d: #4338ca;
  --brand-soft: #eef2ff;
  --border: #e6e9f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.05);
  --side-w: 240px;
  --header-h: 60px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* 表单辅助类（checkbox 标签、文本输入） */
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); cursor: pointer; }
.chk input[type="checkbox"], .chk select { accent-color: var(--brand); }
.chk select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); font-size: 14px; }
.text-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; color: var(--text); background: #fff; outline: none;
}
.text-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.65; font-size: 15px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 18px; }

/* ---------- Header ---------- */
/* 冻结头部：sticky 必须放在外层 #site-header（body 直接子元素）上，
   放在内层 .site-header 会因包含块限制而随页面一起滚走。 */
#site-header { position: sticky; top: 0; z-index: 50; }
.site-header {
  background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border); box-shadow: 0 1px 6px rgba(16,24,40,.06);
}
.header-inner { display: flex; align-items: center; gap: 14px; height: var(--header-h); }
/* 品牌与分类按钮不参与压缩（flex:none）：避免被 flex 挤变形 */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; display: block; box-shadow: 0 2px 8px rgba(79,70,229,.25); }

/* ---------- 全局搜索（头部右侧） ---------- */
.global-search { position: relative; margin-left: auto; flex: 0 1 320px; min-width: 0; }
.global-search .text-input { width: 100%; height: 36px; padding: 6px 12px 6px 34px; border-radius: 999px; background: var(--bg); }
.global-search::before { content: "\1F50D"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .55; pointer-events: none; }
.gs-results { position: absolute; top: calc(100% + 8px); right: 0; width: min(360px, 86vw); max-height: 70vh; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(16,24,40,.16); padding: 6px; z-index: 60; }
.gs-results[hidden] { display: none; }
.gs-item { display: block; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--text); border: 1px solid transparent; }
.gs-item:hover { background: var(--brand-soft); border-color: var(--brand); }
.gs-cat { display: inline-block; font-size: 11px; color: var(--brand-d); background: var(--brand-soft); border-radius: 6px; padding: 1px 7px; margin-right: 6px; }
.gs-name { font-weight: 600; font-size: 14px; }
.gs-snip { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.4; }
.gs-snip mark, .gs-name mark { background: #fff1a8; color: inherit; padding: 0 1px; border-radius: 2px; }
.gs-empty { padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.kw-hit { background: #fff1a8 !important; border-radius: 4px; scroll-margin-top: calc(var(--header-h) + 16px); }
@media (max-width: 900px) {
  .nav-toggle { margin-left: 0; }
  .global-search { flex: 1 1 auto; min-width: 0; margin-left: 12px; }
  .gs-results { width: min(340px, 90vw); }
}
@media (max-width: 520px) {
  .global-search { flex-basis: auto; }
  .global-search .text-input { font-size: 14px; }
}
/* 手机端头部紧凑形态：空间不足时品牌只留 LOGO、分类按钮只留图标，把宽度让给搜索框。
   阈值推导（实测）：头部内容可用宽 = 视口宽 − 15px(竖向滚动条) − 36px(.container 内边距)；
   完整品牌(110) + 分类按钮(67) + 间距(28) + 搜索框最小舒适宽(168) ≈ 373px，
   即视口宽 < 435px 时必须收紧，否则搜索框会被压到 105px、占位文字被截断。 */
@media (max-width: 434px) {
  .brand-name { display: none; }
  .brand { gap: 0; }
  .nav-text { display: none; }
  .nav-icon { margin-right: 0; }
  .nav-toggle { padding: 6px 10px; }
}
.hero-logo { width: 132px; height: auto; margin-bottom: 14px; }

/* ---------- Cron 生成器 ---------- */
.cron-field { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.cron-field:last-child { border-bottom: 0; }
.cf-label { width: 26px; font-weight: 700; color: var(--text); flex: none; }
.cf-mode { padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); font-size: 14px; min-width: 130px; }
.cron-field .cf-mode { width: auto; min-width: 104px; max-width: 136px; flex: 0 0 auto; }
.cf-val { flex: 0 1 180px; min-width: 120px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--text); background: #fff; outline: none; }
.cf-val:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cf-val:disabled { background: var(--bg); color: var(--muted); }
.cf-note { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen-out { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; word-break: break-all; }
.sub { margin: 0 0 12px; font-size: 16px; color: var(--brand-d); }
.tool-ui + .tool-ui { margin-top: 26px; }
.gen-warn { color: #b45309; font-size: 13px; margin-top: 6px; }
.nav-toggle { display: none; background: var(--brand-soft); border: 1px solid var(--border); color: var(--brand-d); border-radius: 8px; font-size: 13px; padding: 6px 12px; cursor: pointer; font-weight: 600; flex: none; }
.nav-toggle .nav-icon { margin-right: 5px; }

/* ---------- Layout ---------- */
.layout { display: flex; gap: 24px; align-items: flex-start; padding-top: 18px; }
.side-nav {
  flex: 0 0 var(--side-w); width: var(--side-w); position: sticky;
  top: calc(var(--header-h) + 18px); background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: calc(100vh - var(--header-h) - 36px);
  display: flex; flex-direction: column; overflow: hidden;
}
.content { flex: 1; min-width: 0; }

/* ---------- Sidebar (分类导航，可扩展) ---------- */
.side-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.side-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin-bottom: 10px; }
.side-total { color: var(--brand); font-weight: 700; }
.side-search input {
  width: 100%; padding: 8px 12px; font-size: 13px; border: 1px solid var(--border);
  border-radius: 8px; outline: none; background: #fff; box-sizing: border-box;
}
.side-search input:focus { border-color: var(--brand); }

.side-list { flex: 1 1 auto; overflow-y: auto; padding: 8px 10px 14px; }

.side-group { margin-bottom: 4px; }
.side-cat {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--text);
  cursor: pointer; user-select: none;
}
.side-cat:hover { background: var(--brand-soft); }
.side-cat-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.side-cat-icon { font-size: 14px; line-height: 1; }
.side-cat-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 角标：显示该分类下的工具数量 */
.cat-count {
  background: var(--brand); color: #fff; border-radius: 999px; font-size: 12px;
  min-width: 22px; text-align: center; padding: 1px 7px; font-weight: 700; flex: 0 0 auto;
}
.side-caret { color: var(--muted); font-size: 12px; transition: transform .15s; flex: 0 0 auto; }
.side-group.collapsed .side-caret { transform: rotate(-90deg); }
.side-tools { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 8px 0; padding-left: 8px; border-left: 2px solid var(--border); }
.side-group.collapsed .side-tools { display: none; }
.side-tool { display: block; padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: 13.5px; }
.side-tool:hover { background: var(--brand-soft); color: var(--brand-d); text-decoration: none; }
.side-tool.active { background: var(--brand); color: #fff; font-weight: 600; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(135deg, #eef2ff, #ecfeff); border: 1px solid var(--border); border-radius: var(--radius); padding: 34px 28px; text-align: center; box-shadow: var(--shadow); }
.hero h1 { font-size: 30px; margin: 0 0 8px; background: linear-gradient(135deg, var(--brand), #0891b2); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
/* 标题换行策略：宽度不足时从中间的「·」处断开成两行，并取消分隔点 */
.hero h1 .hero-sep { white-space: pre; }
.hero h1.hero-wrap .hero-sep { display: none; }
.hero h1.hero-wrap .hero-t1, .hero h1.hero-wrap .hero-t2 { display: block; }
.hero-sub { color: var(--muted); margin: 0; }

/* ---------- Tool grid ---------- */
.tool-grid { padding: 22px 0 36px; }
.grid-cat { margin-bottom: 26px; }
.grid-cat h2 { font-size: 15px; margin: 0 0 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.grid-cat h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(var(--brand), #06b6d4); }
.grid-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tool-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow); transition: .15s; display: block; color: var(--text); border-top: 3px solid var(--brand); }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(16,24,40,.10); text-decoration: none; }
.tool-card-name { font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.tool-card-desc { font-size: 13px; color: var(--muted); min-height: 38px; }
.tool-card-kw { font-size: 12px; color: var(--brand); margin-top: 8px; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: 13px; color: var(--muted); padding: 4px 0 10px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { color: var(--text); }

/* ---------- Tool page ---------- */
.tool-page { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.tool-page h1 { font-size: 23px; margin: 0 0 6px; }
.tool-desc { color: var(--muted); margin: 0 0 18px; }
.tool-ui label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 14px; }
.tool-ui textarea, .tool-ui input[type="text"], .tool-ui input[type="number"], .tool-ui input[type="datetime-local"], .tool-ui select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; font-family: inherit; background: #fff;
}
.tool-ui textarea { min-height: 130px; resize: vertical; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
.tool-ui textarea:focus, .tool-ui input:focus, .tool-ui select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.tool-ui .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.tool-ui .row > * { margin: 0; }
.btn {
  display: inline-block; padding: 9px 16px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; user-select: none;
  box-shadow: 0 1px 2px rgba(16,24,40,.08);
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .08s ease, box-shadow .15s ease, filter .12s ease;
}
.btn:hover { background: var(--brand-d); transform: translateY(-1px); box-shadow: 0 5px 14px rgba(79,70,229,.30); }
.btn:active { background: var(--brand-d); transform: translateY(0) scale(.97); box-shadow: 0 1px 2px rgba(16,24,40,.18); filter: brightness(.96); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft), 0 5px 14px rgba(79,70,229,.30); }
.btn.secondary { background: var(--brand-soft); color: var(--brand-d); box-shadow: none; }
.btn.secondary:hover { background: #e0e7ff; transform: translateY(-1px); box-shadow: 0 5px 14px rgba(79,70,229,.18); }
.btn.secondary:active { background: #dbe2ff; transform: translateY(0) scale(.97); filter: brightness(.98); }
.btn.ghost { background: #f1f5f9; color: var(--text); box-shadow: none; }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand-d); transform: translateY(-1px); box-shadow: 0 5px 14px rgba(16,24,40,.10); }
.btn.ghost:active { background: #e7ebf3; transform: translateY(0) scale(.97); filter: brightness(.98); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.result { margin-top: 14px; padding: 12px 14px; background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px; white-space: pre-wrap; word-break: break-all; min-height: 22px; font-family: "SFMono-Regular", Consolas, Menlo, monospace; font-size: 13px; }
.result.ok { border-color: #86efac; background: #f0fdf4; }
.result.err { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.copy-btn { margin-left: 0; font-size: 13px; }

/* ---------- 统一交互反馈（hover 上浮 / 点击回弹） ---------- */
.code-tab, .code-copy, .nav-toggle, .side-tool, .side-cat, .cf-mode, .chk select {
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .08s ease, box-shadow .15s ease, filter .12s ease;
}
.code-tab:active { transform: scale(.95); }
.code-tab.active { transform: none; }
.code-copy:active { transform: scale(.95); filter: brightness(.97); }
.nav-toggle:active { transform: scale(.96); }
.side-tool:active { transform: scale(.985); }
.side-cat:active { transform: scale(.985); }
.cf-mode:active, .chk select:active { transform: scale(.99); }
.tool-card {
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tool-card:active { transform: translateY(-1px) scale(.992); }

/* ---------- 全局操作提示 Toast ---------- */
.toast-wrap { position: fixed; left: 50%; top: calc(var(--header-h) + 16px); transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast { background: rgba(17,24,39,.94); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(16,24,40,.28); opacity: 0; transform: translateY(-10px); transition: opacity .2s ease, transform .2s ease; max-width: 88vw; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-left: 3px solid #34d399; }
.toast.err { border-left: 3px solid #f87171; }
.toast.info { border-left: 3px solid #60a5fa; }

/* 自定义下拉：艺术字体选择（可折叠分组 + 中英文展示） */
.select-wrap { position: relative; display: inline-block; vertical-align: middle; }
.btn-select { display: inline-flex; align-items: center; gap: 8px; min-width: 150px; padding: 8px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--text); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.btn-select:hover { border-color: var(--brand); }
.btn-select:active { transform: scale(.97); filter: brightness(.97); }
.btn-select:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.btn-select .caret { margin-left: auto; color: var(--muted); transition: transform .15s; }
.btn-select.open .caret { transform: rotate(180deg); }
.select-panel { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 248px; max-height: 320px; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16,24,40,.18); padding: 6px; }
.font-group { border-bottom: 1px solid var(--border); }
.font-group:last-child { border-bottom: none; }
.font-group-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--brand-d); user-select: none; }
.font-group-head .grp-count { font-size: 11px; color: var(--muted); background: var(--brand-soft); border-radius: 999px; padding: 1px 7px; }
.font-group-head .grp-toggle { margin-left: auto; transition: transform .15s; color: var(--muted); }
.font-group.collapsed .grp-toggle { transform: rotate(-90deg); }
.font-group.collapsed .font-group-body { display: none; }
.font-group-body { padding: 2px 4px 8px; }
.font-item { display: flex; align-items: baseline; gap: 8px; padding: 7px 10px; border-radius: 7px; cursor: pointer; transition: background .12s; }
.font-item:hover { background: var(--brand-soft); }
.font-item.active { background: var(--brand); color: #fff; }
.font-item .cn { font-weight: 600; }
.font-item .en { font-size: 12px; color: var(--muted); }
.font-item.active .en { color: rgba(255,255,255,.82); }
.opt-line { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; font-size: 14px; }
.opt-line label { font-weight: 400; display: inline-flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
/* 选项/单位类下拉：内容少，按内容收缩，不再撑满整行导致换行 */
.opt-line select { width: auto; }
.tool-ui select.shrink { width: auto; flex: 0 0 auto; }
/* 内联组合：数值输入框 + 紧随其后的单位/模式下拉，保持同一行 */
.inline-field { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.tool-ui .inline-field input[type="number"], .tool-ui .inline-field input[type="text"] { width: 120px; }
.tool-ui .inline-field select { width: auto; min-width: 92px; }
.slider-line { display: flex; align-items: center; gap: 12px; }
.slider-line input[type="range"] { flex: 1; accent-color: var(--brand); }
.slider-line .val { min-width: 42px; text-align: right; font-weight: 600; }
.match-item { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.match-item:last-child { border-bottom: none; }
.match-num { color: var(--brand); font-weight: 600; margin-right: 8px; }
.hl { background: #fde68a; border-radius: 3px; padding: 0 2px; }
#qrcode { margin-top: 14px; padding: 12px; background: #fff; display: inline-block; border: 1px solid var(--border); border-radius: 8px; }
.tool-faq { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.tool-page h2 { font-size: 1.17em; margin: 14px 0 4px; }
.tool-page .tool-faq h2 { font-size: 15px; }
.tool-faq p { color: var(--muted); font-size: 14px; margin: 0 0 8px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--card); border-top: 1px solid var(--border); margin-top: 30px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr repeat(5, 1fr); gap: 18px; padding: 28px 16px 10px; }
.foot-brand p { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.foot-col h4 { font-size: 13px; margin: 0 0 8px; }
.foot-links { display: flex; flex-direction: column; gap: 6px; }
.foot-links a { color: var(--muted); font-size: 13px; }
.foot-links a.foot-more { color: var(--brand-d); font-size: 12.5px; }
.foot-links a.foot-more:hover { text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--border); padding: 14px 16px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.beian a { font-weight: 600; }
/* 备案信息组：ICP 备案 + 公安联网备案（含警徽图标） */
.beian-wrap { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
.beian-gongan { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.beian-gongan:hover { color: var(--brand-d); text-decoration: none; }
.beian-icon { display: block; width: 18px; height: 20px; flex: none; }
.foot-brand .foot-site-links { margin-top: 14px; }
.foot-brand .foot-site-links a { color: var(--brand-d); font-weight: 600; }
.foot-brand .foot-site-links a:hover { text-decoration: underline; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; padding: 6px 16px 4px; }
.footer-links a { color: var(--brand-d); font-size: 13px; font-weight: 600; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- JSON 树视图（json-format） ---------- */
.json-tree { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.8; word-break: break-all; }
.json-tree .jchildren { margin-left: 9px; padding-left: 14px; border-left: 1px dotted var(--border); }
.json-tree .jline, .json-tree .jrow { white-space: pre-wrap; }
.json-tree .jarrow { display: inline-block; width: 14px; cursor: pointer; color: var(--muted); user-select: none; }
.json-tree .jarrow::after { content: "▸"; }
.json-tree .jnode:not(.collapsed) > .jline .jarrow::after { content: "▾"; }
.json-tree .jnode.collapsed > .jchildren, .json-tree .jnode.collapsed > .jend { display: none; }
.json-tree .jnode.collapsed > .jline .jdots { display: inline; }
.json-tree .jdots { display: none; color: var(--muted); }
.json-tree .jend { margin-left: 14px; }
.json-tree .jrow { padding-left: 14px; }
.json-tree .j-key { color: #7c3aed; }
.json-tree .j-colon { color: var(--muted); }
.json-tree .j-str { color: #047857; }
.json-tree .j-num { color: #1d4ed8; }
.json-tree .j-bool { color: #b45309; }
.json-tree .j-null { color: #6b7280; }
.json-tree .j-brace { color: #334155; }
.json-tree .j-note { margin-top: 8px; color: var(--muted); font-size: 12px; }
.jtree-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
.jtree-bar .btn { padding: 4px 10px; font-size: 12px; }
.plainout { white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* ---------- 新增工具样式（diff / 两栏 / 转换网格 / 状态码） ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-col .text-input { width: 100%; min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; }
.diff-box { border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 10px; max-height: 460px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; }
.dl { white-space: pre-wrap; word-break: break-all; padding: 1px 6px; border-radius: 4px; }
.dl.del { background: #fef2f2; color: #b91c1c; }
.dl.add { background: #ecfdf5; color: #047857; }
.dl.same { color: var(--muted); }
.diff-stat { font-size: 13px; color: var(--muted); margin: 8px 0; }
.conv-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
.conv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conv-row .conv-name { min-width: 132px; font-weight: 600; font-size: 14px; color: var(--brand-d); }
.conv-row code { flex: 1; min-width: 200px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; word-break: break-all; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.stat-card .num { font-size: 22px; font-weight: 700; color: var(--brand-d); }
.stat-card .lab { font-size: 13px; color: var(--muted); margin-top: 2px; }
.status-search { max-width: 320px; }
.status-list { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.status-item { display: flex; gap: 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.status-item:last-child { border-bottom: none; }
.status-code { font-weight: 700; font-family: ui-monospace, monospace; min-width: 46px; }
.status-cat { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); flex: none; }
.status-msg { color: var(--text); }
.c1xx .status-code { color: #6d28d9; } .c2xx .status-code { color: #047857; }
.c3xx .status-code { color: #1d4ed8; } .c4xx .status-code { color: #b45309; } .c5xx .status-code { color: #b91c1c; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- 代码实现区块（多语言选项卡 + 复制） ---------- */
.code-impl { margin-top: 26px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.code-impl-head { padding: 16px 16px 0; }
.code-impl-head h2 { font-size: 17px; margin: 0 0 4px; }
.code-impl-head .muted { margin: 0; font-size: 13px; color: var(--muted); }
.code-impl-head code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.code-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 12px 16px 0; }
.code-tab { border: 1px solid var(--border); background: var(--bg); color: var(--muted); font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease, transform .08s ease, box-shadow .15s ease; }
.code-tab:hover { color: var(--brand-d); border-color: var(--brand); box-shadow: 0 2px 8px rgba(79,70,229,.12); }
.code-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(79,70,229,.22); }
.code-copy { margin-left: auto; border: 1px solid var(--brand); background: transparent; color: var(--brand-d); font-size: 13px; padding: 5px 14px; border-radius: 999px; cursor: pointer; transition: background .15s ease, color .15s ease, transform .08s ease, box-shadow .15s ease, filter .12s ease; }
.code-copy:hover { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.28); }
.code-copy:active { transform: scale(.95); filter: brightness(.96); }
.code-body { margin: 12px 16px 16px; background: #0f172a; border-radius: 10px; max-height: 460px; overflow: auto; }
.code-body code { display: block; padding: 16px; color: #e2e8f0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.65; white-space: pre; }

/* ---------- 首页「热门工具」（访问次数 Top10） ---------- */
.hot-tools { margin: 6px 0 26px; }
.hot-tools h2 { font-size: 18px; margin: 0 0 4px; }
.hot-tools h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(var(--brand), #06b6d4); display: inline-block; margin-right: 8px; vertical-align: -2px; }
.hot-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.hot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.hot-item { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s ease, transform .08s ease, box-shadow .15s ease; }
.hot-item:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: 0 5px 14px rgba(16,24,40,.10); }
.hot-item:active { transform: translateY(0) scale(.98); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.hot-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft), 0 5px 14px rgba(16,24,40,.10); }
.hot-rank { flex: none; width: 22px; height: 22px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-d); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.hot-rank.r1 { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.hot-rank.r2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: #fff; }
.hot-rank.r3 { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }
.hot-name { font-weight: 600; font-size: 14px; }
.hot-count { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- 时间计算器 ---------- */
.tc-main { font-size: 17px; font-weight: 700; color: var(--text); }
.tc-main b { color: var(--brand-d); }
.tc-equiv { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tc-eq { display: inline-flex; align-items: baseline; gap: 6px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.tc-eq i { font-style: normal; color: var(--muted); }
.tc-eq b { color: var(--brand-d); font-weight: 700; }
.tc-chain { margin-top: 10px; font-size: 13px; color: var(--muted); }
.tc-seg { display: inline-block; background: var(--brand-soft); color: var(--brand-d); border-radius: 6px; padding: 1px 8px; margin-right: 6px; font-weight: 600; }
.tc-seg.tc-zero { background: #f1f5f9; color: var(--muted); font-weight: 400; }
.tc-note { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
/* 品牌已移至最左，分类按钮紧随其后（不再用 margin-left:auto 推远） */
  .nav-toggle { display: block; margin-left: 0; }
  .layout { flex-direction: column; gap: 14px; }
  /* 纵向布局下 main 不再按 fit-content 收缩：防止代码长行把页面撑出横向滚动 */
  .content { width: 100%; flex: none; min-width: 0; }
  .side-nav { flex: none; width: 100%; position: static; max-height: none; display: none; }
  .side-nav.open { display: flex; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .hero { padding: 26px 18px; }
  .hero h1 { font-size: 24px; }
  .footer-inner { grid-template-columns: 1fr; }
}

/* ---------- 屏保模式（?saver=1）----------
 * 目标：把任意「酷炫页面」变成一块纯净、无边框、可长期挂着看的画面。
 * 站内访问 / 动态壁纸软件指向 URL / 打包成 .scr 外壳 都复用这一套。
 */
html.saver-mode,
html.saver-mode body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

/* 页面骨架全部让位，只留舞台 */
html.saver-mode #site-header,
html.saver-mode #site-footer,
html.saver-mode .side-nav,
html.saver-mode .breadcrumb,
html.saver-mode .tool-page > h1,
html.saver-mode .tool-page > p.tool-desc,
html.saver-mode .tool-faq,
html.saver-mode .code-impl,
html.saver-mode .sm-legend,
html.saver-mode .mf-legend,
html.saver-mode .bg-controls,
html.saver-mode .bw-controls,
html.saver-mode .clock-controls,
html.saver-mode .bg-card,
html.saver-mode .bg-read,
html.saver-mode .bg-lead,
html.saver-mode .bw-panel,
html.saver-mode .bw-card,
html.saver-mode .bw-lead,
html.saver-mode .ip-panel,
html.saver-mode .ip-actions,
html.saver-mode .bw-val,
html.saver-mode .bw-sub { display: none !important; }

html.saver-mode .layout.container {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
}
html.saver-mode main.content { margin: 0; padding: 0; width: 100%; }
html.saver-mode .tool-page {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
html.saver-mode .tool-ui { margin: 0; }

/* 舞台铺满视口 */
html.saver-mode .sm-stage,
html.saver-mode .mf-stage,
html.saver-mode .bg-stage,
html.saver-mode .bw-stage,
html.saver-mode .clock-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
html.saver-mode .bg-wrap,
html.saver-mode .bw-wrap { margin: 0; }

/* 圆形盘面按视口短边放大，别让屏保画面中间只占一小块 */
html.saver-mode .clock-svg { width: min(80vh, 80vw); }
html.saver-mode .bg-svg { width: min(86vh, 86vw); max-width: none; }
html.saver-mode .bw-orb { width: min(84vh, 84vw); max-width: none; }
html.saver-mode .clock-digital { font-size: clamp(30px, 5.4vh, 62px); }
/* 时钟：屏保下数字与日期不参与布局，钟面才真正落在画面正中 */
html.saver-mode .clock-stage { justify-content: center; gap: 0; padding: 0; }
html.saver-mode .clock-digital,
html.saver-mode .clock-meta { position: absolute; left: 0; right: 0; }
html.saver-mode .clock-digital { bottom: 9vh; }
html.saver-mode .clock-meta { bottom: 4vh; }
html.saver-mode .bg-time { font-size: clamp(24px, 4vh, 52px); }
html.saver-mode .bw-val { font-size: clamp(24px, 4vh, 52px); }

/* 海报页：画布居中留白，不裁切 */
html.saver-mode .ip-layout { display: block; margin: 0; }
html.saver-mode .ip-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #14110c;
}
html.saver-mode .ip-canvas {
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

/* 闲置后隐去 HUD / 提示 / 光标，只留画面本身 */
html.saver-idle .sm-hud,
html.saver-idle .sm-ctrl,
html.saver-idle .sm-tip,
html.saver-idle .mf-hud,
html.saver-idle .mf-ctrl,
html.saver-idle .mf-tip,
html.saver-idle .bg-hud,
html.saver-idle .bw-hud,
html.saver-idle .clock-meta,
html.saver-idle .clock-digital,
html.saver-idle .clock-date,
html.saver-idle .saver-exit { opacity: 0; }
html.saver-idle,
html.saver-idle body,
html.saver-idle .sm-stage,
html.saver-idle .mf-stage { cursor: none; }

.sm-hud, .sm-ctrl, .sm-tip,
.mf-hud, .mf-ctrl, .mf-tip,
.bg-hud, .bw-hud,
.clock-meta, .clock-digital, .clock-date { transition: opacity .8s ease; }

/* 进入/退出屏保的角标提示 */
.saver-exit {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(10, 14, 24, .72);
  border: 1px solid rgba(150, 170, 255, .22);
  color: #cfd6f5;
  font-size: 12.5px;
  letter-spacing: .3px;
  backdrop-filter: blur(8px);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .8s ease;
}
/* 窄屏：顶部让给 HUD，提示条落到底部按钮上方 */
@media (max-width: 700px) {
  .saver-exit { top: auto; bottom: 76px; font-size: 11.5px; padding: 7px 12px; }
}
.saver-exit b { color: #fff; font-weight: 600; margin-right: 6px; }
.saver-exit.fade { opacity: 0; }

/* ---------- 屏保全屏引导层 ----------
 * 浏览器只允许「用户手势」里进全屏，所以直接用网址打开 ?saver=1 时
 * 先挡一层：点一下即 requestFullscreen，地址栏、标签栏、任务栏一起消失。
 */
.saver-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(6, 9, 16, .40), rgba(2, 4, 8, .86));
  cursor: pointer;
  animation: saverGateIn .45s ease both;
}
@keyframes saverGateIn { from { opacity: 0; } to { opacity: 1; } }
/* 面板本身压深一层：不管后面是黑星空、浅表盘还是宣纸，白字都读得清 */
.saver-gate-in {
  max-width: 420px;
  padding: 32px 40px 28px;
  border-radius: 20px;
  text-align: center;
  color: #eef1ff;
  background: rgba(7, 10, 18, .9);
  border: 1px solid rgba(150, 168, 255, .2);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: border-color .25s, background .25s;
}
.saver-gate:hover .saver-gate-in { background: rgba(11, 16, 30, .94); border-color: rgba(150, 168, 255, .38); }
.saver-gate-ico { line-height: 0; margin-bottom: 18px; color: #8fa2ff; opacity: .92; transition: color .25s, opacity .25s; }
.saver-gate-t { font-size: clamp(16px, 2vw, 21px); font-weight: 600; letter-spacing: 1.5px; white-space: nowrap; }
.saver-gate-s { margin-top: 12px; font-size: 12.5px; line-height: 1.75; color: #9aa4c9; letter-spacing: .3px; }
.saver-gate:hover .saver-gate-ico { color: #c2cdff; opacity: 1; }
@media (max-width: 420px) {
  .saver-gate-in { margin: 0 16px; padding: 26px 22px 22px; }
  .saver-gate-t { white-space: normal; }
}
