/* 出口与分流检测页（/outbound）。颜色沿用 site-theme.css 的站点变量。 */
/* 与其他检测页模板相同的基础重置，页头与容器尺寸才会和主站一致。 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { min-height: 100vh; }
/* The theme stylesheet loads after this file, so the page's hero artwork needs the extra element selector. */
body.ipkk-outbound { --ipkk-hero-art: url('/icons/hero-outbound.svg'); }

.ipkk-outbound {
  --ob-good: #13994f;
  --ob-slow: #d97706;
  --ob-bad: #d0392f;
  --ob-info: #0e7490;
  --ob-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  --ob-track: #e6e9e7;
}

/* 页头与外层容器沿用站点主题的 .hero / .wrap / .card；这里只补卡片内的间距。 */
.ob-wrap { display: grid; gap: 18px; }
.ob-wrap > .info-block, .ob-wrap > .info-block-row { margin-top: 0; }
.ob-card { overflow: hidden; }
.ob-card .card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ob-card .card-title { display: flex; align-items: center; }
.ob-title-icon { flex-shrink: 0; width: 18px; height: 18px; color: var(--ipkk-accent); }
.ob-body { padding: 22px 26px 26px; display: grid; gap: 16px; min-width: 0; }
.ob-desc { font-size: 13px; line-height: 1.7; color: var(--text-soft); }

.ob-recheck { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--font); border: 1px solid; cursor: pointer; }
.ob-recheck svg { width: 14px; height: 14px; }
.ob-recheck:disabled { cursor: progress; }
.ob-recheck:disabled svg { animation: ob-spin 1s linear infinite; }

.ob-pack:focus-visible, .ob-copy:focus-visible, .ob-recheck:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Exit cards: one per exit address, key facts from the shared IP data and a map thumbnail. */
.ob-exits { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 12px; }
.ob-exit-card { display: grid; align-content: start; gap: 12px; min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ob-exit-card.is-fail { border-color: #f3cfcb; background: #fdf7f6; }
.ob-exit-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.ob-role { padding: 1px 9px; font-size: 12px; font-weight: 600; line-height: 20px; color: var(--text-soft); background: #f1f2f1; border-radius: 999px; }
.ob-role:first-child { color: var(--ipkk-accent-deep); background: var(--ipkk-accent-soft); }
.ob-exit-body { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; min-width: 0; }
.ob-exit-info { display: grid; gap: 12px; min-width: 0; flex: 1; }
.ob-exit-ip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ob-exit-addr { font: 700 20px/1.3 var(--ob-mono); color: var(--text-main); overflow-wrap: anywhere; }
/* Facts take their natural width and wrap as whole items, so values never break mid-word. */
.ob-exit-facts { display: flex; flex-wrap: wrap; gap: 10px 32px; }
.ob-exit-facts div { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.ob-exit-facts dt { font-size: 12px; color: var(--text-soft); }
.ob-exit-facts dd { margin-top: 2px; font-size: 13px; font-weight: 500; line-height: 1.5; color: var(--text-main); overflow-wrap: break-word; }
.ob-exit-facts dd .ipkk-flag, .ob-exit-facts dd .ob-flag-slot { margin-right: 6px; }
.ob-exit-state { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); }
.ob-exit-card.is-fail .ob-exit-state { color: var(--ob-bad); }
.ob-map { flex: none; display: grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none; font: 500 12px var(--font); color: var(--ipkk-accent); cursor: pointer; }
.ob-map:hover span { text-decoration: underline; text-underline-offset: 3px; }
.ob-map:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 8px; }
.ob-proto { padding: 1px 6px; border-radius: 5px; font: 700 11px var(--ob-mono); }
.ob-proto.v4 { color: #1d4ed8; background: #e8efff; }
.ob-proto.v6 { color: #7c3aed; background: #f1eaff; }
.ob-ip { font-family: var(--ob-mono); font-weight: 600; overflow-wrap: anywhere; }
.ob-place { color: var(--text-soft); font-size: 12px; }
.ob-muted { color: var(--text-soft); font-size: 13px; }
.ob-flag-slot { display: inline-block; flex-shrink: 0; width: 1.333em; height: 1em; border-radius: 2px; background: #eceeed; vertical-align: -.12em; }
.ob-bad { color: var(--ob-bad); font-size: 13px; font-weight: 600; }

.ob-verdict { --tone: var(--text-main); --tone-bg: #f7f8f7; border: 1px solid var(--line); border-radius: 12px; background: var(--tone-bg); padding: 16px 18px; display: grid; gap: 12px; }
.ob-verdict[hidden] { display: none; }
.ob-verdict.tone-ok { --tone: var(--ob-good); --tone-bg: #f1f9f4; border-color: #cfe9d9; }
.ob-verdict.tone-warn { --tone: var(--ob-slow); --tone-bg: #fff8ec; border-color: #f6dfb6; }
.ob-verdict.tone-bad { --tone: var(--ob-bad); --tone-bg: #fdf1f0; border-color: #f3cfcb; }
.ob-verdict.tone-pending { --tone: var(--text-main); }
.ob-verdict.tone-info { --tone: var(--ob-info); --tone-bg: #f0f8fa; border-color: #cbe6ec; }
.ob-verdict-head { display: flex; gap: 10px; align-items: flex-start; }
.ob-verdict-icon { flex-shrink: 0; width: 22px; height: 22px; color: var(--tone); display: grid; place-items: center; }
.ob-verdict-icon svg { width: 22px; height: 22px; }
.ob-verdict-title { font-size: 15px; font-weight: 750; color: var(--tone); line-height: 22px; }
.ob-verdict-desc { margin-top: 2px; font-size: 13px; line-height: 1.75; color: var(--text-soft); }
.ob-verdict-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding-top: 12px; border-top: 1px dashed rgba(0, 0, 0, .1); font-size: 13px; }
.ob-stat { color: var(--text-soft); }
.ob-copy { margin-left: auto; padding: 6px 12px; font: 650 12px var(--font); color: var(--ob-good); background: #fff; border: 1px solid #b9dfc8; border-radius: 8px; cursor: pointer; }
.ob-copy:hover { background: #f1f9f4; }

.ob-meter { height: 6px; border-radius: 999px; background: var(--ob-track); overflow: hidden; }
.ob-meter i, .ob-progress i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: inherit; transition: width .3s ease; }
.ob-progress { height: 2px; margin-top: -1px; background: transparent; }
.ob-progress[hidden] { display: none; }
.ob-progress-text { font: 600 12px var(--ob-mono); color: var(--text-soft); }

.ob-spinner { width: 18px; height: 18px; border: 2px solid var(--ob-track); border-top-color: var(--brand); border-radius: 50%; animation: ob-spin .8s linear infinite; }
@keyframes ob-spin { to { transform: rotate(360deg); } }

.ob-picker { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fafbfa; display: grid; gap: 10px; }
.ob-picker-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; }
.ob-picker-head > * { white-space: nowrap; }
.ob-picker-head strong { color: var(--text-main); }
.ob-picker-head span { color: var(--text-soft); }
.ob-picker-note { margin-left: auto; font-size: 12px; color: var(--ob-slow); }
.ob-picker-note:empty { display: none; }
.ob-picker-note + .ob-reset { margin-left: 0; }
.ob-reset { margin-left: auto; padding: 0; border: 0; background: none; font: 600 12px var(--font); color: var(--brand); cursor: pointer; }
.ob-reset:disabled { color: var(--text-soft); cursor: not-allowed; }
.ob-packs { display: flex; flex-wrap: wrap; gap: 8px; }
.ob-pack { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font: 500 13px var(--font); color: var(--text-soft); background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: border-color .16s, color .16s, background .16s; }
.ob-pack:hover:not(:disabled) { border-color: var(--brand); }
.ob-pack.on { color: var(--ipkk-accent-deep); background: var(--ipkk-accent-soft); border-color: #9fd1b2; font-weight: 600; }
.ob-pack:disabled { cursor: not-allowed; opacity: .7; }
.ob-pack-n { font-size: 12px; opacity: .7; }
.ob-custom-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ob-custom-list:empty { display: none; }
.ob-custom-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; font: 13px var(--ob-mono); color: var(--text-main); background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.ob-custom-chip button { width: 22px; height: 22px; border: 0; border-radius: 6px; background: none; color: var(--text-soft); font-size: 15px; cursor: pointer; }
.ob-custom-chip button:hover:not(:disabled) { background: #f1f2f1; color: var(--ob-bad); }
.ob-add { display: flex; gap: 8px; }
.ob-add input { width: 240px; max-width: 100%; min-width: 0; padding: 7px 10px; font: 13px var(--ob-mono); color: var(--text-main); background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.ob-add input:focus { outline: none; border-color: var(--brand); }
.ob-add button { padding: 0 14px; font: 600 13px var(--font); color: #fff; background: var(--brand); border: 0; border-radius: 8px; cursor: pointer; }
.ob-add button:disabled { opacity: .55; cursor: not-allowed; }
.ob-picker-msg { font-size: 12px; color: var(--ob-slow); min-height: 0; }
.ob-picker-msg:empty { display: none; }

.ob-table-wrap { overflow-x: auto; }
.ob-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.ob-col-site { width: 25%; }
.ob-col-latency { width: 21%; }
.ob-col-addr { width: 39%; }
.ob-col-family { width: 15%; }
.ob-row:hover td, .ob-row.is-open td { background: #fafbfa; }
.ob-table th { padding: 10px 12px; text-align: left; font-weight: 600; font-size: 12px; color: var(--text-soft); background: #f7f8f7; border-bottom: 1px solid var(--line); white-space: nowrap; }
/* Column help: a question mark beside the heading; hovering or focusing the heading shows the bubble. */
.ob-th { position: relative; display: inline-flex; align-items: center; gap: 4px; cursor: help; outline: none; }
.ob-th-icon { width: 14px; height: 14px; color: #9aa19d; transition: color .16s; }
.ob-th:hover .ob-th-icon, .ob-th:focus-visible .ob-th-icon { color: var(--brand); }
.ob-th:focus-visible { border-radius: 4px; box-shadow: 0 0 0 2px var(--brand); }
.ob-tip { position: absolute; top: calc(100% + 10px); left: -10px; z-index: 20; width: 300px; padding: 10px 12px; font: 400 12px/1.75 var(--font); color: #f3f5f4; text-align: left; white-space: normal; background: #222823; border-radius: 10px; box-shadow: 0 10px 28px rgb(16 24 20 / 22%); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .16s ease, transform .16s ease, visibility .16s; pointer-events: none; }
.ob-tip::before { content: ""; position: absolute; top: -5px; left: 18px; width: 10px; height: 10px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.ob-table th:last-child .ob-tip { left: auto; right: -10px; }
.ob-table th:last-child .ob-tip::before { left: auto; right: 18px; }
.ob-th:hover .ob-tip, .ob-th:focus-visible .ob-tip { opacity: 1; visibility: visible; transform: none; }
.ob-table td { padding: 10px 12px; border-bottom: 1px solid #f0f1f0; vertical-align: middle; }
.ob-group td { padding: 12px; background: #fff; border-bottom: 1px solid var(--line); }
.ob-group-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ob-group-label svg { width: 16px; height: 16px; }
.ob-group-label b { font-weight: 700; margin-right: 4px; }
.ob-group.kind-direct .ob-group-label { color: var(--ob-good); }
.ob-group.kind-proxy .ob-group-label { color: #1d4ed8; }
.ob-group.kind-pending .ob-group-label, .ob-group.kind-unassigned .ob-group-label { color: var(--text-soft); }
.ob-group-label .ob-ip { color: var(--text-main); }
.ob-site { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ob-site a { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); font-weight: 600; text-decoration: none; white-space: nowrap; }
.ob-site a:hover { color: var(--brand); }
.ob-site-icon { flex-shrink: 0; width: 18px; height: 18px; border-radius: 4px; object-fit: contain; }
.ob-letter { display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--text-soft); background: #eef0ef; }
svg.ob-site-icon { color: #111; }
.ob-icon-slot { background: #eef0ef; }
.ob-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ob-tag { flex-shrink: 0; padding: 0 5px; font-size: 11px; line-height: 18px; color: var(--text-soft); background: #f1f2f1; border-radius: 4px; }
.ob-latency { white-space: nowrap; }
.ob-bars { display: inline-flex; gap: 2px; vertical-align: middle; }
.ob-bars i { width: 5px; height: 12px; border-radius: 1px; background: var(--ob-track); }
.ob-bars.tone-good i.on { background: var(--ob-good); }
.ob-bars.tone-slow i.on { background: var(--ob-slow); }
.ob-bars.tone-bad i.on { background: var(--ob-bad); }
.ob-bars.tone-pending i { animation: ob-pulse 1.2s ease-in-out infinite; }
.ob-bars.tone-pending i:nth-child(2n) { animation-delay: .2s; }
@keyframes ob-pulse { 50% { background: #cfd5d1; } }
.ob-ms { display: inline-block; min-width: 56px; margin-left: 8px; font: 600 12px var(--ob-mono); vertical-align: middle; }
.ob-ms.tone-good { color: var(--ob-good); }
.ob-ms.tone-slow { color: var(--ob-slow); }
.ob-ms.tone-bad { color: var(--ob-bad); }
.ob-ms.tone-pending, .ob-ms.tone-idle { color: var(--text-soft); font-family: var(--font); font-weight: 400; }
.ob-dns { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; cursor: help; }
.ob-dns .ob-ip { font-weight: 500; }
.ob-more { padding: 0 6px; font: 12px var(--font); line-height: 18px; color: var(--text-soft); background: #f1f2f1; border: 0; border-radius: 4px; cursor: pointer; }
.ob-more:hover, .ob-more[aria-expanded="true"] { color: var(--brand); background: var(--ipkk-accent-soft); }
.ob-more:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ob-records { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 8px; padding: 8px 10px; font: 12px/1.7 var(--ob-mono); color: var(--text-main); background: #f7f8f7; border-radius: 6px; overflow-wrap: anywhere; }
.ob-records-src { flex-basis: 100%; font-family: var(--font); color: var(--text-soft); }
.ob-row.is-open td { vertical-align: top; }
.ob-family { color: var(--text-soft); white-space: nowrap; }
.ob-empty { padding: 28px 12px; text-align: center; color: var(--text-soft); }

@media (prefers-reduced-motion: reduce) {
  .ob-spinner, .ob-recheck:disabled svg, .ob-bars.tone-pending i { animation: none; }
  .ob-tip { transition: none; }
}

@media (max-width: 640px) {
  .ob-body { padding: 18px; }
  .ob-copy { margin-left: 0; }
  .ob-exit-card { padding: 14px; }
  .ob-exit-addr { font-size: 17px; }
  .ob-exit-facts { gap: 10px 24px; }
  .ob-add input { flex: 1; width: auto; }
  /* 窄屏把每一行排成两行：站点与延迟在上，解析地址与地址族在下。 */
  .ob-table thead { display: none; }
  .ob-table, .ob-table tbody { display: block; }
  .ob-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 10px 2px; border-bottom: 1px solid #f0f1f0; }
  .ob-row td { padding: 0; border: 0; }
  .ob-row .ob-addr { min-width: 0; font-size: 12px; }
  .ob-row .ob-family { text-align: right; font-size: 12px; }
  .ob-row.is-open .ob-addr { grid-column: 1 / -1; }
  .ob-picker-note { order: 9; flex-basis: 100%; margin-left: 0; }
  .ob-picker-note + .ob-reset { margin-left: auto; }
  .ob-group { display: block; }
  .ob-group td { display: block; padding: 12px 2px; }
}
