/* Agent Desk — Zero-Lore Institutional Dark Developer & MCP Playground */
:root {
  --bg: #070a0f;
  --surface: #0c1118;
  --surface-2: #111822;
  --surface-3: #161f2d;
  --border: #1e293b;
  --border-hi: #2d3e57;
  --text: #e6edf3;
  --muted: #93a4bc;
  --dim: #62738c;
  --accent: #2ee6a6;
  --accent-bg: rgba(46, 230, 166, 0.11);
  --cyan: #38bdf8;
  --cyan-bg: rgba(56, 189, 248, 0.12);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.12);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.12);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --radius: 10px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, a, input, select, textarea, [role="button"] {
  touch-action: manipulation;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  background:
    radial-gradient(920px 380px at 12% -8%, rgba(46, 230, 166, 0.08), transparent 62%),
    radial-gradient(760px 340px at 88% -10%, rgba(56, 189, 248, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 12.2px;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 10, 15, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent-bg);
  border: 1px solid rgba(46, 230, 166, 0.4);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
}

.brand-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: #fff;
}

.badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  color: var(--muted);
}

.badge-accent {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: rgba(46, 230, 166, 0.3);
}

.badge-cyan {
  color: var(--cyan);
  background: var(--cyan-bg);
  border-color: rgba(56, 189, 248, 0.3);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.top-nav a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.top-nav a:hover {
  color: #fff;
  text-decoration: none;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(46, 230, 166, 0.32);
  padding: 4px 10px;
  border-radius: 999px;
}

.live-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.ghost-link {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.ghost-link:hover {
  border-color: var(--border-hi);
  color: #fff;
  text-decoration: none;
}

/* Layout */
.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 22px 20px 44px;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 16px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.5vw, 31px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #fff;
}

.hero-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 650px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}

.metric-label {
  font-size: 10.5px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accent { color: var(--accent); }
.cyan { color: var(--cyan); }
.amber { color: var(--amber); }

/* Conventions strip */
.conventions-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.conv-item {
  background: linear-gradient(180deg, var(--surface) 0%, rgba(12, 17, 24, 0.72) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.conv-k {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.conv-v {
  font-size: 12.2px;
  color: #cbd5e1;
  line-height: 1.4;
}

/* Sections */
.section {
  margin-bottom: 28px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #fff;
}

.section-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Presets */
.preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.preset-btn:hover {
  border-color: var(--border-hi);
  color: #fff;
  background: var(--surface-2);
}

.preset-btn.active {
  color: #fff;
  border-color: rgba(46, 230, 166, 0.55);
  background: rgba(46, 230, 166, 0.08);
  box-shadow: 0 0 0 1px rgba(46, 230, 166, 0.18);
}

.m-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.m-get { background: var(--accent-bg); color: var(--accent); }
.m-post { background: var(--cyan-bg); color: var(--cyan); }
.m-del { background: var(--red-bg); color: var(--red); }

.mcp-subbar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.subbar-lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  margin-right: 4px;
}

.sub-chip {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
}

.sub-chip:hover { color: #fff; border-color: var(--border-hi); }
.sub-chip.active { color: var(--cyan); border-color: rgba(56, 189, 248, 0.5); background: var(--cyan-bg); }

/* Playground Grid */
.playground-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: stretch;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 24, 34, 0.65);
  flex-wrap: wrap;
}

.panel-title {
  font-weight: 600;
  font-size: 13.5px;
  color: #fff;
}

.panel-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.panel-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}

.url-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px 10px;
}

.select-method,
.select-channel {
  background: var(--surface-2);
  color: var(--accent);
  border: 1px solid var(--border-hi);
  border-radius: 7px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.select-channel {
  color: var(--text);
  font-weight: 500;
  max-width: 100%;
}

.input-mono {
  background: #080c12;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  min-width: 0;
  width: 100%;
}

.input-mono:focus,
.code-editor:focus,
.select-method:focus,
.select-channel:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(46, 230, 166, 0.15);
}

.url-input {
  flex: 1;
}

.headers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 14px 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field-lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.field-lbl .opt {
  color: var(--dim);
}

.body-wrap,
.curl-preview-wrap {
  padding: 0 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.curl-preview {
  margin: 0;
  padding: 11px 12px;
  flex: 1;
  min-height: 148px;
  background: #080c12;
  color: #a7f3d0;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
  overflow: auto;
}

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

.code-editor {
  width: 100%;
  min-height: 175px;
  resize: vertical;
  background: #080c12;
  color: #dbeafe;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12.2px;
  line-height: 1.5;
}

.panel-foot {
  margin-top: auto;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(17, 24, 34, 0.4);
}

.foot-note {
  font-size: 12px;
  color: var(--muted);
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #04130d;
  border: none;
  border-radius: 7px;
  padding: 8px 15px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.14s ease, transform 0.1s ease;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: 7px;
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--surface-3);
}

.mini-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.mini-btn:hover {
  color: #fff;
  border-color: var(--border-hi);
}

/* Response Panel */
.resp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--border-hi);
}

.status-pill.ok { color: var(--accent); background: var(--accent-bg); border-color: rgba(46, 230, 166, 0.4); }
.status-pill.warn { color: var(--amber); background: var(--amber-bg); border-color: rgba(251, 191, 36, 0.4); }
.status-pill.err { color: var(--red); background: var(--red-bg); border-color: rgba(248, 113, 113, 0.4); }

.latency-pill,
.header-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.header-pill {
  color: var(--cyan);
  background: var(--cyan-bg);
  padding: 2px 7px;
  border-radius: 5px;
}

.resp-headers-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 14px;
}

.resp-headers-bar.has-items {
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  background: #090d14;
}

.hdr-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
}

.hdr-chip strong { color: var(--accent); font-weight: 600; }

.json-view {
  margin: 0;
  padding: 13px 14px;
  flex: 1;
  min-height: 310px;
  max-height: 440px;
  overflow: auto;
  background: #06090e;
  font-family: var(--font-mono);
  font-size: 12.2px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.j-key { color: #7dd3fc; }
.j-str { color: #6ee7b7; }
.j-num { color: #fbbf24; }
.j-bool { color: #c084fc; }
.j-null { color: #94a3b8; }

.rate-pill-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.rate-lbl { color: var(--dim); }
.rate-val { color: var(--accent); font-weight: 700; }

/* MCP & SDK Split */
.split-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tab-bar {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 7px 11px 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn:hover { color: #fff; }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.snippet-meta {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid rgba(30, 41, 59, 0.65);
  background: #090d14;
}

.code-block {
  margin: 0;
  padding: 14px;
  background: #06090e;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: #dbeafe;
  flex: 1;
  max-height: 360px;
}

/* SSE Monitor */
.sse-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sse-log {
  min-height: 120px;
  max-height: 260px;
  overflow-y: auto;
  background: #06090e;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11.8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sse-empty {
  color: var(--dim);
  padding: 18px 4px;
  font-family: var(--font-sans);
  font-size: 13px;
}

.sse-entry {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--surface);
}

.sse-entry.diff { border-left-color: var(--cyan); }
.sse-entry.heartbeat { border-left-color: var(--dim); opacity: 0.8; }

.sse-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.sse-entry-body {
  color: #cbd5e1;
  word-break: break-word;
}

/* Reference */
.ref-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.4px;
}

.ref-table th,
.ref-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.7);
  vertical-align: middle;
}

.ref-table th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dim);
  background: #090d14;
}

.ref-table tr:last-child td { border-bottom: none; }

.scope-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--cyan);
}

.scope-tag.pub { color: var(--accent); background: var(--accent-bg); }
.scope-tag.warn { color: var(--amber); background: var(--amber-bg); }
.scope-tag.admin { color: var(--red); background: var(--red-bg); }

.builder-explainer {
  padding: 14px;
}

.builder-explainer h3 {
  margin: 0 0 8px;
  font-size: 14.5px;
  color: #fff;
}

.builder-explainer p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-chips code {
  padding: 4px 8px;
  font-size: 11.5px;
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 6px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px max(16px, env(safe-area-inset-bottom));
  color: var(--dim);
  font-size: 12px;
}

.footer-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-family: var(--font-mono);
}

.footer-links a {
  white-space: nowrap;
}

/* Toast */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  background: var(--surface-3);
  color: var(--accent);
  border: 1px solid rgba(46, 230, 166, 0.45);
  padding: 9px 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.45);
}

/* Responsive */
@media (max-width: 1020px) {
  .hero,
  .playground-grid,
  .split-2,
  .ref-grid {
    grid-template-columns: 1fr;
  }
  .conventions-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .top-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 12px 12px 32px;
  }
  .topbar-inner {
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .brand {
    gap: 6px;
    min-width: 0;
  }
  .brand-mark {
    width: 24px;
    height: 24px;
    font-size: 11.5px;
    flex-shrink: 0;
  }
  .brand-title {
    font-size: 13.5px;
    white-space: nowrap;
  }
  .brand .badge-cyan {
    display: none;
  }
  .brand .badge {
    font-size: 9.5px;
    padding: 1px 6px;
    white-space: nowrap;
  }
  .live-pill {
    font-size: 10px;
    padding: 3px 8px;
    white-space: nowrap;
  }
  .hero {
    gap: 12px;
    margin-bottom: 10px;
  }
  .eyebrow {
    font-size: 10px;
    margin-bottom: 4px;
  }
  .hero h1 {
    font-size: 21px;
    margin-bottom: 6px;
  }
  .hero-sub {
    font-size: 12.8px;
    line-height: 1.45;
  }
  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .metric-card {
    padding: 8px 10px;
  }
  .metric-value {
    font-size: 15.5px;
  }
  .conventions-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 16px;
  }
  .conv-item {
    padding: 8px 9px;
  }
  .conv-k {
    font-size: 9.5px;
  }
  .conv-v {
    font-size: 11px;
    line-height: 1.35;
  }
  .section {
    margin-bottom: 20px;
  }
  .section-head {
    margin-bottom: 9px;
  }
  .section-head h2 {
    font-size: 16.5px;
  }
  .section-sub {
    font-size: 12px;
  }
  .preset-bar {
    gap: 6px;
  }
  .preset-btn {
    padding: 5px 8px;
    font-size: 11px;
  }
  .headers-grid {
    grid-template-columns: 1fr;
  }
  .url-row {
    flex-wrap: wrap;
  }
  .url-row .btn-primary {
    width: 100%;
  }
  .top-links .ghost-link {
    display: none;
  }
  .sse-controls {
    width: 100%;
  }
  .select-channel {
    width: 100%;
  }
  /* Stacked mobile reference cards — zero clipped table columns on 390px! */
  .ref-table thead {
    display: none;
  }
  .ref-table,
  .ref-table tbody {
    display: block;
    width: 100%;
  }
  .ref-table tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 4px 8px;
    align-items: center;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.75);
  }
  .ref-table tr:last-child {
    border-bottom: none;
  }
  .ref-table td {
    padding: 0;
    border: none;
    min-width: 0;
  }
  .ref-table td:nth-child(2) {
    overflow-wrap: anywhere;
  }
  .ref-table td:nth-child(4) {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
    padding-top: 2px;
  }
}

/* Kill iOS Safari auto-zoom on touch/mobile form controls */
@media (max-width: 820px), (pointer: coarse) {
  input,
  textarea,
  select,
  .input-mono,
  .code-editor,
  .select-method,
  .select-channel {
    font-size: 16px !important;
  }
  .toast {
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
    max-width: calc(100vw - 24px);
  }
}
