:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --cyan: #06b6d4;
  --amber: #f59e0b;
  --pink: #ec4899;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --text: #0f172a;
  --text-soft: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --maxw: 1100px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-img {
  height: 32px; width: auto; display: block;
  transition: opacity .2s, transform .2s;
}
.brand:hover .brand-img { opacity: .85; transform: translateY(-1px); }
.nav-links { display: flex; gap: 26px; font-size: 15px; }
.nav-links a { color: var(--text-soft); transition: color .2s; }
.nav-links a:hover { color: var(--primary); }
.nav-toggle {
  display: none; background: none; border: none; font-size: 22px;
  cursor: pointer; color: var(--text);
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 96px 0 80px; }
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(60% 60% at 15% 10%, rgba(79, 70, 229, 0.12), transparent 60%),
    radial-gradient(50% 50% at 90% 20%, rgba(6, 182, 212, 0.12), transparent 60%),
    linear-gradient(180deg, #fafaff, #ffffff);
}
.hero-inner { position: relative; z-index: 1; text-align: center; }
.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 13px; font-weight: 600; margin-bottom: 22px;
}
.hero h1 { font-size: 44px; line-height: 1.2; letter-spacing: -0.5px; }
.hero-sub {
  max-width: 620px; margin: 20px auto 0; color: var(--text-soft); font-size: 17px;
}
.hero-actions { margin-top: 30px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 12px 26px; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: transform .15s, box-shadow .2s;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.hero-stats {
  margin-top: 48px; display: flex; gap: 40px; justify-content: center; flex-wrap: wrap;
}
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 26px; color: var(--primary); }
.hero-stats span { font-size: 13px; color: var(--text-soft); }

/* ---------- 通用 section ---------- */
.section { padding: 72px 0; }
.section-soft { background: var(--bg-soft); }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head h2 { font-size: 30px; letter-spacing: -0.3px; }
.section-head p { color: var(--text-soft); margin-top: 10px; font-size: 16px; }
.section-head strong { color: var(--primary); }

/* ---------- 文本分析 ---------- */
.analyzer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.analyzer-input label, .keywords h3, .panel h3 { font-weight: 700; }
.analyzer-input label { display: block; margin-bottom: 10px; font-size: 15px; }
#inputText {
  width: 100%; min-height: 320px; resize: vertical; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 15px; line-height: 1.7; font-family: inherit; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#inputText:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.privacy-note { margin-top: 12px; font-size: 13px; color: var(--text-soft); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 12px; text-align: center; box-shadow: var(--shadow-sm);
}
.stat-value { display: block; font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { display: block; font-size: 12px; color: var(--text-soft); margin-top: 4px; }
.badge-read { font-size: 18px; }

.keywords { margin-top: 22px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.keywords h3 { font-size: 16px; margin-bottom: 12px; }
.kw-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.kw-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.kw-empty { color: var(--text-soft); }
.kw-word { width: 90px; font-weight: 600; }
.kw-bar { flex: 1; height: 8px; background: var(--primary-light); border-radius: 999px; overflow: hidden; }
.kw-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan)); border-radius: 999px; }
.kw-count { width: 36px; text-align: right; color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* ---------- 数据看板 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.kpi-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 18px; text-align: center; box-shadow: var(--shadow-sm); position: relative;
}
.kpi-value { font-size: 34px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.kpi-suffix { font-size: 22px; font-weight: 800; color: var(--primary); margin-left: -4px; }
.kpi-label { display: block; margin-top: 6px; color: var(--text-soft); font-size: 14px; }

.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; margin-bottom: 22px; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.panel h3 { font-size: 16px; margin-bottom: 18px; }

.bars { height: 220px; display: flex; align-items: flex-end; gap: 14px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 8px; }
.bar { width: 70%; height: 0; background: linear-gradient(180deg, var(--primary), var(--cyan)); border-radius: 8px 8px 0 0; transition: height .9s cubic-bezier(.2,.8,.2,1); }
.bar-label { font-size: 12px; color: var(--text-soft); }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
#donut { flex-shrink: 0; }
.legend { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend .dot { width: 12px; height: 12px; border-radius: 4px; }
.legend .lg-val { margin-left: auto; color: var(--text-soft); font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-soft); font-weight: 600; background: var(--bg-soft); }
.data-table tr:last-child td { border-bottom: none; }

/* ---------- 关于我们 ---------- */
.about-logo { width: 140px; height: auto; display: block; margin: 0 auto 18px; }
.about-text { max-width: 760px; margin: 0 auto 40px; color: var(--text-soft); font-size: 16px; text-align: center; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 22px; box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s; }
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-icon { font-size: 30px; margin-bottom: 12px; }
.feature-card h3 { font-size: 17px; margin-bottom: 8px; }
.feature-card p { color: var(--text-soft); font-size: 14px; }

/* ---------- 联系我们 ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.contact-item { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 6px; }
.ci-label { font-size: 13px; color: var(--text-soft); }
.ci-value { font-size: 16px; font-weight: 600; }

/* ---------- 页脚 ---------- */
.footer { background: #0f172a; color: #cbd5e1; padding: 26px 0; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.footer-note { color: #94a3b8; }
.beian-link { color: #94a3b8; text-decoration: underline; text-underline-offset: 3px; transition: color .2s; }
.beian-link:hover { color: #c7d2fe; }

/* ---------- 工具箱 ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.tab {
  padding: 10px 18px; border: 1px solid var(--border); background: #fff;
  border-radius: 999px; font-size: 14px; cursor: pointer; color: var(--text-soft);
  transition: all .2s;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tool-area {
  width: 100%; min-height: 200px; resize: vertical; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6; outline: none; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.tool-area:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.tool-input {
  width: 100%; padding: 11px 14px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 10px; font-size: 14px;
  outline: none; background: #fff;
}
.tool-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.field-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }

.tool-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.tool-msg { font-size: 13px; }
.tool-msg.ok { color: #16a34a; }
.tool-msg.err { color: #dc2626; }

.code-out {
  background: #0f172a; color: #e2e8f0; border-radius: var(--radius);
  padding: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-break: break-all;
  min-height: 60px; max-height: 420px; overflow: auto;
}

.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.diff-grid .tool-area { min-height: 180px; }
.diff-out { display: flex; flex-direction: column; gap: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.diff-line { padding: 6px 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; }
.diff-line.added { background: #ecfdf5; color: #065f46; border-left: 3px solid #10b981; }
.diff-line.removed { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; }
.diff-line.changed { background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; }
.diff-line.same { color: var(--text-soft); }
.diff-path { font-weight: 700; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .nav-links { position: absolute; top: 100%; left: 0; right: 0; background: #fff; flex-direction: column; gap: 0; padding: 8px 20px 16px; border-bottom: 1px solid var(--border); display: none; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: block; }
  .hero h1 { font-size: 32px; }
  .analyzer-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .diff-grid { grid-template-columns: 1fr; }
}
