:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef5f2;
  --text: #17202a;
  --muted: #637083;
  --line: #d9e1e8;
  --accent: #127c72;
  --accent-2: #2256a5;
  --danger: #c43d3d;
  --warn: #a86500;
  --ok: #147a42;
  --shadow: 0 18px 42px rgba(20, 34, 55, 0.1);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 13px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

button.danger:hover {
  filter: brightness(0.96);
  color: #fff;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  min-height: 180px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(18, 124, 114, 0.12), rgba(34, 86, 165, 0.1)),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 17px;
}

.intro {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.privacy {
  flex: 0 0 auto;
  border: 1px solid rgba(18, 124, 114, 0.28);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--accent);
  font-weight: 700;
}

.workspace,
.results,
.summary-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.workspace,
.results {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.results {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr) minmax(280px, 0.85fr);
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(20, 34, 55, 0.06);
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head.compact {
  align-items: center;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

textarea {
  display: block;
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 0;
  padding: 16px;
  outline: none;
  color: #18212d;
  background: #fbfcfd;
  font-family: Consolas, "SFMono-Regular", "Microsoft YaHei UI", monospace;
  font-size: 13px;
  line-height: 1.55;
  tab-size: 2;
}

.output-area textarea {
  min-height: 260px;
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 30px;
  color: var(--accent-2);
}

.metric.warning strong {
  color: var(--warn);
}

.issues,
.tag-list,
.logs {
  min-height: 280px;
  max-height: 460px;
  overflow: auto;
  padding: 14px 16px 16px;
}

.empty {
  color: var(--muted);
}

.issue {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.issue:last-child {
  border-bottom: 0;
}

.badge {
  align-self: start;
  text-align: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--accent);
}

.badge.warn {
  background: #fff2da;
  color: var(--warn);
}

.badge.error {
  background: #ffe8e8;
  color: var(--danger);
}

.issue p {
  margin: 0;
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.search-row input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  outline: none;
}

.search-row input:focus {
  border-color: var(--accent);
}

.search-row span {
  color: var(--muted);
  font-size: 13px;
}

.tag-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}

.tag-row:last-child {
  border-bottom: 0;
}

.tag-row input {
  width: 18px;
  height: 18px;
}

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

.tag-main strong {
  display: grid;
  gap: 4px;
  overflow-wrap: anywhere;
}

.tag-main code {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #d7e4df;
  border-radius: 6px;
  background: #f3faf7;
  color: #123d37;
  padding: 3px 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.endpoint-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.test-one {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.tag-main code.ok {
  border-color: #b7dfc7;
  background: #effaf3;
  color: var(--ok);
}

.tag-main code.bad {
  border-color: #f0c2c2;
  background: #fff1f1;
  color: var(--danger);
}

.tag-main code.testing {
  border-color: #efd59d;
  background: #fff8e8;
  color: var(--warn);
}

.tag-main code em {
  display: inline-block;
  font-style: normal;
  font-weight: 700;
}

.log-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.log-item:last-child {
  border-bottom: 0;
}

.log-item strong {
  display: block;
  margin-bottom: 4px;
}

.log-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.tag-main span,
.tag-meta {
  color: var(--muted);
  font-size: 12px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: #17202a;
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 980px) {
  .workspace,
  .results,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 10px;
  }

  .hero,
  .panel-head {
    padding: 14px;
  }

  .panel-head,
  .search-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .panel-head button,
  .actions button {
    width: 100%;
  }

  textarea {
    min-height: 260px;
  }

  .issue {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
