:root {
  color-scheme: light dark;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-soft: #f2f4f7;
  --text: #1f2937;
  --muted: #667085;
  --border: #d9dee7;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-fg: #ffffff;
  --warn-bg: #fff3d0;
  --warn-fg: #7a4b00;
  --error: #b42318;
  --green: #12805c;
  --cyan: #087a8f;
  --orange: #b85c00;
  --red: #c52828;
  --purple: #6841c6;
  --shadow: 0 20px 60px rgba(17, 24, 39, 0.08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --surface: #171c22;
    --surface-soft: #202730;
    --text: #edf1f5;
    --muted: #9aa6b2;
    --border: #313a46;
    --accent: #6ea8fe;
    --accent-strong: #9ec5fe;
    --accent-fg: #07111f;
    --warn-bg: #3f2e09;
    --warn-fg: #ffd66b;
    --error: #ff8a7a;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: 28px;
}

.site-header {
  display: flex;
  width: min(1280px, 100%);
  margin: 0 auto 18px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

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

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

h1 {
  font-size: 36px;
  line-height: 1.08;
  letter-spacing: 0;
}

.lead {
  max-width: 720px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.header-actions,
.input-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--accent);
  color: var(--accent-fg);
}

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

.button-secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.button-ghost {
  background: transparent;
  color: var(--muted);
}

main {
  flex: 1;
}

.workspace {
  display: grid;
  width: min(1280px, 100%);
  min-height: 68vh;
  margin: 0 auto;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.2fr);
  gap: 16px;
}

.input-panel,
.result-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-panel {
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.result-panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 16px;
  line-height: 1.3;
}

.shortcut,
.summary {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

#input {
  flex: 1;
  width: 100%;
  min-height: 520px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  padding: 14px;
}

#input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 38%, transparent);
  outline-offset: 2px;
}

.input-actions {
  min-height: 44px;
  margin-top: 12px;
}

.message {
  color: var(--muted);
  font-size: 13px;
}

.message.error {
  color: var(--error);
}

.warn {
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  padding: 10px 12px;
  font-size: 13px;
}

.output {
  min-height: 520px;
}

.empty-state {
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.titlebox {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.reqline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.method {
  border-radius: 6px;
  padding: 3px 9px;
  color: #fff;
  background: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.m-GET {
  background: #2563eb;
}

.m-POST {
  background: var(--green);
}

.m-PUT {
  background: var(--orange);
}

.m-DELETE {
  background: var(--red);
}

.m-PATCH {
  background: var(--purple);
}

.tag {
  color: var(--muted);
  font-size: 13px;
}

.url {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  margin-bottom: 14px;
}

.panel > h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.kvwrap {
  margin-top: 14px;
}

.kvwrap > h4,
.body-head h4 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.kv {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
  gap: 4px 16px;
  margin-top: 8px;
  font-size: 12.5px;
}

.kv .k {
  color: var(--muted);
  font-family: var(--mono);
}

.kv .v {
  min-width: 0;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 6px;
  font-size: 12.5px;
}

.meta-row {
  display: flex;
  min-width: 0;
  gap: 6px;
}

.meta-k {
  color: var(--muted);
}

.meta-v {
  min-width: 0;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.badge {
  border-radius: 6px;
  padding: 3px 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.code-2xx {
  background: var(--green);
}

.code-3xx {
  background: var(--cyan);
}

.code-err {
  background: var(--red);
}

.metric {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.body-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.copy {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

pre[class*='language-'],
pre.raw {
  margin: 8px 0 0;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
}

pre[class*='language-'] {
  padding: 14px;
  overflow-x: auto;
}

pre.raw {
  overflow-x: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.note.error {
  color: var(--error);
}

.muted-line {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.site-footer {
  display: flex;
  width: min(1280px, 100%);
  margin: 18px auto 0;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

@media (max-width: 900px) {
  .app-shell {
    padding: 18px;
  }

  .site-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

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

  #input,
  .output {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  h1 {
    font-size: 30px;
  }

  .lead {
    font-size: 14px;
  }

  .header-actions,
  .input-actions,
  .panel-head,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .shortcut,
  .summary {
    white-space: normal;
  }

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