:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --card-2: #fafbfc;
  --text: #14161a;
  --text-2: #4b5563;
  --muted: #8b95a3;
  --line: #e7eaee;
  --brand: #fe2c55;
  --brand-2: #25f4ee;
  --up: #e5484d;
  --down: #17a673;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }

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

a { color: inherit; }

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.2px;
}

.logo-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand) 0%, #ff6b3d 55%, var(--brand-2) 130%);
  display: grid; place-items: center;
  color: #fff; font-size: 16px;
}

.logo small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0;
}

.status {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-2);
  flex-wrap: wrap;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--down);
  box-shadow: 0 0 0 3px rgba(23, 166, 115, 0.14);
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.off { background: var(--muted); box-shadow: 0 0 0 3px rgba(139,149,163,.14); }
.dot.busy { background: #f5a524; box-shadow: 0 0 0 3px rgba(245,165,36,.16); }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  transition: all .16s ease;
  font-family: inherit;
}
.btn:hover { border-color: #d3d8de; background: var(--card-2); }
.btn.primary {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.btn.primary:hover { background: #2a2f37; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 搜索区 ---------- */
.search-panel {
  padding: 26px 0 18px;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: -0.4px;
}

.hero p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 320px;
  min-width: 260px;
}

.search-box input {
  width: 100%;
  padding: 11px 40px 11px 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.search-box input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.12);
}
.search-box .icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 14px;
}
.search-box .clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 15px; display: none; padding: 2px 6px;
}
.search-box.has-value .clear { display: block; }

select.sort {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: #d3d8de; }
.chip.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

/* ---------- 概览卡片 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0 20px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 23px; font-weight: 700; margin-top: 4px; letter-spacing: -0.5px; }
.stat .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stat .v em { font-style: normal; font-size: 13px; color: var(--text-2); font-weight: 500; }

/* ---------- 布局 ---------- */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 980px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 15px; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-left: auto; }
.card-body { padding: 14px 16px; }

/* ---------- 排行榜 ---------- */
.rank-list { list-style: none; margin: 0; padding: 0; }

.rank-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 132px 122px;
  gap: 12px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid #f1f3f5;
  transition: background .12s;
}
.rank-item:last-child { border-bottom: none; }
.rank-item:hover { background: #fbfcfd; }
.rank-item.is-news { background: linear-gradient(90deg, rgba(254,44,85,.05), transparent 60%); }

.rk {
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.rk.top1 { color: #f5a524; }
.rk.top2 { color: #8b95a3; }
.rk.top3 { color: #c08457; }

.kw { min-width: 0; }
.kw-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: inline;
  border-bottom: 1px solid transparent;
}
.kw-title:hover { color: var(--brand); border-bottom-color: var(--brand); }
.kw-meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 17px;
}
.tag.new { background: rgba(23,166,115,.12); color: var(--down); }
.tag.hot { background: rgba(254,44,85,.12); color: var(--brand); }
.tag.boom { background: rgba(245,165,36,.16); color: #b45309; }
.tag.rec { background: rgba(37,244,238,.18); color: #0891b2; }
.tag.first { background: rgba(99,102,241,.12); color: #6366f1; }
.tag.news { background: #111827; color: #fff; }

.hot-bar { display: flex; align-items: center; gap: 8px; }
.hot-track { flex: 1; height: 6px; border-radius: 99px; background: #f0f2f5; overflow: hidden; }
.hot-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.hot-num { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 52px; text-align: right; }

.delta { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta .up { color: var(--up); }
.delta .down { color: var(--down); }
.delta .flat { color: var(--muted); }
.delta small { display: block; font-size: 10.5px; color: var(--muted); }

.trend-btn { white-space: nowrap; flex: none; }

.spark { height: 30px; width: 100%; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th {
  text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 500;
  padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.mini-table td { padding: 7px 8px; border-bottom: 1px solid #f4f5f7; }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table a { color: var(--text); text-decoration: none; }
.mini-table a:hover { color: var(--brand); }

.bar-list { list-style: none; margin: 0; padding: 0; }
.bar-row { display: grid; grid-template-columns: 116px minmax(0,1fr) 58px; gap: 10px; align-items: center; padding: 6px 0; }
.bar-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: #f0f2f5; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #7c5cff, var(--brand)); }
.bar-val { font-size: 11.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.empty { padding: 46px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }
.skeleton { padding: 14px 16px; }
.skeleton .line {
  height: 13px; border-radius: 6px; margin: 12px 0;
  background: linear-gradient(90deg, #eef0f3 25%, #f6f7f9 37%, #eef0f3 63%);
  background-size: 400% 100%;
  animation: sk 1.3s ease infinite;
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.err-banner {
  background: #fff5f5; border: 1px solid #ffd7d9; color: #b42318;
  padding: 11px 14px; border-radius: 11px; font-size: 13px; margin-bottom: 14px;
}

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.footer a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted #c8ced6; }
.footer a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.footer .sp { margin-left: auto; }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: #14161a; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


.modal-mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.42);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 22px; width: min(520px, 100%);
  box-shadow: 0 20px 60px rgba(16,24,40,.22);
}
.modal h3 { margin: 0 0 6px; font-size: 16px; }
.modal p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.modal input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  font-family: inherit; font-size: 14px; outline: none;
}
.modal input:focus { border-color: var(--brand); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
