:root {
  --bg: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #e535ab;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { color: var(--ink); background: var(--bg); }
code, pre { font-family: "SF Mono", Menlo, Consolas, monospace; }

#app { height: 100vh; display: flex; flex-direction: column; }

/* --- header (same shape as every other demo) ----------------------------- */
.page-head {
  flex: none;
  background: #fff;
  border-bottom: 3px solid var(--ink);
  padding: 14px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.page-explain { margin: 0; max-width: 900px; font-size: 15px; line-height: 1.5; }
.page-explain em { font-style: normal; font-weight: 600; }
.page-explain code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.page-controls {
  flex: none;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.back {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.back:hover { background: var(--bg); }
.play {
  background: transparent;
  color: #0284c7;
  border: 1px solid #0284c7;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.play.active { background: #0284c7; color: #fff; }

/* --- two panes side by side: what you want (light) | the wire (dark) ------------ */
.split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
}
.pane { padding: 18px 22px; overflow: auto; }
.pane-wire { background: #0f172a; color: #e2e8f0; }
.pane-ask { background: #fff; border-right: 3px solid var(--ink); }

.pane-label { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.badge {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge-app { color: var(--ink); padding: 0; white-space: normal; font-size: 15px; }
.badge-api { background: var(--accent); color: #fff; }
.pane-sub { color: var(--muted); font-size: 13px; }
.pane-wire .pane-sub { color: #94a3b8; }
/* What you want: the hint goes under the badge, so the narrow left pane keeps its width for the fields. */
.read .pane-ask .pane-label { flex-direction: column; align-items: flex-start; gap: 4px; }

/* --- the field picker ---------------------------------------------------- */
.fields { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 6px; }
.fields ul { list-style: none; margin: 4px 0 0 18px; padding: 0; display: grid; gap: 6px; }
.group-name { font-family: "SF Mono", Menlo, Consolas, monospace; font-weight: 700; color: var(--muted); }
.field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.field.on { background: #fdf2f8; border-color: var(--accent); }
.field input { accent-color: var(--accent); margin: 0; }

/* --- the query and answer ------------------------------------------------ */
.code {
  margin: 0 0 18px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  overflow: auto;
}
.query { color: #f9a8d4; }
.answer { color: #fcd34d; }

/* --- read / change tabs -------------------------------------------------- */
.tabs { display: flex; gap: 8px; margin-top: 10px; }
.tab {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tab.current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* --- change mode: the server's shelf ------------------------------------- */
.shelf { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; min-height: 64px; }
.item {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  min-width: 130px;
  transition: box-shadow 0.15s, background 0.15s;
}
.item.glow { background: #fdf2f8; box-shadow: inset 0 0 0 3px var(--accent); }
.item { color: var(--ink); }
.item-id { font-size: 12px; color: var(--muted); font-family: "SF Mono", Menlo, Consolas, monospace; }
.item-id::before { content: "#"; }
.item-min { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; }
.reset {
  margin-bottom: 22px;
  background: transparent;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

/* --- change mode: the mutations ------------------------------------------ */
.mutations { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.mut {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.mut:hover:not(:disabled) { border-color: #64748b; }
.mut.current { border-color: var(--accent); background: #fdf2f8; }
.mut:disabled { cursor: default; }
.mut .code { margin: 0; font-size: 12px; }
.says { font-size: 15px; font-weight: 700; color: var(--ink); padding: 0 4px; }
.mut:disabled:not(.current) { opacity: 0.4; }

/* --- phone: the whole page scrolls -----------------------------------------
   Locked to the screen height, each pane would be a small scroll box. */
@media (max-width: 720px) {
  #app { height: auto; min-height: 100vh; }
  .page-head { flex-direction: column; }
  .page-controls { order: -1; flex-direction: row; justify-content: space-between; align-items: center; width: 100%; margin-left: 0; }
  .pane { overflow: visible; min-width: 0; }
  .split { grid-template-columns: 1fr; }
  .pane-ask { border-right: none; border-bottom: 3px solid var(--ink); }
  /* Ask for data stays side by side: the picker is narrow, and the query gets a
     readable width even past the screen edge; the section then scrolls sideways. */
  .split.read { grid-template-columns: max-content minmax(340px, 1fr); overflow-x: auto; }
  .read .pane { padding: 14px 10px; }
  .read .pane-ask { border-right: 3px solid var(--ink); border-bottom: none; }
  .read .pane-wire .pane-label { flex-direction: column; align-items: flex-start; gap: 4px; }
  .pane-ask .pane-label { flex-direction: column; align-items: flex-start; gap: 4px; }
  /* Ask what exists: one row of questions that scrolls sideways, instead of a tall stack. */
  /* Room for the asking tour to scroll the questions to the top even when the answer is short. */
  .pane.playing { min-height: 100vh; }
  .asks { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; margin: 0 -22px 18px; padding: 0 22px; scroll-padding-left: 22px; }
}
.badge-api { white-space: nowrap; }
