/* 证件水印卫士 —— 工具页样式（单文件、无依赖、移动优先） */

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1f2937;
  --ink-2: #6b7280;
  --line: #e5e7eb;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --danger: #dc2626;
  --warn-bg: #fef3c7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

.container { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 6px; }
.brand-mark { font-size: 20px; }
.nav { display: flex; align-items: center; gap: 14px; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.nav a:hover { color: var(--brand); }
.nav select {
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px;
  background: #fff; font-size: 13px; color: var(--ink-2); cursor: pointer;
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 36px 0 20px; }
.hero h1 { font-size: 26px; margin: 0 0 8px; }
.hero p { color: var(--ink-2); margin: 0 0 14px; }
.badges { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0; margin: 0; }
.badges li {
  background: #e0e7ff; color: #3730a3; font-size: 13px;
  padding: 4px 12px; border-radius: 999px;
}

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

/* ---------- 上传区 ---------- */
.dropzone {
  border: 2px dashed #a5b4fc;
  border-radius: var(--radius);
  background: #f8fbff;
  text-align: center;
  padding: 28px 16px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropzone.drag-over { border-color: var(--brand); background: #e0e7ff; }
.dropzone.warn { border-color: var(--danger); background: var(--warn-bg); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.dz-icon { font-size: 34px; }
.dz-title { font-weight: 600; margin: 6px 0 2px; }
.dz-hint { color: var(--ink-2); font-size: 13px; margin: 0; }

/* ---------- 缩略图 ---------- */
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb { position: relative; width: 72px; height: 72px; }
.thumb img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); display: block;
}
.thumb-del {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; background: var(--danger); color: #fff;
  font-size: 13px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.thumb-rot {
  position: absolute; bottom: -7px; left: -7px;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; background: var(--brand); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.thumb-rot:hover { background: var(--brand-dark); }
.thumb img { transition: transform .15s; }

/* ---------- 表单 ---------- */
.form { margin-top: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }
.field { margin-bottom: 14px; min-width: 0; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input[type="text"], .field input[type="date"], .field input[type="number"],
.field select, .field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid #c7d2fe; border-color: var(--brand);
}
.field-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.hint { font-size: 12px; color: var(--ink-2); }
.link-btn {
  border: none; background: none; color: var(--brand);
  font-size: 12px; cursor: pointer; padding: 0;
}
.link-btn:hover { text-decoration: underline; }
.mt-4 { margin-top: 8px; }

/* ---------- 高级设置 ---------- */
.adv { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.adv summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.adv[open] summary { margin-bottom: 10px; }

.swatches { display: flex; align-items: center; gap: 8px; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line); cursor: pointer; padding: 0;
  transition: transform .12s;
}
.swatch.active { border-color: var(--brand); transform: scale(1.12); box-shadow: 0 0 0 2px #c7d2fe; }
#colorPicker { width: 34px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; padding: 2px; }

input[type="range"] { width: 100%; accent-color: var(--brand); }

/* ---------- 按钮 ---------- */
.actions { display: flex; gap: 12px; }
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, opacity .15s;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { color: var(--brand); border-color: var(--brand); }
.btn.lg { padding: 12px 26px; font-size: 15px; flex: 1; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- 结果 ---------- */
.results-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.results-head h2 { margin: 0; font-size: 18px; }
.result-list { display: grid; gap: 16px; }
.result-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.result-card img { width: 100%; height: auto; max-height: 460px; object-fit: contain; border-radius: 6px; background: #fafafa; }
.result-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.name-input {
  flex: 1; min-width: 160px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}

/* ---------- 步骤 / FAQ ---------- */
.prose h2 { font-size: 20px; margin: 4px 0 14px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .steps { grid-template-columns: 1fr; } }
.step { background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.step h3 { font-size: 15px; margin: 0 0 6px; }
.step p { font-size: 13px; color: var(--ink-2); margin: 0; }
.faq-item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item summary { font-weight: 600; cursor: pointer; font-size: 15px; }
.faq-item p { color: var(--ink-2); font-size: 14px; margin: 8px 0 2px; }

/* ---------- Footer ---------- */
/* 广告位预埋：空容器不占版面；接入广告后（:not(:empty)）再显示 */
.ad-slot { margin: 14px auto; text-align: center; max-width: 728px; }
.ad-slot:empty { display: none; margin: 0; }
.ad-slot:not(:empty) { min-height: 90px; }
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 28px; padding: 18px 0 26px; }
.site-footer p { margin: 4px 0; font-size: 13px; color: var(--ink-2); text-align: center; }
.site-footer a { color: var(--ink-2); }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed; top: 68px; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #111827; color: #fff; font-size: 14px;
  padding: 9px 18px; border-radius: 8px;
  opacity: 0; transform: translateY(-6px); transition: all .25s;
  max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.warn { background: #b45309; }
.toast.error { background: var(--danger); }

/* ---------- 项目 6 专属：工具导航栏 / 九宫格预览 / 压缩结果表 / 工具卡片 ---------- */
.tool-nav {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.tool-nav .container { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; padding-top: 6px; padding-bottom: 6px; }
.tool-nav .tn-brand { font-weight: 700; font-size: 15px; margin-right: 10px; color: var(--ink); text-decoration: none; }
.tool-nav a {
  font-size: 13px; color: var(--ink-2); text-decoration: none;
  padding: 5px 12px; border-radius: 999px;
}
.tool-nav a:hover { color: var(--brand); background: #e0e7ff; }
.tool-nav a.active { background: #e0e7ff; color: #3730a3; font-weight: 600; }
.tool-nav a.soon { color: #c7cbe0; cursor: default; }

.grid-preview {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  max-width: 420px; margin: 14px auto; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line);
}
.grid-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }

.comp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.comp-table th, .comp-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.comp-table th { background: #e0e7ff; }
.ratio-good { color: #047857; font-weight: 600; }
.ratio-bad { color: #b45309; }

.tool-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .tool-cards { grid-template-columns: 1fr; } }
.tool-card {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; text-decoration: none; color: var(--ink); transition: all .15s;
}
.tool-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(79,70,229,.12); transform: translateY(-2px); }
.tool-card .tc-icon { font-size: 30px; }
.tool-card h3 { margin: 8px 0 6px; font-size: 16px; }
.tool-card p { margin: 0; font-size: 13px; color: var(--ink-2); }
.tool-card.soon { opacity: .55; cursor: default; }
.tool-card.soon:hover { border-color: var(--line); box-shadow: none; transform: none; }

/* ---------- 修复：上传区已选图约束（v0.1.1） ---------- */
/* showPicked 使用 .has-image 状态展示预览，但约束样式此前只存在于 p3 的样式表，
   本项目 CSS 源自 p1 导致图片按原始尺寸渲染（超大）。补齐与 p3 一致的约束： */
.dropzone.has-image { padding: 6px; }
.dropzone.has-image img {
  max-height: 260px; width: auto; max-width: 100%;
  border-radius: 8px; display: block; margin: 0 auto;
}

/* ---------- resize 预览网格 ---------- */
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.pg-cell { margin: 0; text-align: center; }
.pg-cell img { width: 100%; height: 160px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fafafa; }
.pg-cell figcaption { font-size: 12px; color: var(--ink-2); margin-top: 4px; }

/* ---------- stitch / beautify / rename 专属 ---------- */
.thumb-seq {
  position: absolute; bottom: -7px; right: -7px;
  min-width: 18px; height: 18px; border-radius: 999px; padding: 0 4px;
  background: #4f46e5; color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.stitch-preview img, .beautify-preview img {
  max-width: 100%; max-height: 520px; border-radius: 8px;
  border: 1px solid var(--line); display: block; margin: 0 auto;
  object-fit: contain;
}

/* ---------- v0.3.2 导航视觉优化 ---------- */
.tool-nav { box-shadow: 0 1px 3px rgba(30, 27, 75, .05); }
.tool-nav .container { flex-wrap: nowrap; height: 58px; gap: 10px; }

/* 品牌：渐变徽章 + 名称 */
.tn-brand { display: flex; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 700; }
.tn-brand:hover { background: none; color: var(--ink); }
.tn-logo {
  width: 27px; height: 27px; border-radius: 9px; font-size: 15px;
  background: linear-gradient(135deg, #4f46e5, #818cf8);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(79, 70, 229, .3);
}

/* 全部工具按钮：渐变填充（工具页显示当前工具名，兼任位置指示） */
.tn-menu { position: relative; margin-left: auto; }
.tn-more {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff;
  font-size: 13px; font-weight: 600; padding: 7px 15px; border-radius: 999px;
  cursor: pointer; font-family: inherit; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .28);
  transition: filter .15s, box-shadow .15s;
}
.tn-more:hover { filter: brightness(1.08); box-shadow: 0 4px 12px rgba(79, 70, 229, .36); }
.tn-caret { font-size: 10px; transition: transform .18s; }
.tn-menu:focus-within .tn-caret { transform: rotate(180deg); }

/* 博客链接：安静文字链 */
.tn-blog { padding: 5px 10px; }
.tn-blog:hover { background: #f1f2f8 !important; color: var(--brand); }

/* 下拉：带标题栏与描述的卡片菜单 */
.tn-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 10px);
  width: min(500px, calc(100vw - 32px)); padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 16px 48px rgba(30, 27, 75, .16);
  z-index: 100;
}
.tn-menu:hover .tn-dropdown, .tn-menu:focus-within .tn-dropdown { display: block; animation: tn-pop .16s ease; }
@keyframes tn-pop { from { opacity: 0; transform: translateY(-6px); } }

.tn-dd-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px;
  font-size: 13.5px; font-weight: 700; color: var(--ink);
}
.tn-dd-head span { font-size: 11.5px; font-weight: 400; color: var(--ink-2); }

.tn-dd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.tn-dropdown .tn-dd-grid a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px;
  transition: background .12s;
}
.tn-dropdown .tn-dd-grid a:hover { background: #f5f6ff; }
.tn-dropdown .tn-dd-grid a.active { background: linear-gradient(135deg, #eef2ff, #e0e7ff); }

.tn-ico {
  width: 34px; height: 34px; border-radius: 10px; background: #f1f2f8;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0; transition: background .12s, box-shadow .12s;
}
.tn-dd-grid a:hover .tn-ico, .tn-dd-grid a.active .tn-ico {
  background: #fff; box-shadow: 0 2px 6px rgba(30, 27, 75, .1);
}

.tn-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.tn-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.tn-desc { font-size: 11.5px; color: var(--ink-2); }

@media (max-width: 560px) {
  .tn-dd-grid { grid-template-columns: 1fr; }
  .tn-dropdown { width: min(300px, calc(100vw - 24px)); }
  .tn-brand { font-size: 14px; }
  .tn-blog { display: none; }
}
