:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #1f2937;
  --text-soft: #5b6472;
  --border: #e6e9ef;
  --primary: #4f6ef7;
  --primary-dark: #3b54d6;
  --primary-soft: #eef2ff;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(31, 41, 55, 0.06);
  --shadow-hover: 0 8px 30px rgba(79, 110, 247, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- Top nav ---------- */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7a5cf7);
  display: grid; place-items: center; color: #fff; font-weight: 800;
}
.nav-link { color: var(--text-soft); font-size: 14px; margin-left: 18px; }
.nav-link:hover { color: var(--primary); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 56px 20px 36px;
}
.hero h1 {
  font-size: 34px;
  margin: 0 0 12px;
  letter-spacing: -0.5px;
}
.hero p {
  color: var(--text-soft);
  font-size: 16px;
  max-width: 560px;
  margin: 0 auto 20px;
}
.search {
  max-width: 460px;
  margin: 0 auto;
  position: relative;
}
.search input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 15px;
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.search::before {
  content: "🔍";
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: .6;
}

/* ---------- Hero banner ---------- */
.hero-banner {
  max-width: 900px;
  margin: 26px auto 6px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 14px 44px rgba(79, 110, 247, 0.18);
}
.hero-banner img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  object-position: center 38%;
  display: block;
}
/* 底部白色渐变：裁掉水印区域并让画面柔和收尾 */
.hero-banner::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 34%;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,.92));
  pointer-events: none;
}

/* ---------- Tool grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding: 20px 0 60px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: block;
  color: var(--text);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: #d8def7;
  text-decoration: none;
}
.card-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
  background: #f1f3f9;
}
.card-img img {
  width: 100%;
  height: 118%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
/* 底部白色渐变：遮住原图右下角水印，并让图片自然融入卡片 */
.card-img::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 28%;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #ffffff);
  pointer-events: none;
}
.card-body { padding: 16px 18px 20px; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--text-soft); font-size: 13.5px; }
.card .tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------- Tool page ---------- */
.tool-header {
  padding: 26px 0 8px;
}
.tool-header .back {
  font-size: 14px;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tool-header h1 { margin: 10px 0 4px; font-size: 26px; }
.tool-header p { color: var(--text-soft); margin: 0; }
.head-main {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.tool-icon {
  width: 64px; height: 64px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  background: #f1f3f9;
}
.tool-icon img { width: 100%; height: 118%; object-fit: cover; object-position: center top; display: block; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin: 18px 0 60px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text-soft);
}
textarea, input[type=text], input[type=number], select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 130px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
textarea:focus, input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.97); }
.btn.secondary { background: var(--primary-soft); color: var(--primary); }
.btn.secondary:hover { background: #e2e8ff; }

.result {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px dashed var(--border);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 20px;
}
.result.ok { border-color: #b7e4c7; background: #f0fdf4; color: #14532d; }
.result.err { border-color: #f3b0b0; background: #fef2f2; color: #7f1d1d; }
.hint { font-size: 12.5px; color: var(--text-soft); margin-top: 8px; }

/* image compress */
.drop {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.preview { margin-top: 16px; text-align: center; }
.preview img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.stat { display: flex; gap: 18px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.stat div { text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 12px; color: var(--text-soft); }

footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0;
  color: var(--text-soft);
  font-size: 13px;
  text-align: center;
}
.hidden { display: none !important; }

@media (max-width: 600px) {
  .hero h1 { font-size: 27px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card { padding: 16px; }
}
