:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #f0f3f4;
  --text: #182025;
  --muted: #66737c;
  --border: #dce2e5;
  --border-strong: #c5ced3;
  --accent: #087b5b;
  --accent-hover: #066549;
  --link: #1267a5;
  --official-bg: #e8f2ff;
  --official-text: #195f98;
  --danger-bg: #fff0ef;
  --danger-text: #a5302a;
  --shadow: 0 16px 48px rgba(24, 32, 37, 0.18);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
button, input { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 42px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 9px);
  grid-template-rows: repeat(2, 9px);
  place-content: center;
  gap: 3px;
  border-radius: 7px;
  background: var(--accent);
}
.brand-mark span { width: 9px; height: 9px; border: 2px solid #ffffff; }
.brand-mark span:last-child { grid-column: 2; }
.brand-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.25; }
.brand-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}
.brand-copy small { color: var(--muted); font-size: 12px; }
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #9da8ae; }
.status.online .status-dot { background: #18a36f; box-shadow: 0 0 0 3px #dff5ec; }
.status.offline .status-dot { background: #c33d36; box-shadow: 0 0 0 3px #ffe4e1; }

.search-section {
  padding: 52px 28px 44px;
  color: #ffffff;
  background: #163d35;
  border-bottom: 4px solid #d79b2c;
}
.search-inner, .results-section { width: min(1120px, 100%); margin: 0 auto; }
.eyebrow { margin: 0 0 5px; color: #9bd7c5; font-size: 12px; font-weight: 700; }
h1 { margin-bottom: 22px; font-size: 32px; line-height: 1.2; }
.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  width: min(760px, 100%);
  gap: 10px;
}
.search-form input {
  width: 100%;
  height: 48px;
  min-width: 0;
  padding: 0 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #ffffff;
  border-radius: 7px;
  outline: none;
}
.search-form input:focus { border-color: #61d2b0; box-shadow: 0 0 0 3px rgba(97, 210, 176, 0.28); }
.primary-button, .secondary-button, .quick-searches button, .action-button, .icon-button {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 650;
}
.primary-button { color: #162118; background: #f3b541; border-color: #f3b541; }
.primary-button:hover { background: #ffc65b; }
.secondary-button {
  padding: 8px 14px;
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}
.secondary-button:hover:not(:disabled) { border-color: #8f9da5; background: var(--surface-muted); }
button:disabled { cursor: not-allowed; opacity: 0.5; }
.quick-searches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick-searches button {
  min-height: 30px;
  padding: 3px 11px;
  color: #d8eee7;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
  font-size: 13px;
  font-weight: 500;
}
.quick-searches button:hover { color: #ffffff; background: rgba(255, 255, 255, 0.15); }

.results-section { min-height: 420px; padding: 32px 28px 56px; }
.results-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}
.results-heading h2 { margin-bottom: 2px; font-size: 20px; }
.results-heading p, .source-label { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.results-list { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.result-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 15px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.result-row:last-child { border-bottom: 0; }
.result-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  background: #4b6874;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}
.result-main { min-width: 0; }
.result-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.result-name {
  padding: 0;
  color: var(--link);
  background: transparent;
  border: 0;
  font-size: 17px;
  font-weight: 720;
  text-align: left;
  overflow-wrap: anywhere;
}
.result-name:hover { text-decoration: underline; }
.official-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  color: var(--official-text);
  background: var(--official-bg);
  border: 1px solid #c9e1fa;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.result-description { margin: 5px 0 9px; color: #49565e; overflow-wrap: anywhere; }
.result-meta, .detail-metrics { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 13px; }
.result-actions { display: flex; align-items: center; gap: 8px; }
.action-button {
  min-width: 76px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}
.action-button:hover { background: var(--surface-muted); }
.action-button.copy { color: #ffffff; background: var(--accent); border-color: var(--accent); }
.action-button.copy:hover { background: var(--accent-hover); }
.notice {
  margin: 14px 0;
  padding: 14px 16px;
  color: var(--danger-text);
  background: var(--danger-bg);
  border: 1px solid #f1c7c3;
  border-radius: 6px;
}
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 22px; color: var(--muted); font-size: 13px; }

.skeleton-row { height: 112px; padding: 20px; border-bottom: 1px solid var(--border); }
.skeleton-row:last-child { border-bottom: 0; }
.skeleton-line {
  height: 12px;
  margin: 0 0 12px 60px;
  border-radius: 3px;
  background: #e8edef;
  animation: pulse 1.2s ease-in-out infinite alternate;
}
.skeleton-line:first-child { width: 28%; height: 16px; }
.skeleton-line:nth-child(2) { width: 62%; }
.skeleton-line:nth-child(3) { width: 42%; }
@keyframes pulse { to { opacity: 0.45; } }

.detail-dialog {
  width: min(820px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.detail-dialog::backdrop { background: rgba(16, 24, 28, 0.58); }
.dialog-shell { padding: 24px; }
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.dialog-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.dialog-title-line h2 { margin-bottom: 0; font-size: 22px; overflow-wrap: anywhere; }
.dialog-header p { margin: 7px 0 0; color: var(--muted); }
.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  color: #55636b;
  background: var(--surface);
  border-color: var(--border);
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}
.icon-button:hover { background: var(--surface-muted); }
.detail-metrics { padding: 16px 0; }
.dialog-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 4px; }
.dialog-section-heading h3 { margin-bottom: 10px; font-size: 16px; }
.dialog-section-heading span { color: var(--muted); font-size: 12px; }
.tag-list { border-top: 1px solid var(--border); }
.tag-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(110px, auto) auto;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.tag-name { min-width: 0; font-family: Consolas, "SFMono-Regular", monospace; font-weight: 700; overflow-wrap: anywhere; }
.tag-meta { color: var(--muted); font-size: 12px; text-align: right; }
.tag-row .action-button { min-width: 66px; }
.load-more { width: 100%; margin-top: 16px; }
.empty-state { padding: 54px 24px; color: var(--muted); text-align: center; }
.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100% - 40px));
  padding: 11px 14px;
  color: #ffffff;
  background: #263238;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(16, 24, 28, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .topbar { height: 62px; padding: 0 16px; }
  .brand-copy small { display: none; }
  .status-text { font-size: 0; }
  .status-text::after { content: "代理"; font-size: 13px; }
  .search-section { padding: 36px 18px 32px; }
  h1 { font-size: 28px; }
  .results-section { padding: 24px 14px 40px; }
  .source-label { display: none; }
  .result-row { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 16px; }
  .result-avatar { width: 40px; height: 40px; }
  .result-actions { grid-column: 2; justify-content: flex-start; }
  .action-button { min-width: 88px; }
  .dialog-shell { padding: 18px; }
  .tag-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tag-meta { grid-column: 1; grid-row: 2; text-align: left; }
  .tag-row .action-button { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 440px) {
  .search-form { grid-template-columns: minmax(0, 1fr); }
  .search-form .primary-button { width: 100%; }
  .quick-searches { max-height: 72px; overflow: hidden; }
  .result-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
