:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #667085;
  --line: #e5e9f0;
  --brand: #2f6df6;
  --brand-ink: #1b4fd6;
  --ok: #18a058;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.05);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { font-weight: 800; font-size: 18px; color: var(--ink); white-space: nowrap; }
.cat-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.cat-nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-size: 14px; }
.cat-nav a:hover, .cat-nav a.active { background: #eef3ff; color: var(--brand-ink); text-decoration: none; }
.local-badge { background: #e7f7ee; color: var(--ok); border: 1px solid #bfe9cf; padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }

/* Hero */
.hero { padding: 48px 0 28px; text-align: center; }
.hero h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: -.5px; }
.hero-sub { color: var(--muted); max-width: 720px; margin: 0 auto 22px; }
.search-box input { width: 100%; max-width: 560px; padding: 14px 18px; font-size: 16px; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); outline: none; }
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,109,246,.15); }
.sort-box { margin-top: 14px; color: var(--muted); font-size: 14px; }
.sort-box select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); }

/* Why local */
.why-local { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; margin: 12px 0 28px; box-shadow: var(--shadow); }
.why-local h2 { margin-top: 0; font-size: 20px; }
.why-local ul { margin: 0; padding-left: 20px; color: var(--muted); }
.why-local li { margin: 6px 0; }

/* Category */
.cat-section { margin: 30px 0; }
.cat-section h2 { font-size: 22px; margin: 0 0 14px; }
.cat-section h2 small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 8px; }

/* Tool grid + cards */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tool-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease; color: var(--ink); }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(16,24,40,.10); text-decoration: none; }
.tc-icon { font-size: 28px; }
.tc-title { font-weight: 700; margin: 8px 0 4px; font-size: 16px; }
.tc-desc { color: var(--muted); font-size: 13px; }
.tc-tag { position: absolute; top: 12px; right: 12px; background: #fff4e5; color: #d9730d; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid #f3d8a8; }

/* Breadcrumb */
.breadcrumb { color: var(--muted); font-size: 13px; margin: 18px 0 6px; }
.breadcrumb a { color: var(--muted); }

/* Tool page */
.page-tool { padding-bottom: 40px; }
.page-tool h1 { font-size: 28px; margin: 6px 0 8px; }
.lead { color: var(--muted); max-width: 760px; }
.planned-badge { background: #fff4e5; border: 1px solid #f3d8a8; color: #a85c0a; padding: 10px 14px; border-radius: 10px; margin: 16px 0; }
.coming-soon { text-align: center; padding: 60px 0; color: var(--muted); }
.tool-app { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 18px 0; box-shadow: var(--shadow); }

/* SEO block */
.seo-block { margin-top: 26px; }
.seo-block h2 { font-size: 18px; }
.seo-block details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; background: var(--card); }
.seo-block summary { cursor: pointer; font-weight: 600; }

/* Footer */
.site-footer { margin-top: 50px; background: #0f172a; color: #cbd5e1; }
.site-footer .wrap { padding: 28px 20px; }
.ad-slot { min-height: 90px; background: #1e293b; border: 1px dashed #334155; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #64748b; font-size: 13px; margin-bottom: 18px; }
.footer-local { background: #14223b; border: 1px solid #233452; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; color: #dbeafe; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.footer-links a { color: #93c5fd; }
.footer-meta { font-size: 13px; color: #94a3b8; }
.footer-meta .beian a { color: #93c5fd; }
.footer-meta .sep { margin: 0 8px; }

/* Buttons & forms (shared by tool UIs) */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: #fff; border: none; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brand-ink); }
.btn.secondary { background: #eef2f7; color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { margin: 12px 0; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field input[type=file], .field select, .field input[type=text], .field input[type=number], .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: #fff;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.note { color: var(--muted); font-size: 13px; }
.preview { margin-top: 14px; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; padding: 10px; }
.hidden { display: none !important; }

/* File list (PDF merge / upload order) */
.file-list { border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; padding: 8px; min-height: 42px; }
.file-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.file-item:last-child { border-bottom: none; }
.file-item > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-ctrl { display: inline-flex; gap: 6px; flex-shrink: 0; }
.mini { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 2px 9px; cursor: pointer; font-size: 13px; line-height: 1.4; }
.mini:hover { background: #eef3ff; }

/* Calculator (科学计算器 / 各类计算器) */
.calc { max-width: 340px; margin: 0 auto; }
.calc-display { width: 100%; font-size: 26px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; text-align: right; margin-bottom: 12px; background: #fff; font-variant-numeric: tabular-nums; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-grid .btn { justify-content: center; font-size: 16px; padding: 14px 0; }
.calc-eq { background: var(--ok); }
.calc-eq:hover { background: #15803d; }

/* Tabs (配色工具 / 多页签工具) */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs button { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 8px 16px; font-size: 14px; cursor: pointer; transition: all .12s ease; }
.tabs button:hover { border-color: var(--brand); color: var(--brand-ink); }
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.ct-panel { animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* 文中广告位 / 分类“查看全部” */
.ad-slot.in-content { min-height: 80px; margin: 18px 0; background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 13px; }
.cat-more { font-size: 13px; font-weight: 500; margin-left: 10px; color: var(--brand-ink); white-space: nowrap; }
.cat-more:hover { text-decoration: underline; }

/* 批量处理 UI */
.batch { margin-top: 6px; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 28px 16px; text-align: center; cursor: pointer; transition: border-color .12s, background .12s; background: #fafbfc; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: #eef3ff; }
.dz-icon { font-size: 30px; }
.dz-text { font-weight: 600; margin-top: 6px; }
.dz-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.batch-warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 10px; padding: 10px 14px; margin: 12px 0; font-size: 13px; }
.batch-warn b { color: #c2410c; }
.batch-progress { margin-top: 10px; color: var(--brand-ink); font-size: 14px; font-weight: 600; }

/* 文本对比差异 */
.diff-box { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.diff-box textarea { width: 100%; min-height: 200px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.diff-out { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; max-height: 360px; overflow: auto; }
.diff-out ins { background: #dcfce7; text-decoration: none; }
.diff-out del { background: #fee2e2; }
@media (max-width: 640px) { .diff-box { grid-template-columns: 1fr; } }

/* 代码块（JWT / Cron 等输出） */
.code-box { background:#f8fafc; color:var(--ink); border:1px solid var(--line); border-radius:10px; padding:12px 14px; margin:6px 0 0; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:13px; white-space:pre-wrap; word-break:break-all; max-height:360px; overflow:auto; }

/* 键值表（EXIF 等） */
.kv-wrap { margin-top: 6px; }
.kv { width:100%; border-collapse:collapse; background:#fff; border:1px solid var(--line); border-radius:10px; overflow:hidden; }
.kv td { border:1px solid var(--line); padding:8px 12px; font-size:13px; vertical-align:top; }
.kv td:first-child { background:#fafbfc; font-weight:600; width:34%; color:var(--muted); white-space:nowrap; }

/* 色板（取色工具） */
.swatch-grid { display:flex; flex-wrap:wrap; gap:12px; margin-top:8px; }
.swatch { width:96px; border:1px solid var(--line); border-radius:12px; overflow:hidden; cursor:pointer; background:#fff; box-shadow:var(--shadow); transition:transform .12s ease; }
.swatch:hover { transform:translateY(-3px); }
.swatch .c { height:64px; }
.swatch .hex { font-family:ui-monospace,Menlo,Consolas,monospace; font-size:12px; text-align:center; padding:6px 2px; color:var(--ink); }

/* 文档预览（PPT 文字提取 / Word 预览） */
.doc-preview { border:1px solid var(--line); border-radius:10px; background:#fff; padding:14px 16px; margin-top:8px; white-space:pre-wrap; font-family:ui-monospace,Menlo,Consolas,monospace; font-size:13px; line-height:1.7; max-height:440px; overflow:auto; }

/* 响应式：桌面 / 平板 / 手机自适应 */
@media (max-width: 900px) {
  .wrap { max-width: 100%; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 640px) {
  .hero { padding: 32px 0 18px; }
  .hero h1 { font-size: 24px; }
  .hero-sub { font-size: 14px; }
  .local-badge { display: none; }
  .cat-nav { font-size: 13px; }
  .cat-more { display: block; margin: 8px 0 0; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .tool-card { padding: 14px; }
  .tc-title { font-size: 15px; }
  .tc-desc { font-size: 12px; }
  .tool-app { padding: 16px; }
  .page-tool h1 { font-size: 23px; }
  .field input[type=text], .field input[type=number], .field input[type=file], .field select, .field textarea { font-size: 16px; }
  .row { gap: 8px; }
  .btn { width: 100%; justify-content: center; }
  .btn.secondary { width: auto; }
  .calc { max-width: 100%; }
  .search-box input { font-size: 16px; }
}
@media (max-width: 420px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
  .tc-desc { display: none; }
}

/* ===== 国际化：语言切换器 / 推荐横幅 / 根语言选择页 ===== */
/* 语言切换器（header 右上，分段控件） */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; background: #eef2f7; border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px; font-size: 13px; white-space: nowrap; }
.lang-switch a { padding: 4px 10px; border-radius: 999px; color: var(--muted); font-weight: 600; }
.lang-switch a:hover { text-decoration: none; color: var(--brand-ink); }
.lang-switch a.active { background: var(--brand); color: #fff; }
.lang-switch .sep { color: #cbd5e1; }

/* 首访语言推荐横幅（仅推荐，绝不强制跳转） */
.lang-banner { background: #eef3ff; border-bottom: 1px solid #d6e2ff; color: var(--brand-ink); font-size: 14px; padding: 10px 16px; text-align: center; }
.lang-banner[hidden] { display: none; }
.lang-banner a { color: var(--brand-ink); font-weight: 700; text-decoration: underline; }
.lang-banner button[data-dismiss] { margin-left: 12px; border: 1px solid #c3d4ff; background: #fff; color: var(--brand-ink); border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer; }

/* 根语言选择页 */
.chooser { padding: 56px 0 40px; text-align: center; }
.chooser h1 { font-size: 30px; margin: 0 0 10px; }
.chooser-sub { color: var(--muted); max-width: 640px; margin: 0 auto 30px; }
.lang-cards { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.lang-card { width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 30px 20px; box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease; color: var(--ink); }
.lang-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(16,24,40,.12); text-decoration: none; }
.lc-flag { font-size: 46px; }
.lc-name { font-size: 20px; font-weight: 800; margin-top: 10px; }
.lc-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.lang-card.recommended { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,109,246,.15), var(--shadow); }
.rec-badge { display: inline-block; margin-top: 8px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }

/* 小屏：语言切换器收紧，避免 header 溢出 */
@media (max-width: 640px) {
  .lang-switch { font-size: 12px; padding: 1px 3px; }
  .lang-switch a { padding: 3px 7px; }
}

/* ---- 新增工具 UI（纯追加，不改动既有规则） ---- */
.md-preview { background: var(--card, #fff); border: 1px solid var(--line, #e5e9f0); border-radius: 10px; padding: 14px; min-height: 120px; overflow: auto; line-height: 1.6; }
.md-preview h1, .md-preview h2, .md-preview h3, .md-preview h4 { margin: .5em 0 .3em; line-height: 1.3; }
.md-preview p { margin: .5em 0; }
.md-preview ul, .md-preview ol { padding-left: 22px; margin: .5em 0; }
.md-preview pre { background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 8px; overflow: auto; }
.md-preview code { background: #eef2ff; color: #364fc7; padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 90%; }
.md-preview pre code { background: none; color: inherit; padding: 0; }
.md-preview blockquote { border-left: 3px solid var(--brand, #2f6df6); margin: .6em 0; padding: 4px 12px; color: var(--muted, #475467); background: #f8fafc; border-radius: 0 8px 8px 0; }
.md-preview a { color: var(--brand, #2f6df6); }
.md-preview hr { border: none; border-top: 1px solid var(--line, #e5e9f0); margin: .8em 0; }

.meter { height: 10px; background: #e5e9f0; border-radius: 6px; overflow: hidden; margin: 10px 0; }
.meter > i { display: block; height: 100%; width: 0; background: #1971c2; transition: width .2s ease, background .2s ease; }

.pw-check { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.pw-check li { font-size: 13px; padding-left: 18px; position: relative; color: var(--muted, #667085); }
.pw-check li.ok { color: #2f9e44; }
.pw-check li.ok::before { content: '✓'; position: absolute; left: 0; font-weight: 700; }
.pw-check li.no { color: #e5484d; }
.pw-check li.no::before { content: '✗'; position: absolute; left: 0; font-weight: 700; }
