:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --text: #172026;
  --muted: #62707b;
  --line: #d9e0e5;
  --accent: #13795b;
  --accent-strong: #0d5f47;
  --success-bg: #eefaf4;
  --success-line: #b9e4cf;
  --warning: #a15c07;
  --danger: #b42318;
  --danger-bg: #fff4f2;
  --neutral-bg: #f7f9fa;
  --code: #111827;
  --code-bg: #eef2f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.tool-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.title-actions {
  align-items: center;
  display: flex;
  flex: none;
  gap: 8px;
}

.github-link {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  padding: 0;
  width: 36px;
}

.github-link:hover {
  border-color: #aab6bf;
}

.github-link img {
  display: block;
  height: 20px;
  width: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.mode-pill {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
}

.mode-pill.loading {
  color: var(--warning);
  border-color: #efc77f;
}

.mode-pill.success {
  color: var(--accent-strong);
  border-color: #9bd1bf;
}

.mode-pill.error {
  color: var(--danger);
  border-color: #f0a29a;
}

.form {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(19, 121, 91, 0.18);
  border-color: var(--accent);
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
}

button {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.primary {
  background: var(--accent);
  color: #fff;
  font-weight: 650;
}

.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.secondary:hover:not(:disabled) {
  border-color: #aab6bf;
}

.compact {
  min-height: 38px;
  padding: 0 10px;
}

.empty-state {
  min-height: 280px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--text);
}

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

.result-status-line {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.result-status-line strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.validity-text {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.validity-text.tone-valid {
  color: var(--accent-strong);
}

.validity-text.tone-invalid {
  color: var(--danger);
}

.validity-text.tone-unknown {
  color: var(--muted);
}

.remaining-row {
  margin-bottom: 12px;
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
  background: #fff;
}

.metric.has-value {
  background: var(--success-bg);
  border-color: var(--success-line);
}

.metric.empty-value {
  background: #fff;
}

.metric.empty-value strong {
  color: var(--muted);
  font-weight: 600;
}

.metric.tone-valid {
  background: var(--success-bg);
  border-color: var(--accent);
}

.metric.tone-valid strong {
  color: var(--accent-strong);
}

.metric.tone-invalid {
  background: var(--danger-bg);
  border-color: #f0a29a;
}

.metric.tone-invalid strong {
  color: var(--danger);
}

.metric.tone-unknown {
  background: var(--neutral-bg);
  border-color: var(--line);
}

.metric.tone-unknown strong {
  color: var(--muted);
}

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

.metric strong {
  display: block;
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.featured-metric {
  padding: 16px;
}

.featured-metric strong {
  font-size: 28px;
}

.details-panel {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
}

.details-panel summary {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 15px;
  font-weight: 650;
  justify-content: space-between;
  list-style: none;
  min-height: 32px;
}

.details-panel summary::-webkit-details-marker {
  display: none;
}

.details-panel summary::after {
  color: var(--muted);
  content: "展开";
  font-size: 13px;
  font-weight: 500;
}

.details-panel[open] summary::after {
  content: "收起";
}

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

.detail-metric strong {
  font-size: 16px;
}

.json-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

pre {
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

@media (max-width: 840px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 20px 0;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1120px);
  }

  .tool-panel,
  .result-panel {
    padding: 16px;
  }

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

  .title-actions {
    justify-content: space-between;
    width: 100%;
  }

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

  .compact-summary-grid {
    grid-template-columns: 1fr;
  }

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