:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --ok: #34c759;
  --warn: #ff9f0a;
  --danger: #ff3b30;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.banner {
  background: #1d1d1f;
  color: #f5f5f7;
  padding: 10px 20px;
  font-size: 13px;
  text-align: center;
}
.banner.native { background: #0a7a2f; }
.banner code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(255,255,255,0.12);
  padding: 1px 6px;
  border-radius: 4px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

header.hero {
  margin-bottom: 28px;
}
header.hero h1 {
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}
header.hero p.lede {
  color: var(--muted);
  margin: 0;
  max-width: 42em;
  font-size: 16px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.card h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

.rooms {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.room {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fafafa;
}
.room.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.room .name { font-weight: 600; }
.room .meta { color: var(--muted); font-size: 13px; }
.room .price { font-variant-numeric: tabular-nums; font-weight: 600; }

.draft-fields {
  display: grid;
  gap: 10px;
}
.draft-fields label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.draft-fields input, .draft-fields textarea, .draft-fields select,
.panel input, .panel textarea, .panel select {
  font: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.draft-fields textarea { min-height: 64px; resize: vertical; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #f0f0f2;
  color: var(--muted);
}
.status-pill.confirmed {
  background: rgba(52, 199, 89, 0.15);
  color: #1b7a33;
}

.panel .tool-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 280px;
  overflow: auto;
}
.tool-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tool-item:hover { border-color: #c7c7cc; }
.tool-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.tool-item .t-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}
.tool-item .t-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.badge {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  background: #eeeef0;
  color: #555;
}
.badge.read { background: rgba(0,113,227,0.12); color: #005bb5; }
.badge.consequential { background: rgba(255,59,48,0.12); color: #c41e16; }
.badge.untrusted { background: rgba(255,159,10,0.18); color: #9a5b00; }
.badge.mutate { background: #f0f0f2; color: #555; }

.schema-box, .result-box, .code-block {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
  background: #1d1d1f;
  color: #f5f5f7;
  border-radius: 12px;
  padding: 12px 14px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
button, .btn {
  font: inherit;
  font-weight: 560;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 980px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
button.secondary {
  background: #e8e8ed;
  color: var(--ink);
}
button.danger {
  background: var(--danger);
  color: #fff;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.args-form {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}
.args-form label {
  display: grid;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
}

.lifecycle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.lifecycle strong { color: var(--ink); }

.refs {
  margin-top: 28px;
}
.refs ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 13px;
}
.refs li { margin: 4px 0; }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 20px;
}
.dialog {
  background: #fff;
  border-radius: 18px;
  padding: 22px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.dialog h3 { margin: 0 0 8px; font-size: 18px; }
.dialog p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.dialog .controls { justify-content: flex-end; }
.hidden { display: none !important; }

.types-section { margin-top: 20px; }
.types-section .code-block { max-height: 360px; }
