:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #171a23;
  --muted: #6b7280;
  --line: #e6e8ef;
  --primary: #3b5bdb;
  --primary-weak: #eef1fd;
  --green: #0ca678;
  --red: #e03131;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b5bdb, #12b886);
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
}
.site-nav {
  display: flex;
  gap: 18px;
  margin-left: auto;
  font-size: 14px;
}
.site-nav a { color: #4b5563; }
.site-nav a:hover { color: var(--primary); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--primary); font-weight: 600; }

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

.hero { padding: 18px 0 8px; }
.hero h1 { font-size: 30px; line-height: 1.25; margin: 0 0 10px; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); max-width: 720px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-weak);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  color: inherit;
}
a.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(16, 24, 40, .05), 0 14px 32px rgba(16, 24, 40, .10);
  border-color: #cfd6ea;
  text-decoration: none;
}
.card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary-weak);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 20px;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.card .meta { margin-top: 14px; font-size: 12px; color: #9aa1ae; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.panel + .panel { margin-top: 16px; }
.panel h2 { font-size: 16px; margin: 0 0 14px; }
.panel h2 .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: 8px; }

.tool-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.tool-head h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; }
.tool-head p { margin: 0; color: var(--muted); }
.back { font-size: 13px; color: var(--muted); }

.layout-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 820px) {
  .layout-two { grid-template-columns: 1fr; }
  .hero h1 { font-size: 24px; }
  .site-nav { gap: 12px; font-size: 13px; }
  .header-inner { gap: 12px; }
}

.dropzone {
  border: 1.5px dashed #c8cee0;
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-weak); }
.dropzone .big { font-size: 28px; margin-bottom: 8px; }
.dropzone strong { display: block; margin-bottom: 4px; }
.dropzone span { color: var(--muted); font-size: 13px; }

.field { margin: 16px 0; }
.field > label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 7px; font-weight: 600; }
.field .row { display: flex; align-items: center; gap: 10px; }
.field output { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 52px; text-align: right; }

select, input[type="text"], input[type="number"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  outline: none;
}
select:focus, input[type="text"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 91, 219, .12); }

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

.swatches { display: flex; gap: 10px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}
.swatch.active { box-shadow: 0 0 0 2px var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s ease, background .15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--primary); border-color: #cfd6ea; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.preview-wrap {
  background:
    linear-gradient(45deg, #eef0f5 25%, transparent 25%, transparent 75%, #eef0f5 75%),
    linear-gradient(45deg, #eef0f5 25%, transparent 25%, transparent 75%, #eef0f5 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  place-items: center;
  min-height: 240px;
}
.preview-wrap canvas { max-width: 100%; max-height: 420px; box-shadow: 0 6px 20px rgba(16, 24, 40, .12); background: #fff; }

.result-list { list-style: none; margin: 14px 0 0; padding: 0; }
.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.result-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-item .size { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.result-item .save { color: var(--green); font-weight: 600; white-space: nowrap; }

.status { margin-top: 12px; font-size: 13.5px; color: var(--muted); min-height: 22px; }
.status.error { color: var(--red); }
.status.ok { color: var(--green); }

.note {
  margin-top: 18px;
  padding: 12px 14px;
  background: #f8f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
}
.note strong { color: #374151; }

.file-list { list-style: none; margin: 14px 0 0; padding: 0; }
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.file-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .ops { display: flex; gap: 6px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: #4b5563;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 22px 20px 40px;
  color: #9aa1ae;
  font-size: 12.5px;
  text-align: center;
}
.site-footer a { color: #7c8496; }

.kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  font-size: 12px;
}
