:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #d9e2ef;
  --text: #172033;
  --muted: #68758a;
  --blue: #2563eb;
  --blue-strong: #1d4ed8;
  --blue-bg: #dbeafe;
  --green: #15803d;
  --green-bg: #dcfce7;
  --yellow: #a16207;
  --yellow-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --gray: #64748b;
  --gray-bg: #e2e8f0;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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;
  line-height: 1.5;
}

code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #eef2ff;
  color: #1e3a8a;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

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

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.page-shell {
  display: grid;
  gap: 12px;
  padding: 12px 0 32px;
}

.section,
.preview-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section {
  padding: 20px;
}

.overview-title,
.section-title,
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.overview-title {
  min-width: 0;
}

/* 标题和时间是一组，一起靠左；右边那排状态胶囊和按钮由
   .overview-title 的 space-between 推到另一头。
   窄屏上允许换行：手机上「标题 + 时间」两样并排放不下时，
   宁可折成两行，也不要把时间挤成竖排一个字一个字。 */
.overview-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
}

.section-title {
  margin-bottom: 16px;
}

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.time-chip {
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.info-grid,
.check-grid {
  display: grid;
  gap: 12px;
}

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

.overview-section {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.overview-row {
  min-width: 0;
}

.target-section {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.env-section {
  padding: 0;
}

.overview-title h2,
.env-section h2 {
  font-size: 16px;
  line-height: 1.25;
}

.env-section .status-pill {
  min-height: 22px;
  padding: 2px 8px;
  font-size: 12px;
}

.env-section .info-grid {
  grid-template-columns: minmax(220px, 1.35fr) repeat(2, minmax(130px, 0.8fr));
  gap: 6px;
}

.env-section .info-card {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  border-color: #e4eaf3;
  padding: 6px 8px;
}

.info-icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--blue);
}

.info-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.info-text {
  min-width: 0;
}

.env-section .info-label {
  flex: 0 0 auto;
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.2;
}

.env-section .info-value {
  min-width: 0;
  min-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
}

.check-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.info-card,
.check-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.check-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 8px;
}

.check-card .check-label,
.check-card .check-meta {
  grid-column: 1 / -1;
}

.info-label,
.check-label,
.target-url span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.info-value,
.check-value {
  min-height: 20px;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 650;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.status-ok {
  background: var(--green-bg);
  color: var(--green);
}

.status-info {
  background: var(--blue-bg);
  color: var(--blue-strong);
}

.status-warning {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.status-error {
  background: var(--red-bg);
  color: var(--red);
}

.status-muted {
  background: var(--gray-bg);
  color: var(--gray);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.button-primary {
  background: var(--blue);
  color: #fff;
}

.button-primary:hover {
  background: var(--blue-strong);
}

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

.button-secondary:hover {
  border-color: #93b4ef;
  background: #eff6ff;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty-state {
  border: 1px dashed #b8c4d6;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 22px;
}

.target-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 92px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--blue-strong);
}

.loading-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
  }

  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.target-panel {
  display: grid;
  gap: 12px;
}

.target-url {
  min-width: 0;
}

.target-url strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.target-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.target-copy-row strong {
  min-width: 0;
}

.copy-button {
  flex: 0 0 auto;
  min-height: 26px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 3px 8px;
  background: #eff6ff;
  color: var(--blue-strong);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.copy-button:hover {
  background: #dbeafe;
}

.preview-block {
  padding: 12px;
  box-shadow: none;
}

.preview-header {
  align-items: flex-start;
  margin-bottom: 12px;
}

.preview-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.preview-header p,
.notice {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.iframe-wrap {
  position: relative;
  width: 100%;
  height: min(500px, 54vh);
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f1f5f9;
}

iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.notice {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--yellow-bg);
  color: var(--yellow);
}

@media (max-width: 900px) {
  .info-grid,
  .check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .env-section .info-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .section-title,
  .preview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-shell {
    width: min(100% - 20px, 1180px);
  }

  .page-shell {
    padding-top: 10px;
  }

  .section {
    padding: 12px;
  }

  .overview-section {
    gap: 10px;
    padding: 12px;
  }

  .target-section {
    padding-top: 10px;
  }

  .section-title {
    gap: 8px;
    margin-bottom: 10px;
  }

  .overview-title {
    align-items: center;
    gap: 8px;
  }

  .section-title h2 {
    font-size: 17px;
  }

  .env-section {
    padding: 0;
  }

  .overview-title,
  .overview-section .section-title,
  .env-section .section-title {
    align-items: center;
    flex-direction: row;
  }

  .overview-title h2 {
    flex: 0 0 auto;
    font-size: 16px;
  }

  .overview-title .section-actions {
    min-width: 0;
    gap: 5px;
  }

  .time-chip {
    font-size: 11px;
  }

  .overview-title .status-pill {
    min-height: 22px;
    padding: 2px 6px;
    font-size: 11px;
  }

  .client-pill {
    display: none;
  }

  .target-loading {
    min-height: 78px;
    font-size: 14px;
  }

  .info-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .env-section .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .env-section .info-card:first-child {
    grid-column: 1 / -1;
  }

  .env-section .info-card {
    min-height: 28px;
    padding: 5px 7px;
  }

  .info-icon {
    width: 18px;
    height: 18px;
  }

  .button-group {
    width: 100%;
  }

  .target-panel {
    gap: 8px;
  }

  .target-url span,
  .check-label {
    margin-bottom: 3px;
    font-size: 12px;
  }

  .target-url strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }

  .copy-button {
    min-height: 24px;
    padding: 2px 7px;
    font-size: 11px;
  }

  .target-url {
    margin-top: 6px;
  }

  .preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .button-group {
    width: auto;
    display: grid;
    grid-template-columns: repeat(2, 82px);
    gap: 6px;
  }

  .button-group .button {
    width: 100%;
    min-height: 32px;
    padding: 5px 6px;
    font-size: 12px;
  }

  .check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
  }

  .check-card {
    min-height: 76px;
    gap: 3px 6px;
    padding: 6px 7px;
  }

  .check-card .status-pill {
    min-height: 20px;
    padding: 1px 6px;
    font-size: 11px;
  }

  .check-value {
    min-height: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  .check-meta {
    display: none;
  }

  .preview-block {
    padding: 10px;
  }

  .preview-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 8px;
  }

  .preview-header h3 {
    margin-bottom: 0;
    font-size: 15px;
  }

  .preview-header p,
  .notice {
    display: none;
  }

  .iframe-wrap {
    height: 360px;
    min-height: 0;
  }
}

@media (max-width: 380px) {
  .check-grid {
    grid-template-columns: 1fr;
  }

  .button-group {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .iframe-wrap {
    height: 320px;
  }
}
