/* ============ 基础 ============ */
:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --line: #e5e9f2;
  --brand: #2b59ff;
  --brand-ink: #1b3ed1;
  --brand-soft: #eef2ff;
  --ok: #0b8f63;
  --warn: #b54708;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 6px 24px -12px rgba(16, 24, 40, .18);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); }

h1, h2, h3, h4 { line-height: 1.35; color: var(--ink); margin: 1.6em 0 .6em; }
h1 { font-size: 30px; letter-spacing: -.3px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.4em; }
li { margin: .35em 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* ============ 顶部导航 ============ */
.topbar {
  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);
}
.topbar .wrap { display: flex; align-items: center; gap: 28px; height: 62px; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: -.2px; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, #2b59ff, #6f8cff);
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700;
}
.brand small { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: .04em; }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 7px 12px; border-radius: 8px; color: var(--ink-2);
  font-size: 14px; font-weight: 500;
}
.nav a:hover { background: #f2f5fb; color: var(--ink); }
.nav a.on { color: var(--brand); background: var(--brand-soft); }

.nav-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 8px; cursor: pointer; }

/* ============ Hero ============ */
.hero {
  background:
    radial-gradient(900px 320px at 50% -80px, #dfe7ff 0%, rgba(246, 248, 252, 0) 70%),
    var(--bg);
  padding: 56px 0 28px;
  text-align: center;
}
.hero h1 { font-size: 36px; margin: 0 0 12px; letter-spacing: -.6px; }
.hero p { color: var(--muted); font-size: 16px; max-width: 620px; margin: 0 auto 24px; }
.hero .badge {
  display: inline-block; margin-bottom: 16px; padding: 4px 11px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; color: var(--ink-2); box-shadow: var(--shadow-sm);
}

.search {
  display: flex; align-items: center; gap: 8px;
  max-width: 520px; margin: 0 auto; padding: 8px 8px 8px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.search input { flex: 1; border: 0; outline: 0; font-size: 15px; background: none; color: var(--ink); }
.search svg { flex: none; color: var(--muted); }
.search kbd {
  font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: #fbfcfe;
}

/* ============ 区块标题 ============ */
.section { padding: 32px 0; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 19px; margin: 0; }
.section-head span { color: var(--muted); font-size: 13px; }
.section-head .more { margin-left: auto; font-size: 13px; }

/* ============ 工具卡片 ============ */
.grid-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 18px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tool-card:hover {
  transform: translateY(-2px); border-color: #c9d4f5;
  box-shadow: 0 12px 28px -14px rgba(43, 89, 255, .35);
}
.tool-card h3 { margin: 0; font-size: 15.5px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.tool-card .ic {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 2px;
}
.tool-card .tag {
  position: absolute; top: 16px; right: 16px;
  font-size: 11px; color: var(--muted); background: #f5f7fb;
  padding: 2px 8px; border-radius: 999px;
}
.tool-card .hot { background: #fff4e8; color: #b25b00; }

/* 分类过滤 */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filters button {
  font: inherit; font-size: 13.5px; padding: 6px 14px; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2);
}
.filters button:hover { border-color: #c9d4f5; }
.filters button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ============ 文章卡片 ============ */
.grid-articles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

.post-card {
  display: block; padding: 20px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: border-color .16s, box-shadow .16s;
}
.post-card:hover { border-color: #c9d4f5; box-shadow: var(--shadow); }
.post-card .meta { display: flex; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.post-card .meta .pill { color: var(--brand); background: var(--brand-soft); padding: 1px 8px; border-radius: 999px; }
.post-card h3 { margin: 0 0 6px; font-size: 16.5px; color: var(--ink); line-height: 1.5; }
.post-card p { margin: 0; font-size: 13.5px; color: var(--muted); }

/* ============ 广告位 ============ */
.ad {
  margin: 26px 0; padding: 12px; background: #fbfcfe;
  border: 1px dashed #d5dded; border-radius: 12px; text-align: center;
}
.ad::before {
  content: "广告"; display: block; font-size: 10px; letter-spacing: .18em;
  color: #98a2b3; margin-bottom: 8px;
}
.ad-inner {
  width: 100%; max-width: 960px; margin: 0 auto; overflow: hidden;
  min-height: 90px; display: grid; place-items: center; align-content: center;
  color: #aeb7c6; font-size: 12.5px; font-family: var(--mono); line-height: 1.9;
}
.ad-ph { display: block; }
.ad-tip { font-family: inherit; font-size: 11px; color: #c3cad6; }

/* 移动端：联盟横幅多为 320×50，把占位高度放小一点 */
@media (max-width: 767px) {
  .ad { padding: 10px; }
  .ad-inner { min-height: 64px; font-size: 11.5px; }
  .ad-inner img { max-width: 100%; height: auto; }
}

/* ============ 文章正文 ============ */
.article-body { font-size: 16px; line-height: 1.9; color: var(--ink-2); }
.article-body h2 { font-size: 20px; margin-top: 2em; color: var(--ink); }
.article-body h3 { font-size: 16.5px; color: var(--ink); }
.article-body strong { color: var(--ink); }
.article-body a { border-bottom: 1px solid #c7d3ff; }
.article-body code {
  font: 13.5px var(--mono); background: #eef1f7; color: #1d2939;
  padding: 2px 5px; border-radius: 5px;
}
.article-body pre {
  background: #0f1729; color: #e6edf7; padding: 16px 18px; border-radius: 12px;
  overflow: auto; font: 13px/1.7 var(--mono); margin: 0 0 1.4em;
}
.article-body pre code { background: none; padding: 0; color: inherit; font-size: 13px; }
.article-body .note {
  border-left: 3px solid var(--brand); background: var(--brand-soft);
  padding: 12px 16px; border-radius: 0 10px 10px 0; color: #22307a;
  font-size: 14.5px; margin: 1.4em 0;
}
.article-head { padding: 36px 0 8px; }
.article-head h1 { margin: 0 0 12px; font-size: 32px; }
.article-head .meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); padding-top: 20px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--brand); }

/* ============ 工具页 ============ */
.tool-page { padding-bottom: 48px; }
.tool-head { padding: 26px 0 10px; }
.tool-head h1 { font-size: 27px; margin: 6px 0 8px; }
.tool-head p { color: var(--muted); margin: 0; max-width: 720px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }

/* 表单控件 */
textarea, input[type=text], input[type=number], select {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  outline: none; transition: border-color .15s, box-shadow .15s; width: 100%;
}
textarea:focus, input[type=text]:focus, input[type=number]:focus, select:focus {
  border-color: #a9bcf7; box-shadow: 0 0 0 3px rgba(43, 89, 255, .1);
}
textarea { resize: vertical; line-height: 1.6; }
textarea.code, pre.out.code { font: 13px/1.65 var(--mono); }
select { width: auto; cursor: pointer; padding-right: 30px; }
input[type=range] { width: 100%; accent-color: var(--brand); }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }

.controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0;
}
.controls .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.controls .spacer { margin-left: auto; }
.controls .grow { flex: 1; min-width: 220px; }

.ctl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); min-width: 150px; }
.ctl b { color: var(--brand); font-weight: 600; }
.ctl-inline { flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
.ctl select, .ctl input[type=number] { width: 100%; }

.hint { font-size: 12.5px; color: var(--muted); }
.msg { font-size: 13px; margin-top: 8px; }
.msg.ok { color: var(--ok); }
.msg.err { color: #d92d20; }

/* 按钮 */
.btn {
  font: inherit; font-size: 13.5px; font-weight: 500; padding: 7px 14px;
  background: #fff; color: var(--ink-2); border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #b9c6ea; color: var(--ink); background: #fbfcfe; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 拖拽区 */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 140px; padding: 24px; text-align: center; cursor: pointer;
  border: 1.5px dashed #ccd6ea; border-radius: 12px; background: #fbfcff;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop strong { font-size: 14.5px; }
.drop span { font-size: 12.5px; color: var(--muted); }

/* 文件列表 / 结果行 */
.filelist { display: flex; flex-direction: column; gap: 10px; }
.file-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 11px; background: #fff;
}
.file-row .thumb {
  width: 46px; height: 46px; border-radius: 8px; object-fit: cover;
  background: #f2f5fb; flex: none;
}
.file-row .info { flex: 1; min-width: 0; }
.file-row .info b { display: block; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .info span { font-size: 12px; color: var(--muted); }
.file-row .save { color: var(--brand); font-size: 13px; font-weight: 500; }

.preview { margin-top: 14px; }
.preview img { max-height: 260px; border: 1px solid var(--line); border-radius: 10px; }

pre.out {
  background: #f8fafd; border: 1px solid var(--line); border-radius: 11px;
  padding: 14px 16px; margin: 12px 0 0; overflow: auto; max-height: 380px;
  color: var(--ink-2); white-space: pre-wrap; word-break: break-word;
}

/* 网格两列 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > div > .controls:first-child { margin-top: 0; }

/* 统计卡 */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.stat {
  flex: 1 1 130px; background: #f8fafd; border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 14px;
}
.stat span { display: block; font-size: 11.5px; color: var(--muted); }
.stat strong { font-size: 19px; font-weight: 600; letter-spacing: -.3px; }
.stat strong.sm { font-size: 14px; font-weight: 500; }

/* 数据表 */
table.data { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13.5px; }
table.data th, table.data td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { width: 34%; font-weight: 500; color: var(--muted); background: #fafbfe; }
table.data td { font-family: var(--mono); font-size: 13px; word-break: break-all; }

/* 对比 */
pre.diff { line-height: 1.7; }
pre.diff .add { color: #05603a; background: #e7f8f0; display: block; }
pre.diff .del { color: #912018; background: #fdecea; display: block; }
pre.diff .same { color: var(--muted); display: block; }

/* 色板 */
.swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-top: 16px; }
.swatches div { height: 52px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, .06); }
.swatches div small { display: block; font: 10px var(--mono); text-align: center; margin-top: 56px; color: var(--muted); }

/* 芯片 */
.chips { gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  font-size: 13px; cursor: pointer; color: var(--ink-2);
}
.chip input { accent-color: var(--brand); margin: 0; }

/* ============ 页脚 ============ */
.footer {
  margin-top: 56px; padding: 36px 0 26px; background: #fff;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; }
.footer h4 { font-size: 13px; margin: 0 0 10px; color: var(--ink); }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin: 5px 0; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--brand); }
.footer .about { max-width: 320px; line-height: 1.75; }
.footer-bottom {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: #98a2b3;
}
.footer-bottom a { color: #98a2b3; }

/* ============ 响应式 ============ */
@media (max-width: 960px) {
  .grid-tools { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .swatches { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 680px) {
  body { font-size: 14.5px; }
  .hero { padding: 38px 0 18px; }
  .hero h1 { font-size: 23px; }
  .hero p { font-size: 14.5px; }
  .search kbd { display: none; }
  .section-head { flex-wrap: wrap; }
  .section-head h2 { flex: none; white-space: nowrap; }
  .section-head span { display: none; }
  .grid-tools, .grid-articles, .grid2 { grid-template-columns: 1fr; }
  .nav { display: none; }
  .nav.open {
    display: flex; flex-direction: column; position: absolute; left: 0; right: 0; top: 62px;
    background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px 14px;
    box-shadow: var(--shadow);
  }
  .nav-toggle { display: block; }
  .topbar .wrap { gap: 12px; position: relative; }
  .article-head h1, .tool-head h1 { font-size: 23px; }
  .footer-grid { grid-template-columns: 1fr; gap: 18px; }
  .card { padding: 15px; }
  .stat { flex: 1 1 45%; }
  .swatches { grid-template-columns: repeat(5, 1fr); }
}
