:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --text: #1e293b;
  --text-muted: #64748b;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-hover: 0 8px 24px rgba(79, 70, 229, .12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: var(--text); }
.logo:hover { color: var(--text); }
.site-nav { display: flex; gap: 24px; }
.site-nav a { color: var(--text-muted); font-size: 15px; }
.site-nav a:hover { color: var(--primary); }

/* ===== Hero ===== */
.hero { text-align: center; padding: 64px 20px 40px; }
.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.3;
  background: linear-gradient(120deg, #4f46e5, #7c3aed, #2563eb);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}
.hero p { color: var(--text-muted); max-width: 640px; margin: 0 auto 28px; }
.hero-search { max-width: 480px; margin: 0 auto; position: relative; }
.hero-search input {
  width: 100%; padding: 14px 20px 14px 48px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 15px; background: var(--card);
  box-shadow: var(--shadow); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.hero-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.hero-search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* ===== Sections / cards ===== */
.tool-section { padding: 32px 0 8px; scroll-margin-top: 80px; }
.tool-section h2 {
  font-size: 22px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.tool-section h2::before {
  content: ""; width: 4px; height: 22px;
  background: var(--primary); border-radius: 2px;
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.tool-card {
  display: flex; gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  color: var(--text);
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); color: var(--text); }
.tool-icon {
  flex: none; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
  border-radius: 10px;
}
.tool-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-card h3 { font-size: 16px; margin-bottom: 4px; }
.tool-card p { font-size: 13px; color: var(--text-muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== SEO content ===== */
.seo-content { padding: 48px 0 24px; }
.seo-content h2 { font-size: 22px; margin-bottom: 16px; }
.seo-content h3 { font-size: 17px; margin: 24px 0 8px; }
.seo-content p { color: var(--text-muted); margin-bottom: 12px; font-size: 15px; }
.faq details { background: var(--card); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 14px 18px; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.faq details p { margin-top: 10px; }

/* ===== Tool page ===== */
.breadcrumb { font-size: 13px; color: var(--text-muted); padding: 16px 0 0; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.tool-page { padding: 24px 0 48px; }
.tool-head h1 { font-size: 28px; margin-bottom: 8px; }
.tool-head p { color: var(--text-muted); margin-bottom: 20px; }
.tool-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.tool-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.tool-row label { font-size: 14px; color: var(--text-muted); min-width: 72px; }
input[type="text"], input[type="number"], input[type="date"], input[type="color"], select, textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
textarea { width: 100%; min-height: 140px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px;
  font-size: 15px; cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.97); }
.btn.secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #e2e8f0; }
.result-box {
  margin-top: 16px; padding: 14px 18px;
  background: #f8fafc; border: 1px dashed var(--border);
  border-radius: 8px; font-size: 15px;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.result-box:empty { display: none; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.stat-card { background: var(--primary-light); border-radius: 10px; padding: 14px 16px; text-align: center; }
.stat-card .num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 13px; color: var(--text-muted); }

/* ===== Calculator ===== */
.calc-display {
  width: 100%; padding: 16px;
  font-size: 28px; text-align: right;
  border: 1px solid var(--border); border-radius: 10px;
  background: #f8fafc; margin-bottom: 12px;
  font-family: ui-monospace, Consolas, monospace;
  min-height: 64px; word-break: break-all;
}
.calc-history { text-align: right; color: var(--text-muted); font-size: 13px; min-height: 20px; margin-bottom: 8px; font-family: ui-monospace, Consolas, monospace; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-keys button {
  padding: 16px 0; font-size: 18px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; cursor: pointer; transition: background .15s;
}
.calc-keys button:hover { background: #f1f5f9; }
.calc-keys button.op { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.calc-keys button.eq { background: var(--primary); color: #fff; grid-column: span 2; font-weight: 600; }
.calc-keys button.eq:hover { background: var(--primary-dark); }

/* ===== QR ===== */
.qr-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 16px; }
.qr-preview img, .qr-preview canvas, .qr-preview table { border: 8px solid #fff; box-shadow: var(--shadow); border-radius: 8px; }

/* ===== Color ===== */
.color-swatch { width: 100%; height: 90px; border-radius: 10px; border: 1px solid var(--border); margin-top: 16px; }

/* ===== Ad placeholder ===== */
.ad-slot { margin: 32px auto; max-width: 728px; min-height: 90px; }
.ad-slot .ad-tip { display: flex; align-items: center; justify-content: center; height: 90px; border: 1px dashed var(--border); border-radius: 10px; color: var(--text-muted); font-size: 13px; background: #fff; }

/* ===== Footer ===== */
.site-footer { margin-top: 48px; background: #0f172a; color: #94a3b8; padding: 36px 0 28px; text-align: center; font-size: 14px; }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 14px; flex-wrap: wrap; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-copy, .footer-icp { margin-top: 6px; }

/* ===== Article ===== */
.post-date { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.seo-content table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 14px; }
.seo-content th, .seo-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.seo-content th { background: var(--primary-light); font-weight: 600; }
.seo-content tr:nth-child(even) td { background: #fafbfd; }
.seo-content ul, .seo-content ol { margin: 0 0 12px 24px; color: var(--text-muted); font-size: 15px; }
.seo-content li { margin-bottom: 6px; }
.seo-content code {
  background: #eef2ff; color: #4338ca;
  padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
}
.seo-content pre {
  background: #0f172a; color: #e2e8f0;
  padding: 14px 16px; border-radius: 10px;
  overflow-x: auto; margin-bottom: 16px;
  font-size: 13px; line-height: 1.6;
}
.seo-content pre code { background: none; color: inherit; padding: 0; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .site-nav { gap: 14px; font-size: 14px; }
  .site-nav a:nth-child(2), .site-nav a:nth-child(3), .site-nav a:nth-child(4) { display: none; }
  .hero { padding: 40px 20px 28px; }
  .tool-panel { padding: 18px; }
  .tool-grid { grid-template-columns: 1fr; }
}
