:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #6b7280;
  --brand: #4f46e5;
  --brand-d: #4338ca;
  --line: #e5e7eb;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* Header */
header.site {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
header.site .row { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; color: var(--ink); white-space: nowrap; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--brand), #8b5cf6); display: inline-block; }
header .spacer { flex: 1; }
.lang-select {
  appearance: none; border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; padding: 7px 30px 7px 12px; font-size: 14px; color: var(--ink);
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}
[dir="rtl"] .lang-select { padding: 7px 12px 7px 30px; background-position: left 10px center; }

/* 顶部工具菜单 */
.topnav { display: flex; align-items: center; gap: 2px; margin-left: 10px; min-width: 0; }
.topnav-link {
  font-size: 14px; color: var(--ink); padding: 6px 10px; border-radius: 8px;
  white-space: nowrap; line-height: 1;
}
.topnav-link:hover { background: #eef2ff; text-decoration: none; color: var(--brand-d); }
.drop-btn { border: none; background: transparent; cursor: pointer; font: inherit; color: var(--ink); }
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 18px 20px; display: none;
  grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 14px 22px;
}
.dropdown.open .dropdown-panel { display: grid; }
.dd-cat { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 8px; }
.dd-col a { display: block; font-size: 14px; padding: 4px 0; color: var(--ink); }
.dd-col a:hover { color: var(--brand); text-decoration: none; }

/* 中等及以下宽度：收起平铺的热门工具，只留「更多工具」入口，避免与语言选择器重叠 */
@media (max-width: 1180px) {
  .topnav > a.topnav-link { display: none; }
}
@media (max-width: 860px) {
  .dropdown-panel { grid-template-columns: repeat(2, minmax(120px, 1fr)); max-width: 88vw; padding: 16px; }
}

/* Hero */
.hero { padding: 40px 0 18px; text-align: center; }
.hero h1 { font-size: 30px; margin: 0 0 10px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; }
.badge { display: inline-block; margin-top: 14px; background: #ecfdf5; color: var(--ok); border: 1px solid #bbf7d0; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }

/* 分类标题 / 面包屑 */
.cat-title { font-size: 18px; margin: 30px 0 4px; color: var(--ink); }
.cat-title.hot::before { content: "🔥 "; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* Tool grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 14px 0 26px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
.tool-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: block; color: var(--ink); transition: transform .12s, box-shadow .12s;
}
.tool-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c7d2fe; }
.tool-card .ic { font-size: 22px; }
.tool-card h3 { margin: 8px 0 6px; font-size: 16px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* Tool page */
.tool-wrap { padding: 28px 0 56px; }
.tool-head { text-align: center; margin-bottom: 22px; }
.tool-head h1 { font-size: 26px; margin: 0 0 8px; }
.tool-head p { color: var(--muted); margin: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }

.dropzone {
  border: 2px dashed #c7d2fe; border-radius: var(--radius); background: #fafbff;
  padding: 44px 20px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s;
}
.dropzone.drag { background: #eef2ff; border-color: var(--brand); }
.dropzone .big { font-size: 38px; }
.dropzone .hint { color: var(--muted); margin: 10px 0; }
.dropzone .dz-note { margin-top: 14px; font-size: 12.5px; color: #9aa1ac; }
.btn {
  display: inline-block; background: var(--brand); color: #fff; border: none; cursor: pointer;
  padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
}
.btn:hover { background: var(--brand-d); text-decoration: none; }
.btn.secondary { background: #eef2ff; color: var(--brand-d); }
.btn.secondary:hover { background: #e0e7ff; }
.btn:disabled { opacity: .5; cursor: default; }

.options { display: flex; flex-wrap: wrap; gap: 16px 22px; align-items: flex-end; margin: 18px 0; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input[type=number], .field select {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 14px; min-width: 130px; background:#fff; color:var(--ink);
}
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.range-row { display:flex; align-items:center; gap:10px; }
.range-row input[type=range]{ width:200px; }
.preset-row { display:flex; flex-wrap:wrap; gap:8px; }
.preset { border:1px solid var(--line); background:#fff; border-radius:999px; padding:6px 14px; font-size:13px; cursor:pointer; }
.preset.active { background:var(--brand); color:#fff; border-color:var(--brand); }

.results { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.result-item { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.result-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background:#f1f5f9; }
.result-item .meta { flex: 1; min-width: 0; }
.result-item .meta .nm { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-item .meta .sz { font-size: 13px; color: var(--muted); }
.result-item .meta .sz b { color: var(--ok); }
.toolbar { display:flex; gap:10px; flex-wrap:wrap; margin-top:16px; align-items:center; }
.save-summary { font-size:14px; color:var(--ink); margin-right:auto; }
.save-summary b { color:var(--ok); font-size:15px; }
.result-item .meta .sz b { background:#ecfdf5; border:1px solid #bbf7d0; border-radius:999px; padding:1px 8px; white-space:nowrap; }

/* 图片编辑工作区（裁剪/打码/标注等共用） */
.edit-stage { margin-top: 18px; text-align: center; }
.cropbox { position: relative; display: inline-block; max-width: 100%; touch-action: none; }
.cropbox img { max-width: 100%; max-height: 64vh; display: block; user-select: none; }
.crop-sel { position: absolute; border: 2px dashed #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); cursor: move; box-sizing: border-box; }
.crop-h { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--brand); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.crop-h-nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-h-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-h-sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-h-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-dims { position: absolute; left: 50%; top: -28px; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
/* 居中工作区里的画布（打码/标注/旋转） */
.edit-stage canvas, .edit-stage .stage-canvas { max-width: 100%; max-height: 64vh; }

/* Ad slots */
.ad-slot {
  margin: 24px 0; min-height: 90px; border: 1px dashed var(--line); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; color: #b6bcc8; font-size: 13px; background: #fbfcfe;
}

/* SEO content */
.seo { margin: 36px 0; color: var(--ink); }
.seo h2 { font-size: 19px; margin: 24px 0 8px; }
.seo p { color: #374151; }
.faq dt { font-weight: 600; margin-top: 14px; }
.faq dd { margin: 4px 0 0; color: #374151; }
/* FAQ 折叠手风琴 */
.faq-item { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-top: 10px; overflow: hidden; }
.faq-item summary { cursor: pointer; padding: 14px 16px; font-weight: 600; color: var(--ink); list-style: none; position: relative; padding-right: 40px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--brand); font-size: 20px; line-height: 1; }
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-a { padding: 0 16px 14px; color: #374151; }
.seo h3 { font-size: 16px; margin: 18px 0 6px; color: var(--ink); }
.seo code { background: #eef2ff; color: var(--brand-d); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* 使用步骤 */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 12px 0 8px; display: grid; gap: 12px; }
.steps li {
  counter-increment: step; position: relative; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 14px 56px;
}
.steps li::before {
  content: counter(step); position: absolute; left: 14px; top: 14px;
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff;
  font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.steps .step-en { display: block; font-weight: 600; color: var(--ink); }
.steps .step-zh { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }

/* 相关工具互链 */
.related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 12px 0 8px; }
@media (max-width: 600px) { .related-grid { grid-template-columns: 1fr; } }
.rel-card {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--ink);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.rel-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c7d2fe; }
.rel-card .ic { font-size: 20px; }
.rel-card .rel-name { font-weight: 600; font-size: 14px; }

/* 博客 */
.post-list { display: grid; gap: 16px; margin: 20px 0 30px; }
.post-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; color: var(--ink); transition: transform .12s, box-shadow .12s, border-color .12s; }
.post-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c7d2fe; }
.post-card h3 { margin: 0 0 4px; font-size: 18px; }
.post-card .post-subtitle { margin: 0 0 8px; color: var(--brand-d); font-size: 14px; }
.post-card .muted { font-size: 14px; }
.post-card .post-date { display: block; margin-top: 10px; font-size: 12.5px; }
.post-subtitle { color: var(--muted); font-size: 16px; margin: 0 0 6px; }
article.seo .post-date { margin-bottom: 8px; }

footer.site { border-top: 1px solid var(--line); background: var(--card); padding: 30px 0; margin-top: 30px; color: var(--muted); font-size: 14px; }
footer.site .links { display:flex; flex-wrap:wrap; gap:14px; margin-bottom:10px; }
/* 富页脚多列内链 */
.foot-cols { display: grid; grid-template-columns: repeat(5, 1fr); gap: 22px; margin-bottom: 20px; }
@media (max-width: 860px) { .foot-cols { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .foot-cols { grid-template-columns: 1fr; } }
.foot-col { display: flex; flex-direction: column; gap: 7px; }
.foot-h { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); margin-bottom: 3px; }
.foot-col a { color: var(--muted); font-size: 13.5px; }
.foot-col a:hover { color: var(--brand); text-decoration: none; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- 社交封面/缩略图编辑器 ---------- */
.cover-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cover-presets .preset { font-size: 12.5px; padding: 5px 10px; }
.cover-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; background: #0b1020; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 14px rgba(0,0,0,.18); }
.cover-canvas { display: block; max-width: 100%; height: auto; touch-action: none; cursor: move; }
.cover-guide { position: absolute; pointer-events: none; border: 2px dashed rgba(255,255,255,.85); box-shadow: 0 0 0 9999px rgba(0,0,0,.18); }
.cover-guide-tip { position: absolute; top: 4px; left: 6px; font-size: 11px; line-height: 1.2; color: #fff; background: rgba(0,0,0,.5); padding: 2px 6px; border-radius: 4px; }
.cover-controls { margin-top: 14px; }
.cover-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.cover-row input[type="range"] { flex: 1 1 120px; min-width: 90px; }
.cover-lab { font-size: 13px; color: var(--muted); white-space: nowrap; }
.cover-layer { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft, #f8fafc); }
.cover-text { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; resize: vertical; margin-bottom: 6px; }
.cover-sel { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.btn.active { outline: 2px solid var(--brand); outline-offset: 1px; }
@media (max-width: 640px) {
  .cover-row input[type="range"] { flex-basis: 100%; }
}
