/* 关键词指数查询工具 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f6f7f8;
  --card: #ffffff;
  --line: #e2e8f0;
  --text: #334155;
  --text2: #64748b;
  --blue: #3b82f6;
  --blue-hover: #2563eb;
  --blue-bg: #eff6ff;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  --green: #10b981;
  --teal: #14b8a6;
  --orange: #f59e0b;
  --red: #ef4444;
  --gray: #94a3b8;
}

html, body { height: 100%; }

body {
  font-family: -apple-system,SF UI Text,Arial,PingFang SC,Hiragino Sans GB,Microsoft YaHei,WenQuanYi Micro Hei,sans-serif,SimHei,SimSun;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; }

.container { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 20px; }

/* ---------- 白色卡片面板 ---------- */
.panel {
  background: #fff;
  box-shadow: var(--shadow);
  padding: 60px 50px;
  text-align: center;
}
/* 结果页面板：与首页面板同宽（700px 居中） */
.result-panel {
  text-align: left;
  padding: 36px 40px;
  max-width: 700px;
  margin: 0 auto;
}

/* ---------- 渐变分隔线 ---------- */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  margin: 30px 0;
}

/* ---------- 首页 ---------- */
main.home { flex: 1; display: flex; align-items: flex-start; }
.home .container { /*padding-top: 60px; padding-bottom: 60px;*/ }
/* 首页含关键词列表，面板比结果页略宽 */
.home-panel { max-width: 820px; margin: 0 auto; }
.panel h1 { font-size: 34px; font-weight: 700; letter-spacing: 1px; }
.sub { color: var(--text2); margin-top: 12px; font-size: 14px; }
/* 结果页品牌区（与首页标题一致，div 版避免双 h1） */
.result-brand { text-align: center; margin-bottom: 30px; }
.result-brand div { font-size: 30px; font-weight: 700; letter-spacing: 1px; }

.result-panel .search {max-width: 100%;}
.search {
  margin: 40px auto 0;
  max-width: 560px;
  display: flex;
  background: #fff;
}
/* 格式错误红色提示（输入错误就地提示，不跳 404 页） */
.form-error {
  margin: 14px auto 0;
  max-width: 560px;
  padding: 10px 14px;
  border: 1px solid #f3c1c1;
  border-radius: 6px;
  background: #fdf1f1;
  color: #d93025;
  font-size: 13px;
  line-height: 1.7;
  text-align: left;
  word-break: break-all;
}
.search:focus-within { border-color: var(--blue); }
.search input {
  flex: 1; min-width: 0; height: 52px; padding: 0 18px;
  border: 0; outline: 0; font-size: 15px; color: var(--text); background: #F5F6F7;
}
.search input::placeholder { color: #94a3b8; }
.search button {
  width: 120px; border: 0; background: var(--blue); color: #fff;
  font-size: 16px; letter-spacing: 4px; cursor: pointer;
  transition: background .3s;
}
.search button:hover { background: var(--blue-hover); }
.search button:disabled { background: #93c5fd; cursor: wait; }

.hint { color: var(--text2); font-size: 14px; line-height: 1.8; }
.hint a {
  display: inline-block;
  border: 1px solid var(--line);
  background: #fff; color: var(--text2);
  font-size: 13px; padding: 6px 18px;
  border-radius: 0px; text-decoration: none;
  transition: color .15s, border-color .15s;
}
.hint a:hover { color: var(--blue); border-color: var(--blue); }

/* ---------- 首页关键词列表 ---------- */
.kw-list { margin-top: 36px; text-align: left; }
.list-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); }
.list-tabs a {
  display: inline-block; padding: 8px 20px; font-size: 14px; color: var(--text2);
  border-bottom: 1px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.list-tabs a:hover { color: var(--blue); }
.list-tabs a.on { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

.kw-table {
  width: 100%; border-collapse: collapse; margin-top: 14px;
  background: #fff; font-size: 12px;border: 1px solid var(--line);
}
.kw-table thead th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text2);
  background: #f8fafc; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.kw-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  color: var(--text); word-break: break-all;
}
.kw-table tbody tr:hover td { background: #f8fafc; }
.kw-table .c-kw a { color: var(--text); }
.kw-table .c-kw a:hover { color: var(--blue); }
.kw-table .c-vol { white-space: nowrap; }
.kw-table .c-lt, .kw-table .c-comp { white-space: nowrap; }
.kw-table .c-diff { white-space: nowrap; }
.kw-empty { text-align: center; color: #a8b3bf; padding: 30px 0 !important; }

/* ---------- 分页器 ---------- */
.pager { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.pager-btn, .pager-num, .pager-cur {
  display: inline-block; min-width: 32px; padding: 5px 10px; text-align: center;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  font-size: 13px; line-height: 1.4;
  transition: color .15s, border-color .15s;
}
.pager-btn:hover, .pager-num:hover { color: var(--blue); border-color: var(--blue); }
.pager-cur { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- 徽章（指数等级/优化难度） ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.6; white-space: nowrap;
}
.badge-green { color: #047857; background: #d1fae5; }
.badge-teal  { color: #0f766e; background: #ccfbf1; }
.badge-blue  { color: #1d4ed8; background: #dbeafe; }
.badge-orange{ color: #b45309; background: #fef3c7; }
.badge-red   { color: #b91c1c; background: #fee2e2; }
.badge-gray  { color: #475569; background: #f1f5f9; }

/* ---------- 近期查询模块 ---------- */
.recent { margin-top: 34px; }
.recent h2 { font-size: 14px; font-weight: 500; color: var(--text); }
.recent-list {
  margin-top: 12px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.recent-list a {
  font-size: 12px; color: #9fa8b5;
  background: #fff; padding: 0px 3px;
  text-decoration: none;
}
.recent-list a:hover { color: var(--blue); }
/* 结果页近期查询：链接两端对齐填满整行，消除每行右侧留白 */
.result-panel .recent-list { justify-content: space-between; }
.result-panel .recent { margin-top: 26px; }

/* ---------- 结果页 ---------- */
main.result { flex: 1; display: flex; flex-direction: column; padding: 36px 0 48px; }
/* 白色面板与首页一致垂直居中；内容超过视口高度时自动回退为顶部排列 */
main.result .container { margin: auto; }

/* 结果页面板内查询框 */
.search-in { margin: 0 auto; }
.result-panel .divider { margin: 24px 0; }

.ip-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ip-line h1 {
  font-size: 24px; font-weight: 500; letter-spacing: .5px;
  word-break: break-all;
}
.copy-btn {
  border: 1px solid var(--line);
  background: #fff; color: var(--text2);
  font-size: 12px; padding: 3px 10px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy-btn:hover { color: var(--blue); border-color: var(--blue); }
.ver {
  font-size: 12px; color: var(--blue); background: var(--blue-bg);
  padding: 3px 8px; font-weight: 500;
}
.meta { margin-top: 12px; color: var(--text2); font-size: 12px; line-height: 1.6; }

/* ---------- 三大核心指标卡 ---------- */
.stat-cards {
  display: flex; gap: 12px; margin-top: 18px;
}
.stat-card {
  flex: 1; border: 1px solid var(--line); background: #f8fafc;
  padding: 14px 10px; text-align: center;
}
.stat-card b {
  display: block; font-size: 22px; font-weight: 700; color: var(--blue);
  word-break: break-all;
}
.stat-card span { display: block; font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ---------- 进度条 ---------- */
.bar {
  display: inline-block; vertical-align: middle;
  width: 90px; height: 6px; background: #eef2f7; border-radius: 999px;
  overflow: hidden; margin-right: 8px;
}
.bar-fill { display: block; height: 100%; border-radius: 999px; }
.bar-green { background: var(--green); }
.bar-teal  { background: var(--teal); }
.bar-blue  { background: var(--blue); }
.bar-orange{ background: var(--orange); }
.bar-red   { background: var(--red); }
.bar-num { font-size: 12px; color: var(--text2); margin-right: 8px; }

/* ---------- 结果表格（紧凑单表直下） ---------- */
.kv-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--line);
  margin-top: 18px;
}
.kv-table th {
  width: 32%; text-align: left; font-weight: 400; font-size: 12px;
  color: var(--text2); background: #f8fafc;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.kv-table td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12px; line-height: 1.6; word-break: break-all;
}
.kv-table tr:last-child th, .kv-table tr:last-child td { border-bottom: 0; }
.kv-table tr:hover td { background: #f8fafc; }
.kv-table .empty { color: #cbd5e1; }

/* ---------- 搜索引擎查询按钮（结果页） ---------- */
.eng-btn {
  display: inline-block;
  padding: 3px 14px;
  margin: 2px 8px 2px 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  line-height: 1.8;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.eng-btn:hover { color: var(--blue); border-color: var(--blue); }

/* ---------- 数据来源注脚 ---------- */
.src-note { margin-top: 18px; font-size: 12px; color: #a8b3bf; text-align: center; }
.src-note a { color: #94a3b8; }
.src-note a:hover { color: var(--blue); }

/* ---------- 错误页 ---------- */
main.error { flex: 1; display: flex; align-items: center; }
.error .container { padding-top: 60px; padding-bottom: 60px; }
.error-panel { max-width: 700px; margin: 0 auto; }
.error-code {
  font-size: 100px; font-weight: 700; color: var(--blue); margin: 20px 0;
  line-height: 1;
}
.error-message { font-size: 24px; color: var(--text); margin-bottom: 30px; }
.btn-primary {
  display: inline-block; background: var(--blue); color: #fff;
  font-size: 18px; padding: 16px 48px;
  margin: 20px 0; transition: background .3s;
}
.btn-primary:hover { background: var(--blue-hover); }
.intro-text { font-size: 16px; color: var(--text2); line-height: 1.8; }
.intro-text a { color: var(--blue); }
.intro-text a:hover { color: var(--blue-hover); }

/* ---------- 页脚 ---------- */
.footer { flex: none; padding: 20px 0; }
.footer p { color: var(--text2); font-size: 12px; text-align: center;line-height:2; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .panel { padding: 40px 28px; }
  .result-panel { padding: 26px 20px; }
  .error-code { font-size: 80px; }
  .error-message { font-size: 20px; }
  .btn-primary { padding: 14px 40px; }
  .friend-links { display: none; }
  .kw-table thead th, .kw-table tbody td { padding: 8px 8px; }
  /* 移动端表格：隐藏扩展指标列，压缩宽度 */
  .c-lt { display: none; }
}
@media (max-width: 480px) {
  .container { padding: 0 12px; }
  .panel { padding: 28px 16px; }
  .panel h1 { font-size: 24px; }
  .result-brand div { font-size: 22px; }
  .result-panel { padding: 20px 14px; }
  .error-code { font-size: 60px; }
  .btn-primary { padding: 12px 35px; }
  /* 搜索框移动端保持横排：输入框自适应 + 按钮定宽，与输入框同高不显矮 */
  .search { flex-direction: row; }
  .search input { height: 46px; font-size: 14px; padding: 0 14px; }
  .search button { width: 92px; height: 46px; font-size: 15px; letter-spacing: 2px; }
  .home .container, .error .container { padding-top: 30px; padding-bottom: 30px; }
  main.result { padding: 20px 0 30px; }
  .ip-line { gap: 8px; }
  .ip-line h1 { font-size: 18px; }
  .kv-table th { width: 42%; padding: 8px 10px; }
  .kv-table td { padding: 8px 10px; }
  .bar { width: 60px; }
  .stat-card b { font-size: 18px; }
  .stat-cards { gap: 8px; }
  /* 移动端表格：隐藏优化难度列 */
  .c-diff { display: none; }
}

/* 友情链接 */
.friend-links { margin-top: 34px; }
.friend-links p:first-child { font-size: 14px; font-weight: 500; color: var(--text); }
.friend-links p:last-child {
  margin-top: 12px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.friend-links a {
  font-size: 12px; color: #9fa8b5;
  background: #fff; padding: 0px 3px;
  text-decoration: none;
}
.friend-links a:hover { color: var(--blue); border-color: var(--blue); }
