:root {
  /* zresp と揃えた Claude 風の暖かいライトテーマ */
  --bg: #faf9f5;
  --card: #ffffff;
  --panel-2: #f3f1ea;
  --border: #e7e4da;
  --border-strong: #d9d5c8;
  --text: #2a2824;
  --muted: #79756c;
  --hint: #a39e93;
  --accent: #d97757;
  --accent-hover: #bd5d3a;
  --accent-soft: #f6e9e2;
  --ok: #3f7d4e;
  --warn: #b45309;
  --err: #bd3a3a;
  --code-bg: #f3f1ea;
  --row-hover: #faf5f1;
  --sans: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* zresp と共通のトップバー */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 249, 245, 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.topbar nav a { color: var(--muted); text-decoration: none; margin-left: 18px; font-size: .92rem; }
.topbar nav a:hover { color: var(--accent-hover); }
.topbar nav a.active { color: var(--accent-hover); font-weight: 600; }

.page-head { padding: 28px 24px 8px; max-width: 1280px; margin: 0 auto; }
.page-head h1 { margin: 0; font-size: 1.7rem; letter-spacing: -0.02em; }
.page-head .sub { margin: 8px 0 0; color: var(--muted); font-size: .92rem; max-width: 70ch; }

main {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  padding: 16px 24px 56px;
  max-width: 1280px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.card h2 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.card h3 { margin: 12px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.via-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}
.via-pill select {
  border: none;
  background: transparent;
  padding: 2px 4px;
  font-size: 11px;
  color: var(--text);
  font-family: inherit;
  font-weight: 500;
}
.via-pill select:focus { box-shadow: none; }
.via-status { font-size: 10px; color: var(--muted); margin-left: 4px; }
.via-status.ok { color: var(--ok); }
.via-status.err { color: var(--err); }

.builder { grid-column: 1; }
.presets { grid-column: 2; grid-row: 1 / span 2; }
.response { grid-column: 1 / span 2; }
.history { grid-column: 1 / span 2; }

.row { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-end; flex-wrap: wrap; }
.row[hidden] { display: none; }
.warn-note {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #e9c9a3;
  background: #fbf3e8;
  color: #92400e;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.5;
}
.row label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.row .grow { flex: 1; min-width: 200px; }
.row .hint { color: var(--hint); font-weight: normal; font-size: 11px; }

input, select, textarea {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 9px;
  font-family: var(--mono);
  font-size: 13px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.15);
}
textarea { resize: vertical; }

button {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
button:hover { background: var(--row-hover); border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.muted { color: var(--muted); }

.actions { gap: 12px; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 6px 12px;
  color: var(--muted);
}
.tabs button:hover { background: transparent; color: var(--text); border-color: transparent; }
.tabs button.active { color: var(--accent-hover); border-bottom-color: var(--accent); }

#presetList { list-style: none; padding: 0; margin: 0; max-height: 540px; overflow-y: auto; }
#presetList li {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  background: var(--card);
  transition: background 0.12s ease, border-color 0.12s ease;
}
#presetList li:hover { border-color: var(--accent); background: var(--accent-soft); }
#presetList .pname { font-weight: 600; font-size: 13px; }
#presetList .pnote { color: var(--muted); font-size: 11px; margin-top: 2px; }
#presetList .pmeta { font-family: var(--mono); font-size: 11px; color: var(--accent-hover); margin-top: 2px; }

.meta {
  font-family: var(--mono);
  font-size: 12px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 24px;
}
.meta .status-2 { color: var(--ok); font-weight: 600; }
.meta .status-3 { color: var(--warn); font-weight: 600; }
.meta .status-4 { color: var(--warn); font-weight: 600; }
.meta .status-5 { color: var(--err); font-weight: 600; }
.meta .status-0 { color: var(--err); font-weight: 600; }

.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.diff h3 { margin-top: 0; }

pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  margin: 0;
  max-height: 360px;
  overflow: auto;
  color: var(--text);
}

#resBody { max-height: 520px; }

#historyList { list-style: none; padding: 0; margin: 0; max-height: 280px; overflow-y: auto; }
#historyList li {
  display: flex;
  gap: 12px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  align-items: center;
}
#historyList li:hover { background: var(--row-hover); }
#historyList .hstatus { width: 40px; text-align: center; font-weight: 600; }
#historyList .hstatus.status-2 { color: var(--ok); }
#historyList .hstatus.status-3, #historyList .hstatus.status-4 { color: var(--warn); }
#historyList .hstatus.status-5, #historyList .hstatus.status-0 { color: var(--err); }
#historyList .hmethod { width: 60px; color: var(--accent-hover); font-weight: 600; }
#historyList .hurl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
#historyList .htime { color: var(--muted); width: 70px; text-align: right; }
#historyList .hdur { color: var(--muted); width: 60px; text-align: right; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .builder, .presets, .response, .history { grid-column: 1; grid-row: auto; }
  .diff { grid-template-columns: 1fr; }
}
