/* ============================================================
 * 在线 Ping（IPv4 ICMP）页面样式（ping.css）
 * 依赖：base.css
 * 前缀 nx- 为新风格静态结构；末尾 tp-* 兼容探测 JS 动态生成内容
 * ============================================================ */

/* 面包屑 */
.nx-breadcrumb { background: #fff; border-bottom: 1px solid var(--nx-line); }
.nx-breadcrumb-inner { display: flex; align-items: center; gap: 7px; height: 40px; font-size: 12px; color: var(--nx-muted); }
.nx-breadcrumb-inner svg { color: var(--nx-brand); }
.nx-breadcrumb a { color: var(--nx-ink-soft); }
.nx-breadcrumb a:hover { color: var(--nx-brand); }
.nx-breadcrumb .sep { color: #cbd5e1; }

/* ===== 探测输入卡 ===== */
.nx-probe-card { margin-top: 18px; padding: 18px 20px; }
.nx-probe-row { display: flex; gap: 10px; align-items: stretch; }
.nx-input-wrap { position: relative; flex: 1; }
.nx-target-input {
  width: 100%; height: 46px; border: 1.5px solid var(--nx-line); border-radius: 9px;
  padding: 0 40px 0 14px; font-size: 15px; color: var(--nx-ink); background: #fbfcfe;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.nx-target-input::placeholder { color: #aab4c3; }
.nx-target-input:focus {
  outline: none; border-color: var(--nx-brand); background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}
.nx-clear-icon {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: #b6c0cf; cursor: pointer; display: none;
}
.nx-clear-icon:hover { fill: var(--nx-muted); }
.nx-btn-group { display: flex; gap: 8px; }
.nx-btn-group .nx-btn { height: 46px; padding: 0 16px; font-size: 14px; }

/* 开始提示气泡 */
.nx-start-hint { position: absolute; top: -6px; left: 50%; transform: translate(-50%, -100%); width: max-content; }
.nx-btn-group { position: relative; }
.nx-start-hint-bubble {
  display: flex; align-items: center; gap: 7px; background: var(--nx-ink); color: #fff;
  padding: 8px 12px; border-radius: 8px; font-size: 12px; font-weight: 500;
  box-shadow: var(--nx-shadow-lg); animation: nx-float 2.2s ease-in-out infinite;
}
.nx-start-hint-bubble svg { width: 15px; height: 15px; flex-shrink: 0; color: #93c5fd; }
.nx-start-hint-arrow {
  position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%) rotate(45deg);
  width: 10px; height: 10px; background: var(--nx-ink);
}
@keyframes nx-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* 筛选行 */
.nx-controls-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.nx-chip-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.nx-chip {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none;
  padding: 5px 10px; border: 1px solid var(--nx-line); border-radius: 6px;
  font-size: 12.5px; color: var(--nx-ink-soft); background: #fff; transition: all .15s;
}
.nx-chip input { accent-color: var(--nx-brand); width: 13px; height: 13px; margin: 0; }
.nx-chip.active { border-color: var(--nx-brand-line); background: var(--nx-brand-soft); color: var(--nx-brand); font-weight: 600; }
.nx-dns-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--nx-muted); }
.nx-seg { display: inline-flex; background: #eef2f8; border-radius: 7px; padding: 3px; }
.nx-seg button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 5px;
  font-size: 12px; color: var(--nx-ink-soft); cursor: pointer; transition: all .15s;
}
.nx-seg button.active { background: #fff; color: var(--nx-brand); font-weight: 700; box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.nx-dns-input {
  height: 30px; width: 130px; border: 1px solid var(--nx-line); border-radius: 6px;
  padding: 0 9px; font-size: 12px; color: var(--nx-ink);
}
.nx-dns-input:focus { outline: none; border-color: var(--nx-brand); }
.nx-dns-row b { color: var(--nx-brand); }

/* ===== 全局广告位（6 宫格，默认隐藏由 JS 填充） ===== */
.nx-ad-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
.nx-ad-grid:empty, .nx-ad-slot:empty { display: none; }
.nx-ad-slot { min-height: 0; }

/* ===== 实时概览统计条 ===== */
.nx-stats-strip {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 16px;
}
.nx-stat {
  background: #fff; border: 1px solid var(--nx-line); border-radius: 10px;
  padding: 13px 15px; box-shadow: var(--nx-shadow);
}
.nx-stat-label { font-size: 12px; color: var(--nx-muted); margin-bottom: 4px; }
.nx-stat-value { font-size: 23px; font-weight: 800; color: var(--nx-ink); line-height: 1.2; }
.nx-stat-value small { font-size: 12px; font-weight: 600; color: var(--nx-muted); margin-left: 2px; }
.nx-stat-sub { font-size: 11px; color: var(--nx-muted); margin-top: 3px; }

/* ===== 状态条 ===== */
.nx-status-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--nx-line-soft);
}
.nx-status-left { display: flex; align-items: center; gap: 11px; }
.nx-status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--nx-muted); flex-shrink: 0; }
.nx-status-dot.live { background: var(--nx-success); box-shadow: 0 0 0 4px rgba(22,163,74,.14); animation: nx-pulse 1.6s infinite; }
.nx-status-dot.running { background: var(--nx-brand); box-shadow: 0 0 0 4px rgba(37,99,235,.14); }
@keyframes nx-pulse { 0%,100% { box-shadow: 0 0 0 4px rgba(22,163,74,.14); } 50% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } }
.nx-status-left strong { font-size: 14px; }
.nx-status-left .desc { font-size: 12px; color: var(--nx-muted); }
.nx-status-stop {
  border: 1px solid #fecaca; background: #fef2f2; color: var(--nx-danger);
  padding: 7px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.nx-status-stop:hover { background: #fee2e2; }

/* ===== 地图 + 地区统计 两栏 ===== */
.nx-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px; }
.nx-map-card, .nx-summary-card { border: 1px solid var(--nx-line-soft); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.nx-map-card .nx-card-head, .nx-summary-card .nx-card-head { padding: 11px 14px; }
.nx-map-wrap { position: relative; flex: 1; min-height: 480px; padding: 8px; }
.nx-china-map, .nx-world-map { width: 100%; height: 100%; min-height: 460px; }
/* 地图左上角品牌角标 */
.nx-map-brand {
  position: absolute; top: 12px; left: 14px; z-index: 3;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px; color: var(--nx-ink-soft);
  background: rgba(255,255,255,.92); padding: 4px 9px 4px 7px; border-radius: 6px;
  box-shadow: var(--nx-shadow); pointer-events: none;
}
.nx-map-brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, var(--nx-brand));
  box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}
.nx-map-marker-toggle {
  position: absolute; top: 12px; right: 14px; display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--nx-ink-soft); background: rgba(255,255,255,.9);
  padding: 4px 8px; border-radius: 6px; box-shadow: var(--nx-shadow);
}
.nx-map-marker-switch, .nx-switch { position: relative; width: 30px; height: 17px; display: inline-block; }
.nx-map-marker-switch input, .nx-switch input { opacity: 0; width: 0; height: 0; }
.nx-map-marker-slider, .nx-switch .slider {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 17px; cursor: pointer; transition: .2s;
}
.nx-map-marker-slider::before, .nx-switch .slider::before {
  content: ""; position: absolute; width: 13px; height: 13px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.nx-map-marker-switch input:checked + .nx-map-marker-slider, .nx-switch input:checked + .slider { background: var(--nx-brand); }
.nx-map-marker-switch input:checked + .nx-map-marker-slider::before, .nx-switch input:checked + .slider::before { transform: translateX(13px); }

/* 地区统计表头工具栏 */
.nx-tab-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nx-tab {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 6px;
  font-size: 12px; color: var(--nx-ink-soft); cursor: pointer; transition: all .15s;
}
.nx-tab.active { background: var(--nx-brand); color: #fff; font-weight: 600; }
.nx-circle-badge {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px;
  background: var(--nx-brand-soft); color: var(--nx-brand); border-radius: 11px; font-size: 12px; font-weight: 700;
}
.nx-copy-btn {
  border: 1px solid var(--nx-brand-line); background: #fff; color: var(--nx-brand);
  padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.nx-copy-btn:hover { background: var(--nx-brand-soft); }
.nx-progress { display: flex; align-items: center; gap: 6px; }
.nx-progress-bar { width: 90px; height: 6px; background: var(--nx-line); border-radius: 4px; overflow: hidden; }
.nx-progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--nx-brand), #60a5fa); transition: width .3s; }

/* ===== 通用表格 ===== */
.nx-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.nx-table thead th {
  background: #f7f9fc; color: var(--nx-ink-soft); font-weight: 600; text-align: left;
  padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--nx-line);
}
.nx-table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--nx-line-soft); }
.nx-table tbody tr:hover { background: #fafcff; }
.nx-table-responsive { overflow-x: auto; max-width: 100%; }
.nx-table .num { font-variant-numeric: tabular-nums; }

/* ===== 持续测试分析 ===== */
.nx-ct-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; padding: 14px; }
.nx-ct-chart-wrap { border: 1px solid var(--nx-line-soft); border-radius: 10px; padding: 8px; min-width: 0; }
.nx-worst-wrap { border: 1px solid var(--nx-line-soft); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; min-width: 0; }
.nx-worst-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.nx-worst-list { overflow-y: auto; max-height: 320px; }
.nx-mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ===== 域名解析统计 ===== */
.nx-dns-tip { font-size: 12px; color: var(--nx-muted); margin-bottom: 10px; }
.nx-dns-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.nx-dns-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #f8fafc; border: 1px solid var(--nx-line-soft); border-radius: 7px; padding: 8px 11px; font-size: 12.5px;
}
.nx-dns-item .ip { font-family: ui-monospace, monospace; color: var(--nx-ink); }
.nx-dns-item .pct { color: var(--nx-brand); font-weight: 700; }

/* ===== 检测点结果表 ===== */
.nx-result-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; width: 100%; }
.nx-result-tabs { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.nx-count-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--nx-line); color: var(--nx-ink-soft); border-radius: 9px; font-size: 11px; margin-left: 3px;
}
.nx-count-right { margin-left: auto; font-size: 12px; color: var(--nx-muted); white-space: nowrap; }
.nx-count-right b { color: var(--nx-brand); }
.nx-result-table thead th { position: sticky; top: 0; z-index: 2; }
.nx-prov-filter-chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--nx-brand-soft);
  color: var(--nx-brand); padding: 3px 6px 3px 9px; border-radius: 6px; font-size: 12px;
}
.nx-prov-filter-close { border: 0; background: transparent; color: var(--nx-brand); cursor: pointer; font-size: 15px; line-height: 1; }

/* ===== 文档 / FAQ ===== */
.nx-docs-body { font-size: 13.5px; line-height: 1.85; color: var(--nx-ink-soft); }
.nx-docs-body h3, .nx-docs-body h4 { color: var(--nx-ink); margin: 18px 0 6px; }
.nx-docs-body h3 { font-size: 15px; }
.nx-docs-body h4 { font-size: 13.5px; }
.nx-docs-body p, .nx-docs-body ul { margin: 6px 0; }
.nx-docs-body ul { padding-left: 20px; }

/* ===== 相关工具卡片 ===== */
.nx-tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 14px; }
.nx-tool-card {
  border: 1px solid var(--nx-line); border-radius: 9px; padding: 13px; transition: all .16s; background: #fff;
}
.nx-tool-card:hover { border-color: var(--nx-brand-line); box-shadow: var(--nx-shadow); transform: translateY(-2px); }
.nx-tool-card strong { display: block; font-size: 13.5px; color: var(--nx-ink); margin-bottom: 3px; }
.nx-tool-card div { font-size: 11.5px; color: var(--nx-muted); line-height: 1.5; }

/* ===== 热门目标 ===== */
.nx-popular-section { margin-top: 18px; }
.nx-popular-title { font-size: 13px; font-weight: 700; color: var(--nx-ink-soft); margin-bottom: 10px; }
.nx-popular-list { display: flex; flex-wrap: wrap; gap: 7px; }
.nx-popular-chip {
  padding: 6px 12px; background: #fff; border: 1px solid var(--nx-line);
  border-radius: 16px; font-size: 12px; color: var(--nx-ink-soft); transition: all .15s;
}
.nx-popular-chip:hover { border-color: var(--nx-brand); color: var(--nx-brand); background: var(--nx-brand-soft); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .nx-stats-strip { grid-template-columns: repeat(3, 1fr); }
  .nx-grid-2, .nx-ct-grid { grid-template-columns: 1fr; }
  .nx-map-wrap { min-height: 440px; }
  .nx-china-map, .nx-world-map { min-height: 420px; }
  .nx-tool-grid { grid-template-columns: repeat(2, 1fr); }
  /* 结果表在窄屏强制横向滚动，表头不压缩 */
  .nx-table-responsive { -webkit-overflow-scrolling: touch; }
  .nx-result-table { min-width: 860px; }
  .nx-summary-table { min-width: 420px; }
  .nx-result-head { gap: 8px; }
  .nx-count-right { margin-left: 0; }
}
@media (max-width: 640px) {
  .nx-probe-row { flex-direction: column; }
  .nx-btn-group { flex-wrap: wrap; }
  .nx-btn-group .nx-btn { flex: 1; min-width: 96px; }
  .nx-stats-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .nx-stat-value { font-size: 20px; }
  .nx-controls-row { flex-direction: column; align-items: flex-start; }
  .nx-map-wrap { min-height: 360px; }
  .nx-china-map, .nx-world-map { min-height: 340px; }
  .nx-card-head { padding: 12px; }
  .nx-card-body { padding: 12px; }
  .nx-ct-grid { padding: 10px; }
  .nx-tool-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; }
  .nx-probe-card { padding: 14px; }
  .nx-footer-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
}
@media (max-width: 420px) {
  .nx-footer-grid { grid-template-columns: 1fr; }
  .nx-btn-group .nx-btn { min-width: calc(50% - 4px); }
  .nx-stat-value { font-size: 18px; }
  .nx-map-brand { font-size: 10px; padding: 3px 7px 3px 6px; }
}

/* ============================================================
 * 兼容：探测 JS 动态生成的 tp-* 类名（保持功能样式一致）
 * ============================================================ */
.tp-history-header, .tp-worst-head { display: flex; align-items: center; justify-content: space-between; }
.tp-history-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--nx-line-soft); }
.tp-history-item:hover { background: #fafcff; }
.tp-history-item-text { font-weight: 600; color: var(--nx-ink); }
.tp-history-item-meta, .tp-history-item-time { font-size: 11px; color: var(--nx-muted); }
.tp-history-item-actions { display: flex; gap: 4px; margin-left: auto; }
.tp-history-action-btn, .tp-history-clear-all, .tp-opt-btn {
  border: 1px solid var(--nx-line); background: #fff; color: var(--nx-ink-soft);
  padding: 3px 8px; border-radius: 5px; font-size: 11px; cursor: pointer;
}
.tp-history-action-btn:hover, .tp-history-clear-all:hover, .tp-opt-btn:hover { border-color: var(--nx-brand); color: var(--nx-brand); }
.tp-history-empty { padding: 18px; text-align: center; color: var(--nx-muted); font-size: 12px; }
.tp-ip-cell, .tp-point-cell { line-height: 1.5; }
.tp-tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--nx-line-soft); color: var(--nx-ink-soft); margin-right: 4px; }
.tp-latency-pill { display: inline-block; min-width: 46px; text-align: center; padding: 2px 8px; border-radius: 5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tp-loss, .tp-percent { font-variant-numeric: tabular-nums; }
.tp-note { font-size: 11px; color: var(--nx-muted); }
.tp-quality-wave { display: inline-flex; align-items: center; gap: 2px; height: 16px; }
.tp-worst-item { display: flex; align-items: center; gap: 9px; padding: 8px 6px; border-bottom: 1px solid var(--nx-line-soft); }
.tp-worst-rank { width: 22px; height: 22px; border-radius: 6px; background: var(--nx-line-soft); color: var(--nx-ink-soft); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.tp-worst-name { font-weight: 600; font-size: 12px; }
.tp-worst-bar { height: 4px; border-radius: 2px; background: var(--nx-brand); margin-top: 4px; }
.tp-worst-metric { font-size: 11px; color: var(--nx-muted); }
.tp-worst-empty { padding: 20px; text-align: center; color: var(--nx-muted); font-size: 12px; }
.tp-node-promo { font-size: 11px; color: var(--nx-muted); }
.tp-timeout { color: var(--nx-danger); font-weight: 600; }
.tp-drawer-locked { overflow: hidden; }
