/* ===================================================================
   IP 探针 — 设计系统
   =================================================================== */
:root {
  /* 表面层次 */
  --bg: #0a0e17;
  --surface: #111722;
  --surface-2: #161e2c;
  --surface-3: #1c2536;

  /* 描边 */
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-accent: rgba(77, 141, 255, 0.45);

  /* 文字 */
  --text: #e6ecf7;
  --text-dim: #8b98b0;
  --text-faint: #5a6780;

  /* 强调色 */
  --accent: #4d8dff;
  --accent-soft: rgba(77, 141, 255, 0.12);
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, 0.12);
  --warn: #f5b942;
  --warn-soft: rgba(245, 185, 66, 0.12);
  --err: #ff6b81;
  --err-soft: rgba(255, 107, 129, 0.12);

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

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

html[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --surface-3: #eef1f8;

  --line: rgba(16, 32, 64, 0.09);
  --line-2: rgba(16, 32, 64, 0.16);
  --line-accent: rgba(43, 110, 242, 0.5);

  --text: #0f1726;
  --text-dim: #5a6a85;
  --text-faint: #8a97ad;

  --accent: #2b6ef2;
  --accent-soft: rgba(43, 110, 242, 0.09);
  --ok: #0f9d6e;
  --ok-soft: rgba(15, 157, 110, 0.1);
  --warn: #c47f00;
  --warn-soft: rgba(196, 127, 0, 0.1);
  --err: #d93a52;
  --err-soft: rgba(217, 58, 82, 0.09);
}

/* ===================================================================
   基础
   =================================================================== */
* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 极淡的环境光，不干扰阅读 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 15% -10%, rgba(77, 141, 255, 0.10), transparent 60%),
    radial-gradient(700px 420px at 92% 0%, rgba(120, 90, 255, 0.07), transparent 62%);
}

html[data-theme="light"] body::before {
  background:
    radial-gradient(900px 480px at 15% -10%, rgba(43, 110, 242, 0.07), transparent 60%),
    radial-gradient(700px 420px at 92% 0%, rgba(120, 90, 255, 0.05), transparent 62%);
}

::selection { background: var(--accent); color: #fff; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 6px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ===================================================================
   布局骨架
   =================================================================== */
.shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 56px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-right: auto;
  min-width: 0;
}

.logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--accent), #7c5cff);
  flex: none;
}

.logo svg { width: 18px; height: 18px; }

.brand-text { min-width: 0; }

.brand h1 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.1px;
  white-space: nowrap;
}

.brand p {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover { background: var(--surface-3); border-color: var(--text-faint); }
.btn:active { transform: translateY(0.5px); }

.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.btn.primary:hover { background: #3d7cf0; }

.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }

.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; flex: none; }

/* ===================================================================
   三通道出口面板 —— 单一容器内分段，避免三张浮卡
   =================================================================== */
.exits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
}

.exit-card {
  position: relative;
  padding: 18px 20px 20px;
  cursor: pointer;
  background: transparent;
  border: none;
  text-align: left;
  font-family: inherit;
  color: inherit;
  display: block;
  transition: background 0.16s;
  min-width: 0;
}

.exit-card + .exit-card { border-left: 1px solid var(--line); }

.exit-card:hover { background: var(--surface-2); }

.exit-card.active { background: var(--accent-soft); }

.exit-card.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}

.exit-card[data-ok="0"] { cursor: default; }
.exit-card[data-ok="0"]:hover { background: transparent; }

.exit-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.exit-idx {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.5px;
  flex: none;
}

.exit-head h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

.exit-state {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  letter-spacing: 0.3px;
  background: var(--surface-3);
  color: var(--text-faint);
  white-space: nowrap;
  flex: none;
}

.exit-state.ok { background: var(--ok-soft); color: var(--ok); }
.exit-state.err { background: var(--err-soft); color: var(--err); }

.exit-ip {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1.25;
  word-break: break-all;
  color: var(--text);
  min-height: 27px;
}

.exit-ip.is-ip { cursor: pointer; }
.exit-ip.is-ip:hover { color: var(--accent); }

.exit-desc {
  font-size: 11px;
  color: var(--text-faint);
  margin: 7px 0 0;
  line-height: 1.5;
  min-height: 2.2em;
}

.exit-loc {
  margin-top: 11px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
  min-height: 1.45em;
}

.exit-loc strong { font-weight: 600; }

.exit-loc .loc-sub {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--mono);
  margin-top: 3px;
  word-break: break-all;
}

.exit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
  min-height: 18px;
}

/* ---------- 汇总条 ---------- */
.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}

/* [hidden] 的 UA 规则会被上面的 display:flex 覆盖，这里显式兜底 */
.summary[hidden] { display: none; }

.sum-cell {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 11px 16px;
  min-width: 0;
  flex: 1 1 auto;
}

.sum-cell + .sum-cell { border-left: 1px solid var(--line); }

.sum-cell .k {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  flex: none;
}

.sum-cell .v {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text);
  word-break: break-all;
}

/* ===================================================================
   通用卡片
   =================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card + .card { margin-top: 14px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: 46px;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

.card-head .spacer { margin-left: auto; }

.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }

/* ===================================================================
   主栅格 —— 单栏纵向流
   =================================================================== */
.main {
  display: block;
}

.col { min-width: 0; }

/* 通道详情：全宽独立卡 */
.detail-card { margin-bottom: 14px; }

/* ===================================================================
   规格表（详情）—— 多列自适应，横向铺满
   =================================================================== */
.spec {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.spec-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 13px;
  background: var(--surface);
  min-width: 0;
}

.spec-item .k {
  font-size: 11.5px;
  color: var(--text-faint);
  flex: none;
  white-space: nowrap;
}

.spec-item .v {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  margin-left: auto;
  text-align: right;
  word-break: break-all;
  min-width: 0;
  line-height: 1.45;
}

.spec-item .v.dim { color: var(--text-faint); }

/* ===================================================================
   各库对照表
   =================================================================== */
.src-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.src-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 13px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.src-table td {
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.src-table tr:last-child td { border-bottom: none; }

.src-table .src-name {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  width: 130px;
}

.src-table .src-val {
  font-family: var(--mono);
  color: var(--text);
  word-break: break-all;
  line-height: 1.55;
}

.src-table tr.miss .src-val { color: var(--text-faint); }

/* ===================================================================
   冲突提示
   =================================================================== */
.conflict {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 185, 66, 0.35);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11.5px;
  font-family: var(--mono);
  line-height: 1.55;
}

.conflict + .conflict { margin-top: 6px; }

/* ===================================================================
   Tabs
   =================================================================== */
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

html[data-theme="light"] .tab.active { box-shadow: 0 1px 3px rgba(16, 32, 64, 0.12); }

.pane { display: none; }
.pane.active { display: block; }

/* ===================================================================
   输入
   =================================================================== */
.searchbar {
  display: flex;
  gap: 8px;
}

.input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder { color: var(--text-faint); font-family: var(--sans); font-size: 12.5px; }

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hint {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 9px;
  line-height: 1.55;
}

/* ===================================================================
   查询结果
   =================================================================== */
.result-box { margin-top: 14px; }

.res-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: var(--surface-2);
}

.res-item + .res-item { margin-top: 7px; }

.res-item .ip {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.res-item .loc {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text);
  word-break: break-all;
}

.res-item .sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--mono);
  word-break: break-all;
  line-height: 1.5;
}

/* ===================================================================
   徽章
   =================================================================== */
.pill {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--err-soft); color: var(--err); }

/* ===================================================================
   表格（网段扫描）
   =================================================================== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-family: var(--mono);
}

table.data th {
  text-align: left;
  padding: 7px 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface-2);
}

table.data td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  color: var(--text);
}

table.data tr:last-child td { border-bottom: none; }

table.data td.wrap {
  white-space: normal;
  word-break: break-all;
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ===================================================================
   加载态 / 提示
   =================================================================== */
.skeleton {
  display: inline-block;
  height: 0.85em;
  width: 6em;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--surface-3) 25%,
    var(--line-2) 50%,
    var(--surface-3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  vertical-align: middle;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.bar {
  height: 2px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: 2px;
  background: var(--accent);
  animation: slide 1.1s ease-in-out infinite;
}

@keyframes slide {
  0% { margin-left: -32%; }
  100% { margin-left: 102%; }
}

.err-text { color: var(--err); font-size: 11.5px; line-height: 1.55; word-break: break-all; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 99;
  max-width: min(90vw, 460px);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===================================================================
   页脚
   =================================================================== */
.foot {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.7;
}

/* ===================================================================
   响应式
   =================================================================== */
@media (max-width: 860px) {
  .shell { width: calc(100% - 24px); }
  .exits { grid-template-columns: 1fr; }
  .exit-card + .exit-card {
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .exit-card.active::before {
    left: 0; right: 0; top: 0; bottom: auto;
    width: auto; height: 2px;
  }
  .summary { flex-direction: column; align-items: stretch; }
  .sum-cell { border-left: none; }
  .sum-cell + .sum-cell { border-left: none; border-top: 1px solid var(--line); }
  .topbar { height: auto; padding: 12px 0; flex-wrap: wrap; }
  .brand { width: 100%; margin-bottom: 10px; }
  .btn { flex: 1; }
}

@media (max-width: 560px) {
  .exit-ip { font-size: 18px; }
  .card-body { padding: 13px 14px; }
  .card-head { padding: 0 14px; height: 42px; }
  .spec { grid-template-columns: 1fr; }
  .src-table .src-name { width: 92px; }
  .searchbar { flex-wrap: wrap; }
  .searchbar .btn { width: 100%; }
  .src-table th, .src-table td { padding: 8px 10px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

