:root {
  --bg: #0b0f1a;
  --bg-soft: #111827;
  --panel: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e6eaf2;
  --muted: #8b95a7;
  --accent: #6366f1;
  --accent2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 15% -10%, #1b2340 0%, transparent 60%), radial-gradient(900px 500px at 95% 0%, #10303a 0%, transparent 55%), var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  min-height: 100%;
}

a {
  color: var(--accent2);
}

.mono {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 24, 0.6);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.3px;
}

.brand .sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.status {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.status-line .sep {
  color: var(--border);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(139, 149, 167, 0.15);
}

.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}

.dot.run {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.18);
  animation: pulse 1.2s infinite;
}

.dot.err {
  background: var(--bad);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.18);
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: 0.15s;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-color: transparent;
  font-weight: 600;
}

.btn.tiny {
  padding: 5px 10px;
  font-size: 12px;
}

.brand-cn {
  font-size: 0.62em;
  font-weight: 500;
  color: var(--muted);
  margin-left: 6px;
  letter-spacing: 2px;
  vertical-align: middle;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}

.lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn + .lang-btn {
  border-left: 1px solid var(--border);
}

.lang-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.lang-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--text);
}

/* ---------- progress ---------- */
.progress-wrap {
  padding: 10px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(99, 102, 241, 0.08);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.progress-bar {
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar > div {
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.3s;
}

/* ---------- layout ---------- */
main {
  padding: 20px 26px 60px;
  max-width: 1600px;
  margin: 0 auto;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.card .k {
  font-size: 12px;
  color: var(--muted);
}

.card .v {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
  font-family: ui-monospace, Consolas, monospace;
}

.card .sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.panel {
  background: rgba(17, 24, 39, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.grow {
  flex: 1 1 240px;
}

.field > label:first-child {
  font-size: 11px;
  color: var(--muted);
}

input[type="search"],
input[type="text"],
input[type="number"],
input:not([type]),
select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  min-width: 120px;
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.inline {
  display: flex;
  gap: 6px;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  padding-bottom: 8px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}

.chip:hover {
  color: var(--text);
}

.chip.active {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  border-color: transparent;
}

.chips.small .chip {
  padding: 4px 9px;
  font-size: 11px;
}

.chip.ghost {
  border-style: dashed;
}

/* ---------- table ---------- */
.table-head-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 14px 0 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.table-head-bar .right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  max-height: 62vh;
  position: relative;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #141b2b;
  text-align: left;
  padding: 10px 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(99, 102, 241, 0.09);
}

tbody tr.sel {
  background: rgba(34, 211, 238, 0.1);
}

.w40 {
  width: 40px;
}

.w80 {
  width: 80px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.tag.http {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.35);
}

.tag.https {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.35);
}

.tag.socks4 {
  color: #fcd34d;
  border-color: rgba(252, 211, 77, 0.35);
}

.tag.socks5 {
  color: #f0abfc;
  border-color: rgba(240, 171, 252, 0.35);
}

.lat {
  font-family: ui-monospace, Consolas, monospace;
}

.lat.fast {
  color: var(--ok);
}

.lat.mid {
  color: var(--warn);
}

.lat.slow {
  color: var(--bad);
}

.mini-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}

.mini-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.72);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
}

.modal-box {
  width: min(680px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #101725;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-foot {
  border-bottom: none;
  border-top: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
}

.modal-body {
  padding: 16px 18px;
  overflow: auto;
}

.row {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row > label:first-child {
  font-size: 12px;
  color: var(--muted);
}

.row input {
  width: 100%;
}

.hint {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.preview {
  margin: 0;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, Consolas, monospace;
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  background: #172033;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.2s ease;
}

.toast.ok {
  border-left-color: var(--ok);
}

.toast.err {
  border-left-color: var(--bad);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
}

@media (max-width: 720px) {
  .topbar,
  main {
    padding-left: 12px;
    padding-right: 12px;
  }
  .table-wrap {
    max-height: 60vh;
  }
}

.foot {
  margin: 26px 40px 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* 匿名度等级标签 */
.tag.lv-elite,
.tag.lv-anonymous,
.tag.lv-transparent,
.tag.lv-unknown {
  background: rgba(148, 163, 184, 0.14);
  color: var(--text);
  border: 1px solid transparent;
}

.tag.lv-elite {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.tag.lv-anonymous {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

.tag.lv-transparent {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.tag.lv-unknown {
  color: var(--muted);
}

/* 评分与等级 */
td.score {
  font-weight: 600;
  cursor: help;
}

.grade {
  font-weight: 700;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--muted);
}

.grade.gAp,
.grade.gA {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
}

.grade.gB {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
}

.grade.gC {
  background: rgba(234, 179, 8, 0.16);
  color: #fbbf24;
}

.grade.gD,
.grade.gE {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

.foot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 10px;
}

.foot-nav a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}

.foot-nav a:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.foot-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.foot-contact {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.mail {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.mail:hover {
  text-decoration: underline;
}

/* ---------------- 广告位 ---------------- */

.ad-slot:empty {
  display: none;
}

.ad-slot.hidden {
  display: none;
}

.ad-top {
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.ad-bottom {
  margin: 18px 40px 0;
  text-align: center;
}

.ad-card {
  display: inline-block;
  max-width: 100%;
}

.ad-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.ad-image img {
  display: block;
  max-width: 100%;
  max-height: 120px;
  border-radius: 10px;
}

.ad-text .ad-link {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.ad-title {
  font-size: 13px;
  font-weight: 600;
}

.ad-text .ad-text-body,
.ad-text span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------------- 页脚访问统计 ---------------- */

.visit {
  margin: 16px 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.visit-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.visit-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.visit-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.visit-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.visit-num {
  display: flex;
  flex-direction: column;
  min-width: 96px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}

.visit-num b {
  font-size: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.3;
}

.visit-num em {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.visit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.visit-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.visit-item b {
  font-weight: 600;
}

.visit-item i {
  font-style: normal;
  color: var(--muted);
}

.visit-item em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 720px) {
  .foot {
    margin: 20px 12px 28px;
  }
  .ad-bottom {
    margin: 14px 12px 0;
  }
  .visit {
    padding: 12px;
  }
  .visit-num {
    flex: 1 1 90px;
    min-width: 0;
  }
}
