:root {
  --bg0: #0f1412;
  --bg1: #17201c;
  --bg2: #1e2a24;
  --line: #2c3b33;
  --text: #e7efe9;
  --muted: #8fa396;
  --accent: #3dd68c;
  --accent2: #f0b429;
  --danger: #f07178;
  --cyan: #5ad1e8;
  --radius: 10px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Consolas", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1b3a2c 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #24302a 0%, transparent 50%),
    linear-gradient(180deg, var(--bg0), #0c110f 60%, #0a0e0c);
}
a { color: var(--cyan); text-decoration: none; }
button, input, select {
  font: inherit;
  color: inherit;
}
.shell { max-width: 1280px; margin: 0 auto; padding: 28px 20px 48px; }
.brand {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.brand h1 {
  margin: 0; font-size: 28px; letter-spacing: -0.03em; font-weight: 700;
}
.brand h1 span { color: var(--accent); }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }
.live-banner {
  margin: -8px 0 14px; padding: 10px 14px; border: 1px solid var(--accent);
  background: rgba(61,214,140,.12); color: #5dffb0; font-size: 16px; font-weight: 800;
  border-radius: 8px;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  background: transparent; border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; color: var(--muted);
}
.tab.active { border-color: var(--accent); color: var(--accent); background: rgba(61,214,140,.08); }
.btn {
  border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer;
  background: var(--accent); color: #062016; font-weight: 600;
}
.btn.ghost { background: var(--bg2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #1a0808; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .grid.stats { grid-template-columns: 1fr; } }
.panel {
  background: linear-gradient(180deg, rgba(30,42,36,.92), rgba(18,26,22,.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.panel h3 { margin: 0 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; }
.stat-num { font-family: var(--mono); font-size: 28px; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.form-row input, .form-row select {
  background: var(--bg0); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; min-width: 140px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--accent); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.domain { color: var(--cyan); font-weight: 600; font-family: var(--mono); font-size: 12px; }
.kw { color: var(--text); }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
}
.badge.rank { background: #3a2a10; color: var(--accent2); }
.badge.clicks { background: #103528; color: var(--accent); }
.badge.dim { background: #222826; color: #7a877f; }
.muted { color: var(--muted); }
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-box {
  width: min(420px, 100%);
  background: linear-gradient(165deg, #1a2820, #121a16);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-box h1 { margin: 0 0 6px; font-size: 26px; }
.login-box p { margin: 0 0 18px; color: var(--muted); }
.login-box label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.login-box input {
  width: 100%; background: var(--bg0); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 12px;
}
.login-box .btn { width: 100%; margin-top: 16px; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; }
#chart { width: 100%; height: 260px; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: var(--accent); box-shadow: 0 0 0 0 rgba(61,214,140,.6);
  animation: pulse 1.6s infinite; margin-right: 6px;
}
.live-dot.off { background: var(--danger); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61,214,140,.55); }
  70% { box-shadow: 0 0 0 10px rgba(61,214,140,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,214,140,0); }
}
.actions button { margin-right: 6px; margin-top: 4px; }
.actions { white-space: nowrap; min-width: 220px; }
.engine-select {
  background: var(--bg0); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
}
.engine-frames {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 1100px) {
  .engine-frames { grid-template-columns: 1fr 1fr; align-items: start; }
}
.engine-frame { border: 1px solid var(--line); }
.engine-frame-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.engine-frame-head h3 { margin: 0; }
.bing-frame { box-shadow: inset 3px 0 0 #3b82f6; }
.google-frame { box-shadow: inset 3px 0 0 #f0b429; }
.opt-list {
  border-color: #2c3b33; color: #b7c7bc; font-weight: 500; min-width: 200px; max-width: 360px;
}
.small { padding: 5px 9px; font-size: 12px; }
.phase-under {
  font-size: 15px; font-weight: 800; letter-spacing: .02em;
  min-height: 22px; line-height: 1.35;
}
.phase-en {
  margin-top: 4px; font-size: 12px; color: var(--muted, #8fa396);
}
.phase-badge {
  background: transparent; border: 1px solid; padding: 4px 8px; font-weight: 800;
}
.phase-list {
  display: inline-block; background: transparent; border: 1px solid; padding: 6px 10px;
  font-weight: 700; line-height: 1.55; white-space: pre-line; min-width: 160px;
}
.phase-line { font-size: 13px; }
.phase-live { animation: phaseblink 1.4s ease-in-out infinite; }
@keyframes phaseblink {
  0%, 100% { opacity: 1; }
  50% { opacity: .78; }
}
.domain-link { color: var(--cyan); font-weight: 700; text-decoration: none; }
.domain-link:hover { text-decoration: underline; }
.kw-one { color: var(--text); line-height: 1.5; max-width: 420px; }
.top-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pool-wrap { position: relative; display: inline-block; }
.pool-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-left: 6px; vertical-align: middle; background: var(--muted);
}
.pool-dot.ok { background: var(--accent); }
.pool-dot.low { background: var(--danger); }
.pool-dot.spin { background: var(--accent2); animation: phaseblink 1s ease-in-out infinite; }
.pool-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  min-width: 220px; padding: 12px 14px;
  background: linear-gradient(180deg, rgba(30,42,36,.98), rgba(14,20,17,.98));
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
}
.pool-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; font-size: 13px; padding: 3px 0; color: var(--muted);
}
.pool-row b { color: var(--text); font-family: var(--mono); font-weight: 700; }
.pool-hint { margin: 8px 0 0; font-size: 12px; line-height: 1.4; }
