:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --border: #dbe3ee;
  --accent: #1565c0;
  --accent-dark: #0d47a1;
  --warning-bg: #fff7ed;
  --warning-text: #9a3412;
  --ok-bg: #ecfdf3;
  --ok-text: #027a48;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

#startButton {
  min-width: 120px;
  height: 42px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
}

#startButton:hover {
  background: var(--accent-dark);
}

.endpoint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

code {
  display: block;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#copyButton {
  min-width: 72px;
  height: 34px;
  background: #e8f1fb;
  color: var(--accent-dark);
  font-weight: 650;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  min-height: 620px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.request-list {
  border-right: 1px solid var(--border);
  background: var(--panel-strong);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-size: 16px;
}

#requestCount {
  min-width: 30px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.empty {
  padding: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.detail-empty {
  display: grid;
  min-height: 100%;
  place-items: center;
  text-align: center;
}

.request-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  text-align: left;
}

.request-item:hover,
.request-item.active {
  background: #eaf2fb;
}

.request-main {
  min-width: 0;
}

.request-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.request-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  align-self: start;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.badge.suspected_proxy,
.badge.suspicious {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge.no_obvious_proxy {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.details {
  min-width: 0;
  padding: 22px;
}

.detail-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.detail-title h2 {
  font-size: 22px;
  line-height: 1.25;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric,
.block {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.metric {
  padding: 13px;
}

.metric span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.block {
  margin-top: 14px;
  overflow: hidden;
}

.block h3 {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-strong);
  font-size: 14px;
}

.kv {
  margin: 0;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr;
  gap: 8px 12px;
  font-size: 13px;
}

.kv dt {
  color: var(--muted);
  font-weight: 700;
}

.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.signal-list {
  margin: 0;
  padding: 12px 14px 12px 32px;
  line-height: 1.55;
}

pre {
  margin: 0;
  padding: 14px;
  overflow: auto;
  max-height: 260px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 20px, 680px);
    margin: 16px auto;
  }

  .topbar,
  .endpoint {
    align-items: stretch;
    flex-direction: column;
  }

  #startButton,
  #copyButton {
    width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .request-list {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .details {
    padding: 16px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .kv {
    grid-template-columns: 1fr;
  }
}
