/* ============================================================
   长尾词挖掘工具 — 样式
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --bg-grad-1: #eef2ff;
  --bg-grad-2: #f7f4ff;
  --panel: #ffffff;
  --panel-2: #fafbfe;
  --panel-3: #f1f3f9;
  --border: #e5e8f0;
  --border-strong: #d3d8e6;
  --text: #0e1526;
  --text-2: #5a6478;
  --text-3: #8d95a8;

  --brand: #4f6ef7;
  --brand-dark: #3d5ae0;
  --brand-soft: #eef1fe;
  --brand-2: #8b5cf6;

  --c-info: #4f6ef7;
  --c-comm: #f59e0b;
  --c-trans: #e5484d;
  --c-nav: #8b5cf6;

  --green: #0ea472;
  --green-soft: #e6f7f1;
  --amber: #d97706;
  --amber-soft: #fef4e6;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .05), 0 10px 28px -14px rgba(16, 24, 40, .16);
  --shadow-lg: 0 2px 6px rgba(16, 24, 40, .05), 0 24px 48px -20px rgba(16, 24, 40, .22);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

[data-theme="dark"] {
  --bg: #0b0f18;
  --bg-grad-1: #0e1526;
  --bg-grad-2: #141025;
  --panel: #131926;
  --panel-2: #171e2d;
  --panel-3: #1c2434;
  --border: #232c3d;
  --border-strong: #2f3a4f;
  --text: #e9edf6;
  --text-2: #9aa5bb;
  --text-3: #6c778d;

  --brand: #6b86ff;
  --brand-dark: #7d95ff;
  --brand-soft: #1b2440;

  --c-info: #6b86ff;
  --c-comm: #fbbf24;
  --c-trans: #f87171;
  --c-nav: #a78bfa;

  --green: #34d399;
  --green-soft: #10261f;
  --amber: #fbbf24;
  --amber-soft: #2a2011;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, .35), 0 28px 56px -24px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 必须放在所有 display 规则之前也能生效：强制 hidden 优先 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background:
    radial-gradient(1100px 460px at 12% -6%, var(--bg-grad-1) 0%, transparent 62%),
    radial-gradient(900px 420px at 92% -12%, var(--bg-grad-2) 0%, transparent 58%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: rgba(79, 110, 247, .22); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

.app {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px 56px;
}

/* ============================================================
   顶栏
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 20px;
}

.brand { display: flex; align-items: center; gap: 13px; }

.logo {
  width: 42px; height: 42px;
  border-radius: 13px;
  background: linear-gradient(140deg, #5a78ff 0%, #7c5cf7 100%);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(79, 110, 247, .65), inset 0 1px 0 rgba(255,255,255,.25);
}
.logo svg { width: 22px; height: 22px; }

.brand-txt h1 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.2px;
  line-height: 1.25;
}
.brand-txt p {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: .1px;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.status-pill {
  display: flex; align-items: center; gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.status-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(14, 164, 114, .14);
}
.status-pill.busy .dot {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,110,247,.16);
  animation: pulse 1.3s ease-in-out infinite;
}
.status-pill.err .dot { background: var(--c-trans); box-shadow: 0 0 0 3px rgba(229,72,77,.16); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: .18s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .ico-moon { display: none; }
[data-theme="dark"] .icon-btn .ico-sun { display: none; }
[data-theme="dark"] .icon-btn .ico-moon { display: block; }

/* ============================================================
   Hero / 搜索
   ============================================================ */
.hero {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 26px 28px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #4f6ef7, #8b5cf6 45%, #ec4899 70%, #f59e0b);
  opacity: .75;
}

.hero-head h2 {
  font-size: 19px;
  font-weight: 640;
  letter-spacing: -.3px;
  margin-bottom: 5px;
}
.hero-head p {
  font-size: 13px;
  color: var(--text-3);
  max-width: 720px;
}

.search-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 16px;
  background: var(--panel-2);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  transition: .2s;
}
.search-box:focus-within {
  border-color: var(--brand);
  background: var(--panel);
  box-shadow: 0 0 0 4px rgba(79, 110, 247, .11);
}
.search-box svg { width: 19px; height: 19px; color: var(--text-3); flex: none; transition: color .2s; }
.search-box:focus-within svg { color: var(--brand); }
.search-box input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15.5px;
  font-family: inherit;
  color: var(--text);
  letter-spacing: .1px;
}
.search-box input::placeholder { color: var(--text-3); font-size: 14.5px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(140deg, #5a78ff, #6d5bf5);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: .2px;
  box-shadow: 0 8px 20px -8px rgba(79, 110, 247, .75), inset 0 1px 0 rgba(255,255,255,.22);
  transition: .18s;
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px -8px rgba(79,110,247,.8); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: .62; cursor: not-allowed; box-shadow: none; }
.btn-primary svg { width: 17px; height: 17px; }

/* 快捷词 */
.quick-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 13px;
}
.quick-label { font-size: 12.5px; color: var(--text-3); }
.chip {
  height: 27px;
  padding: 0 11px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: .16s;
}
.chip:hover {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* ---------- 设置 ---------- */
.settings { margin-top: 16px; border-top: 1px dashed var(--border); padding-top: 12px; }

.settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: color .16s;
}
.settings-toggle:hover { color: var(--brand); }
.settings-toggle svg { width: 15px; height: 15px; }
.settings-toggle .chev { width: 14px; height: 14px; transition: transform .22s; }
.settings-toggle.open .chev { transform: rotate(180deg); }

.settings-body {
  display: none;
  grid-template-columns: 1.15fr 0.8fr 1.15fr 1fr;
  gap: 20px;
  padding: 14px 2px 4px;
}
.settings-body.open { display: grid; animation: fadeDown .22s ease; }

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.set-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 9px;
}
.set-hint { font-size: 11.5px; color: var(--text-3); margin-top: 7px; line-height: 1.5; }

.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }

.tgl {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  padding: 5px 6px;
  margin: -5px -6px;
  border-radius: 8px;
  transition: background .15s;
}
.tgl:hover { background: var(--panel-3); }
.tgl input { display: none; }

.tgl-box {
  width: 15px; height: 15px;
  margin-top: 2px;
  border-radius: 4.5px;
  border: 1.5px solid var(--border-strong);
  background: var(--panel);
  flex: none;
  position: relative;
  transition: .18s;
}
.tgl input:checked + .tgl-box {
  background: var(--brand);
  border-color: var(--brand);
}
.tgl input:checked + .tgl-box::after {
  content: "";
  position: absolute;
  left: 4.2px; top: 1.4px;
  width: 4px; height: 7.5px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}
.tgl input:disabled + .tgl-box { opacity: .55; }
.tgl-txt { font-size: 12.5px; color: var(--text); line-height: 1.35; }
.tgl-txt em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}

/* 分段控件 */
.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--panel-3);
  border-radius: 9px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 5px 14px;
  border-radius: 7px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  transition: .16s;
  font-weight: 500;
}
.seg button:hover { color: var(--text); }
.seg button.on {
  background: var(--panel);
  color: var(--brand);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   进度
   ============================================================ */
.progress-card {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  animation: fadeDown .25s ease;
}
.prog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 16px;
}
.prog-label {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 550; color: var(--text);
}
.prog-counts { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.prog-counts b { color: var(--brand); font-weight: 650; font-size: 13.5px; }
.prog-counts .sep { margin: 0 4px; opacity: .5; }

.spin {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid var(--brand-soft);
  border-top-color: var(--brand);
  animation: rot .7s linear infinite;
  flex: none;
}
@keyframes rot { to { transform: rotate(360deg); } }

.prog-bar {
  height: 5px;
  background: var(--panel-3);
  border-radius: 99px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #5a78ff, #8b5cf6);
  transition: width .3s ease;
  position: relative;
}
.prog-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.prog-sub {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   统计
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
  animation: fadeDown .28s ease;
}
.stat {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 15px 17px;
  box-shadow: var(--shadow-sm);
  transition: .2s;
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow); }

.stat-ico {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex: none;
}
.stat-ico svg { width: 18px; height: 18px; }
.stat-ico.blue { background: var(--brand-soft); color: var(--brand); }
.stat-ico.violet { background: rgba(139, 92, 246, .12); color: var(--brand-2); }
.stat-ico.green { background: var(--green-soft); color: var(--green); }
.stat-ico.amber { background: var(--amber-soft); color: var(--amber); }

.stat-num {
  font-size: 23px;
  font-weight: 660;
  letter-spacing: -.8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat-lbl { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ============================================================
   卡片通用
   ============================================================ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 19px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-head h3 {
  font-size: 13.5px;
  font-weight: 620;
  letter-spacing: -.1px;
}
.card-foot {
  padding: 10px 19px 13px;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
}

/* ============================================================
   可视化
   ============================================================ */
.viz {
  display: grid;
  grid-template-columns: 1.72fr 1fr;
  gap: 12px;
  margin-top: 14px;
  animation: fadeDown .3s ease;
}
.viz-side { display: flex; flex-direction: column; gap: 12px; }

/* 让右侧第一张卡片撑满剩余高度，与左侧词云卡片底部对齐 */
.viz-side > .card:first-child { flex: 1; display: flex; flex-direction: column; }
.viz-side > .card:first-child .donut-wrap { flex: 1; height: auto; min-height: 168px; }
.viz-side > .card:first-child .donut-list { flex: none; }

.legend { display: flex; gap: 13px; flex-wrap: wrap; }
.legend span {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--text-3);
}
.legend i { width: 7px; height: 7px; border-radius: 2px; display: block; }

.cloud-wrap {
  position: relative;
  height: 388px;
  padding: 6px;
}
#cloudCanvas { width: 100%; height: 100%; display: block; cursor: default; }

.cloud-tip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  background: var(--text);
  color: var(--panel);
  font-size: 11.5px;
  padding: 5px 9px;
  border-radius: 7px;
  white-space: nowrap;
  transform: translate(-50%, -140%);
  box-shadow: var(--shadow-lg);
  font-variant-numeric: tabular-nums;
}

/* 环形图 */
.donut-wrap {
  position: relative;
  height: 168px;
  display: grid;
  place-items: center;
  padding: 12px 0 0;
}
#donutCanvas { width: 168px; height: 168px; }
.donut-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -44%);
  text-align: center;
  pointer-events: none;
}
.donut-center b {
  display: block;
  font-size: 20px;
  font-weight: 660;
  letter-spacing: -.6px;
  font-variant-numeric: tabular-nums;
}
.donut-center span { font-size: 10.5px; color: var(--text-3); }

.donut-list { padding: 4px 19px 14px; display: flex; flex-direction: column; gap: 7px; }
.dl-item {
  display: grid;
  grid-template-columns: 9px 1fr auto auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.dl-item i { width: 8px; height: 8px; border-radius: 2px; }
.dl-item .dl-name { color: var(--text-2); }
.dl-item .dl-num { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dl-item .dl-pct { color: var(--text-3); font-variant-numeric: tabular-nums; width: 38px; text-align: right; }

/* 词根 */
.roots { padding: 12px 19px 4px; display: flex; flex-direction: column; gap: 9px; }
.root-item { display: flex; align-items: center; gap: 9px; }
.root-name {
  width: 74px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: none;
}
.root-bar {
  flex: 1;
  height: 6px;
  background: var(--panel-3);
  border-radius: 99px;
  overflow: hidden;
}
.root-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #7c93ff, #8b5cf6);
  animation: growBar .5s cubic-bezier(.2,.8,.3,1);
}
@keyframes growBar { from { width: 0 !important; } }
.root-num {
  width: 26px;
  text-align: right;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* ============================================================
   结果表
   ============================================================ */
.results { margin-top: 14px; animation: fadeDown .32s ease; }
.results-head { padding: 14px 19px; }
.rh-left { display: flex; align-items: center; gap: 9px; }
.rh-right { display: flex; gap: 8px; }

.count-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 2px 8px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: .16s;
}
.btn-ghost:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.btn-ghost svg { width: 14px; height: 14px; }

.filters {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 19px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  flex-wrap: wrap;
}
.filter-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 210px;
  flex: 1;
  max-width: 300px;
  transition: .16s;
}
.filter-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,110,247,.1); }
.filter-search svg { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.filter-search input {
  border: 0; outline: 0; background: transparent;
  font-size: 12.5px; font-family: inherit; color: var(--text); width: 100%;
}

.filters select {
  height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  outline: 0;
  transition: .16s;
}
.filters select:hover { border-color: var(--border-strong); }
.filters select:focus { border-color: var(--brand); }

.min-opp {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}
.min-opp label { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.min-opp b { color: var(--brand); font-weight: 650; }
.min-opp input[type=range] {
  width: 104px;
  accent-color: var(--brand);
  cursor: pointer;
}

.table-wrap { overflow-x: auto; max-height: 620px; overflow-y: auto; }

.tbl {
  width: 100%;
  min-width: 780px; /* 窄屏保持可读，由外层容器横向滚动 */
  border-collapse: collapse;
  font-size: 13px;
}
.tbl thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--panel-2);
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .3px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.tbl thead th.sortable { cursor: pointer; transition: color .15s; }
.tbl thead th.sortable:hover { color: var(--brand); }
.tbl thead th.sorted { color: var(--brand); }
.tbl thead th.sorted::after {
  content: "";
  display: inline-block;
  margin-left: 4px;
  border: 3.5px solid transparent;
  border-top-color: var(--brand);
  transform: translateY(2px);
}
.tbl thead th.sorted.asc::after {
  border-top-color: transparent;
  border-bottom-color: var(--brand);
  transform: translateY(-2px);
}

.th-idx { width: 42px; }
.th-word { min-width: 250px; }
.th-num { text-align: right !important; min-width: 88px; }
.th-act { width: 74px; }

.tbl tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr { transition: background .13s; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }

.td-idx { color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.td-word {
  font-weight: 500;
  color: var(--text);
  max-width: 400px;
}
.td-word .kw { cursor: pointer; }
.td-word .kw:hover { color: var(--brand); }
.td-word mark {
  background: rgba(245, 158, 11, .25);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  white-space: nowrap;
  font-weight: 500;
}
.tag i { width: 5px; height: 5px; border-radius: 50%; }
.tag.info { background: rgba(79,110,247,.1); color: var(--c-info); }
.tag.comm { background: rgba(245,158,11,.13); color: #b45309; }
.tag.trans { background: rgba(229,72,77,.1); color: var(--c-trans); }
.tag.nav { background: rgba(139,92,246,.11); color: var(--c-nav); }
[data-theme="dark"] .tag.comm { color: #fbbf24; }

.tag.level {
  background: var(--panel-3);
  color: var(--text-2);
  font-weight: 450;
}
.tag.level.core { background: rgba(229,72,77,.08); color: var(--c-trans); }
.tag.level.xlong { background: var(--green-soft); color: var(--green); }

/* 数值条 */
.num-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.num-cell b {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  text-align: right;
}
.num-cell .mini-bar {
  width: 48px;
  height: 4px;
  border-radius: 99px;
  background: var(--panel-3);
  overflow: hidden;
  flex: none;
}
.num-cell .mini-bar i { display: block; height: 100%; border-radius: 99px; }

.heat-txt { color: var(--brand); }
.heat-bar i { background: linear-gradient(90deg, #8ba3ff, #4f6ef7); }

.comp-txt { color: var(--text-2); }
.comp-bar i { background: linear-gradient(90deg, #fcd34d, #f59e0b); }

.opp-txt { color: var(--green); font-weight: 650 !important; }
.opp-bar i { background: linear-gradient(90deg, #6ee7b7, #0ea472); }

.src-list { display: flex; gap: 4px; flex-wrap: wrap; }
.src {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--text-3);
  white-space: nowrap;
}

.row-act { display: flex; gap: 3px; opacity: 0; transition: opacity .15s; }
.tbl tbody tr:hover .row-act { opacity: 1; }
.act-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: .14s;
}
.act-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.act-btn svg { width: 13px; height: 13px; }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 19px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  gap: 12px;
  flex-wrap: wrap;
}
.pager-info { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pager-btns { display: flex; align-items: center; gap: 5px; }
.pager-btns button {
  height: 30px;
  min-width: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: .15s;
}
.pager-btns button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager-btns button:disabled { opacity: .42; cursor: not-allowed; }
#pageNums { display: flex; gap: 4px; }
.page-num {
  height: 30px; min-width: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.page-num:hover { background: var(--panel-3); }
.page-num.on {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  border-color: var(--brand);
}
.page-dots { color: var(--text-3); padding: 0 2px; align-self: center; }

/* ============================================================
   空状态
   ============================================================ */
.empty { margin-top: 16px; }
.empty-card {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 44px 32px;
  text-align: center;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
}
.empty-ico {
  width: 54px; height: 54px;
  margin: 0 auto 15px;
  border-radius: 15px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid; place-items: center;
}
.empty-ico svg { width: 26px; height: 26px; }
.empty-card h3 { font-size: 16px; font-weight: 620; margin-bottom: 7px; letter-spacing: -.2px; }
.empty-card > p { font-size: 13px; color: var(--text-3); line-height: 1.7; }

.empty-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 26px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}
.empty-notes > div {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 15px;
}
.empty-notes b {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.empty-notes span { font-size: 11.5px; color: var(--text-3); line-height: 1.55; }

/* ============================================================
   违禁词提示（PHP 版专用）
   ============================================================ */
.seed-warn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 11px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 3px solid #e5484d;
  border-radius: 10px;
  color: #991b1b;
  font-size: 12.5px;
  line-height: 1.6;
  animation: fadeDown .2s ease;
}
.seed-warn svg {
  width: 16px; height: 16px;
  flex: none;
  margin-top: 2px;
  color: #e5484d;
}
.seed-warn-body b { display: block; font-size: 12.5px; margin-bottom: 1px; }
.seed-warn-body span { color: #b91c1c; opacity: .88; }
.seed-warn em {
  font-style: normal;
  font-weight: 600;
  background: rgba(229, 72, 77, .12);
  padding: 0 4px;
  border-radius: 3px;
}

.search-box.has-error { border-color: #e5484d; background: #fffafa; }
.search-box.has-error:focus-within {
  border-color: #e5484d;
  box-shadow: 0 0 0 4px rgba(229, 72, 77, .11);
}
.search-box.has-error svg { color: #e5484d; }

/* 结果区过滤标记 */
.banned-badge {
  font-size: 11.5px;
  color: var(--text-3);
  background: var(--panel-3);
  padding: 2px 8px;
  border-radius: 99px;
  cursor: help;
  white-space: nowrap;
}
.banned-badge b { color: #b45309; font-weight: 650; }

[data-theme="dark"] .seed-warn {
  background: #2a1114;
  border-color: #5c2226;
  border-left-color: #f87171;
  color: #fca5a5;
}
[data-theme="dark"] .seed-warn-body span { color: #f87171; }
[data-theme="dark"] .seed-warn em { background: rgba(248, 113, 113, .16); }
[data-theme="dark"] .search-box.has-error { background: #1f1214; }
[data-theme="dark"] .banned-badge b { color: #fbbf24; }

/* ============================================================
   环境警告（PHP 版专用）
   ============================================================ */
.env-warn {
  display: flex;
  gap: 13px;
  background: #fff5ed;
  border: 1px solid #fbd0b5;
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #7c2d12;
  box-shadow: var(--shadow-sm);
}
.env-warn-ico {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex: none;
  margin-top: 1px;
}
.env-warn b { display: block; margin-bottom: 4px; font-size: 13.5px; }
.env-warn ul { margin: 4px 0 6px 17px; }
.env-warn li { margin: 2px 0; }
.env-warn p { margin: 4px 0; }
.env-warn code {
  background: rgba(124, 45, 18, .09);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
}
.env-meta { color: #9a3412; opacity: .75; font-size: 11.5px; }

[data-theme="dark"] .env-warn {
  background: #2a1709;
  border-color: #5a3213;
  color: #fdba74;
}
[data-theme="dark"] .env-warn code { background: rgba(255, 255, 255, .09); }
[data-theme="dark"] .env-meta { color: #fb923c; }

/* ============================================================
   页脚 / Toast
   ============================================================ */
.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 0 8px;
  font-size: 11.5px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.dot-sep { opacity: .45; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 16px);
  background: var(--text);
  color: var(--panel);
  font-size: 13px;
  padding: 9px 17px;
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: .22s cubic-bezier(.2,.8,.3,1);
  z-index: 999;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1080px) {
  .viz { grid-template-columns: 1fr; }
  .viz-side { flex-direction: row; }
  .viz-side > .card { flex: 1; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .settings-body { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .app { padding: 0 15px 40px; }
  .topbar { padding: 16px 0 14px; }
  .status-pill { display: none; }
  .hero { padding: 20px 16px 16px; }
  .hero-head h2 { font-size: 16.5px; }
  .search-row { flex-direction: column; }
  .btn-primary { justify-content: center; height: 46px; }
  .search-box { height: 46px; }
  .settings-body { grid-template-columns: 1fr; gap: 16px; }
  .stats { gap: 9px; }
  .stat { padding: 12px 13px; gap: 10px; }
  .stat-num { font-size: 19px; }
  .viz-side { flex-direction: column; }
  .empty-notes { grid-template-columns: 1fr; }
  .filters { gap: 7px; }
  .min-opp { margin-left: 0; width: 100%; }
  .min-opp input[type=range] { flex: 1; }
  .filter-search { max-width: none; }
  .cloud-wrap { height: 300px; }
  .results-head { flex-wrap: wrap; }
}
