:root{
  --bg:#f6f8fb;
  --card:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --primary:#2563eb;
  --primary-d:#1d4ed8;
  --border:#e5e7eb;
  --badge-bg:#e8f5e9;
  --badge-fg:#1b7a3d;
  --radius:14px;
  --shadow:0 1px 3px rgba(0,0,0,.06),0 6px 18px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0f1419; --card:#1a212b; --text:#e6e9ee; --muted:#9aa4b2;
    --border:#2a3340; --badge-bg:#16321f; --badge-fg:#5fd98a;
    --shadow:0 1px 3px rgba(0,0,0,.4),0 6px 18px rgba(0,0,0,.3);
  }
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;
  background:var(--bg); color:var(--text); line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
a{color:var(--primary);text-decoration:none;}

/* ===== Header ===== */
.site-header{
  position:sticky; top:0; z-index:50;
  background:var(--card); border-bottom:1px solid var(--border);
  box-shadow:var(--shadow);
}
.site-header .bar{
  max-width:1000px; margin:0 auto; padding:10px 16px;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
}
.brand{font-size:18px; font-weight:700; display:flex; align-items:center; gap:8px;}
.brand .logo{font-size:22px;}
.badge{
  display:inline-flex; align-items:center; gap:6px;
  background:var(--badge-bg); color:var(--badge-fg);
  font-size:12.5px; font-weight:600; padding:4px 10px; border-radius:999px;
  white-space:nowrap;
}
.nav{
  max-width:1000px; margin:0 auto; padding:0 16px 10px;
  display:flex; gap:8px; overflow-x:auto; flex-wrap:wrap;
}
.nav a{
  font-size:13px; color:var(--muted); padding:4px 10px; border-radius:999px;
  border:1px solid transparent; white-space:nowrap;
}
.nav a:hover{background:var(--bg);}
.nav a.active{color:var(--primary); background:var(--bg); border-color:var(--border); font-weight:600;}

/* ===== Layout ===== */
.container{max-width:1000px; margin:0 auto; padding:24px 16px 60px;}
.hero{margin:8px 0 24px;}
.hero h1{font-size:24px; margin:0 0 6px;}
.hero p{color:var(--muted); margin:0;}
.section-title{font-size:15px; color:var(--muted); margin:28px 0 12px; font-weight:600; letter-spacing:.03em;}

/* ===== Cards ===== */
.grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:14px;}
.card{
  display:block; background:var(--card); border:1px solid var(--border);
  border-radius:var(--radius); padding:16px; box-shadow:var(--shadow);
  transition:transform .12s ease, border-color .12s ease;
}
.card:hover{transform:translateY(-2px); border-color:var(--primary);}
.card .ico{
  display:flex; align-items:center; justify-content:center;
  width:44px; height:44px; margin-bottom:8px;
  background:var(--bg); border:1px solid var(--border); border-radius:12px;
  color:var(--primary);
}
.card:hover .ico{border-color:var(--primary);}
.card .t{font-weight:600; margin-top:2px;}
.card .d{font-size:12.5px; color:var(--muted); margin-top:4px;}
/* 内联 SVG 图标通用样式（Lucide，currentColor 可被 CSS 控色） */
.ico-svg{width:24px; height:24px; display:block; flex:none;}
.chip-svg{width:14px; height:14px; display:inline-block; vertical-align:-2px; margin-right:3px; flex:none;}
.brand .logo .ico-svg{width:22px; height:22px;}

/* ===== 水印工具实时预览 ===== */
.pv-wrap{background:var(--bg); border:1px solid var(--border); border-radius:10px; padding:8px; text-align:center;}
#pv{max-width:100%; max-height:520px; display:block; margin:0 auto; border-radius:6px;}
.pv-thumbs{display:flex; gap:8px; overflow-x:auto; margin-top:10px; padding-bottom:4px;}
.pv-thumb{width:56px; height:56px; object-fit:cover; border:2px solid var(--border); border-radius:8px; cursor:pointer; flex:none; background:var(--bg);}
.pv-thumb:hover{border-color:var(--primary);}
.pv-thumb.on{border-color:var(--primary); box-shadow:0 0 0 2px rgba(37,99,235,.18);}

/* ===== Tool page ===== */
.tool{max-width:760px; margin:0 auto; padding:24px 16px 60px;}
.tool h1{font-size:22px; margin:0 0 4px;}
.tool .sub{color:var(--muted); font-size:14px; margin:0 0 20px;}
.panel{
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px; box-shadow:var(--shadow); margin-bottom:16px;
}
label{display:block; font-size:13px; color:var(--muted); margin:12px 0 6px;}
input[type=text], input[type=number], textarea, select{
  width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:10px;
  background:var(--bg); color:var(--text); font-size:14px; font-family:inherit;
}
textarea{resize:vertical; min-height:120px;}
input[type=range]{width:100%;}
.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center;}
.row > *{flex:1 1 160px;}
button{
  background:var(--primary); color:#fff; border:none; border-radius:10px;
  padding:10px 18px; font-size:14px; font-weight:600; cursor:pointer;
  transition:background .12s ease;
}
button:hover{background:var(--primary-d);}
button.ghost{background:transparent; color:var(--primary); border:1px solid var(--border);}
button:disabled{opacity:.5; cursor:not-allowed;}
.drop{
  border:2px dashed var(--border); border-radius:12px; padding:26px; text-align:center;
  color:var(--muted); cursor:pointer; background:var(--bg);
}
.drop.hover{border-color:var(--primary); color:var(--primary);}
.hint{font-size:12.5px; color:var(--muted); margin-top:8px;}
.result{margin-top:14px; font-size:14px;}
.result .ok{color:var(--badge-fg);}
.result .err{color:#d23f3f;}
.code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:13px; word-break:break-all; background:var(--bg); border:1px solid var(--border); border-radius:10px; padding:10px 12px; margin-top:8px;}
pre.code{white-space:pre-wrap;}
table.cmp{width:100%; border-collapse:collapse; margin-top:10px; font-size:13px;}
table.cmp td{padding:6px 8px; border-bottom:1px solid var(--border);}
.tag{display:inline-block; font-size:11px; background:var(--bg); border:1px solid var(--border); border-radius:6px; padding:1px 7px; color:var(--muted); margin-left:6px;}
.chips{display:flex; flex-wrap:wrap; gap:8px; margin-top:6px;}
.chip{display:inline-block; font-size:13px; background:var(--bg); border:1px solid var(--border); border-radius:999px; padding:6px 12px; color:var(--text);}
.chip:hover{border-color:var(--primary); color:var(--primary);}
.related-box{margin-top:8px;}
img.preview{display:block;max-width:100%;max-height:360px;border:1px solid var(--border); border-radius:10px; margin-top:6px;}
.cmp-block{margin-bottom:22px;}
.cmp-label{font-size:22px;font-weight:800;margin:4px 0 2px;color:var(--text);}
.cmp-size{font-size:13px;font-weight:600;color:var(--muted);margin-left:10px;}

/* ===== Footer ===== */
.site-footer{max-width:1000px; margin:0 auto; padding:24px 16px; color:var(--muted); font-size:12.5px; border-top:1px solid var(--border); text-align:center;}

@media (max-width:560px){
  .grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:10px;}
  .hero h1{font-size:20px;}
}
