/* ============ 变量与主题 ============ */
:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1c2130;
  --muted: #667085;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef0ff;
  --danger: #dc2626;
  --border: #e6e8ef;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 24px rgba(16, 24, 40, .06);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, .06), 0 12px 32px rgba(16, 24, 40, .10);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0e1016;
  --card: #171a24;
  --text: #e7eaf2;
  --muted: #98a0b3;
  --brand: #7c86ff;
  --brand-2: #a78bfa;
  --brand-soft: #232748;
  --danger: #f87171;
  --border: #262b3a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .35);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .5);
}

/* ============ 基础 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ============ 顶栏 ============ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; }
.brand:hover { text-decoration: none; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  color: var(--muted); font-size: 14px; padding: 6px 12px; border-radius: 8px;
}
.site-nav a:hover { color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  transition: transform .15s;
}
.icon-btn:hover { transform: scale(1.06); }
[data-theme="light"] .icon-moon, [data-theme="dark"] .icon-sun { display: none; }

/* ============ 工具区 ============ */
.tool-section { padding: 40px 0 16px; }
.tool-section h1 {
  font-size: clamp(26px, 4.5vw, 38px);
  line-height: 1.3; letter-spacing: .5px;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle { color: var(--muted); margin: 10px 0 28px; font-size: 15px; max-width: 760px; }

.tool-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.text-input {
  width: 100%; min-height: 220px; resize: vertical;
  padding: 16px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--bg); color: var(--text);
  font: 15px/1.8 var(--font);
  transition: border-color .2s, box-shadow .2s;
}
.text-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.text-input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 18px; }
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.process-group { margin-left: auto; }
.process-label { font-size: 13px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  transition: transform .12s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); background: var(--brand-soft); border-color: var(--brand); }
.btn:active { transform: translateY(0); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); font-size: 13px; padding: 6px 10px; }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); border-color: transparent; box-shadow: none; }

/* ============ 统计卡片 ============ */
.stats-grid { display: grid; gap: 12px; }
.core-stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
.extra-stats { grid-template-columns: repeat(4, 1fr); }
.stat-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; text-align: center; transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card.highlight {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, var(--card)), color-mix(in srgb, var(--brand-2) 10%, var(--card)));
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}
.stat-num {
  font-size: clamp(22px, 3vw, 30px); font-weight: 800; line-height: 1.2;
  font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
.highlight .stat-num { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat-hint { font-size: 11px; color: color-mix(in srgb, var(--muted) 80%, transparent); font-weight: 400; }

/* ============ 词频 / 阅读时间 ============ */
.insight-grid { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 12px; margin-top: 12px; }
.insight-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
}
.insight-title { font-size: 15px; margin-bottom: 12px; font-weight: 700; }
.freq-list { list-style: none; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.freq-item { }
.freq-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.freq-key { font-weight: 600; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.freq-count { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.freq-bar { height: 5px; border-radius: 4px; background: color-mix(in srgb, var(--border) 70%, transparent); overflow: hidden; }
.freq-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.empty-hint { color: var(--muted); font-size: 13px; }

.read-time { margin-bottom: 14px; }
.rt-main { font-size: clamp(30px, 4vw, 42px); font-weight: 800; display: flex; align-items: baseline; gap: 6px; }
.rt-main span:first-child { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rt-unit { font-size: 16px; color: var(--muted); font-weight: 600; }
.rt-detail { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px dashed var(--border); padding-top: 14px; }

/* ============ 内容区块 ============ */
.content-section { padding: 44px 0; }
.content-section.alt { background: color-mix(in srgb, var(--brand) 3%, var(--bg)); }
.content-section h2 {
  font-size: clamp(20px, 3vw, 27px); margin-bottom: 8px; letter-spacing: .3px;
}
.section-lead { color: var(--muted); margin-bottom: 22px; max-width: 760px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.feature-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.feature-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.feature-item h3 { font-size: 15.5px; margin-bottom: 6px; color: var(--brand); }
.feature-item p { font-size: 13.5px; color: var(--muted); }

.ref-box { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 10px; padding: 18px 20px; }
.ref-box h3 { font-size: 15px; margin-bottom: 8px; }
.ref-box ul { padding-left: 20px; color: var(--muted); font-size: 13.5px; }
.ref-box li { margin: 5px 0; }

.steps { counter-reset: step; list-style: none; display: grid; gap: 12px; margin-bottom: 18px; }
.steps li {
  position: relative; padding: 14px 18px 14px 58px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; font-size: 14.5px;
}
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  font-weight: 700; font-size: 14px;
}
.tip { background: var(--brand-soft); border-radius: 10px; padding: 12px 16px; font-size: 13.5px; color: var(--text); }

.usage-list { padding-left: 20px; margin: 14px 0; display: grid; gap: 8px; color: var(--muted); font-size: 14.5px; }

.faq-list { display: grid; gap: 10px; }
.faq-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden;
}
.faq-item summary {
  padding: 14px 18px; font-weight: 600; font-size: 15px; cursor: pointer;
  list-style: none; display: flex; align-items: center; gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; margin-left: auto; font-size: 20px; color: var(--brand); font-weight: 400;
  transition: transform .2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 18px 14px; color: var(--muted); font-size: 14px; }

/* ============ 页脚 ============ */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; text-align: center; color: var(--muted); font-size: 13px; }
.footer-note { margin-top: 4px; font-size: 12px; opacity: .8; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg);
  padding: 10px 20px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  box-shadow: var(--shadow-hover); z-index: 100; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .insight-grid { grid-template-columns: 1fr; }
  .process-group { margin-left: 0; }
}
@media (max-width: 640px) {
  .core-stats { grid-template-columns: repeat(2, 1fr); }
  .extra-stats { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: 1fr; }
  .site-nav a { padding: 6px 8px; }
  .toolbar-group, .toolbar { width: 100%; }
  .tool-section { padding: 24px 0 8px; }
}
