.playground {
  --playground-ink: #172033;
  --playground-muted: #667085;
  --playground-line: #d7dce5;
  --playground-soft: #f5f7fb;
  --playground-accent: #4f46e5;
  --playground-accent-dark: #3730a3;
  color: var(--playground-ink);
  margin: 0 auto;
  max-width: 1500px;
  padding-top: 1rem;
}

.playground * { box-sizing: border-box; }
.playground [hidden] { display: none !important; }

.playground__eyebrow,
.playground__step {
  color: var(--playground-accent);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .14em;
  margin: 0;
  text-transform: uppercase;
}

.playground__eyebrow { margin-bottom: .55rem; }

.playground__toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1rem;
  justify-content: space-between;
}

.playground__flow-switch {
  background: var(--playground-soft);
  border: 1px solid var(--playground-line);
  border-radius: .65rem;
  display: inline-flex;
  gap: .2rem;
  padding: .2rem;
}

.playground .playground__flow-switch button {
  background: transparent;
  border-color: transparent;
  color: var(--playground-muted);
  min-width: 7rem;
}

.playground .playground__flow-switch button:hover { background: #fff; }

.playground .playground__flow-switch button[aria-pressed="true"] {
  background: #fff;
  border-color: var(--playground-line);
  box-shadow: 0 1px 2px rgb(16 24 40 / 8%);
  color: var(--playground-accent-dark);
}

.playground__view-switch {
  background: var(--playground-soft);
  border: 1px solid var(--playground-line);
  border-radius: .5rem;
  display: inline-flex;
  gap: .15rem;
  padding: .15rem;
}

.playground .playground__view-switch button {
  background: transparent;
  border-color: transparent;
  color: var(--playground-muted);
  font-size: .72rem;
  padding: .3rem .5rem;
}

.playground .playground__view-switch button:hover { background: #fff; }

.playground .playground__view-switch button[aria-pressed="true"] {
  background: #fff;
  border-color: var(--playground-line);
  color: var(--playground-accent-dark);
}

.playground__flow-description {
  color: var(--playground-muted);
  font-size: .88rem;
  margin: .55rem 0 1rem;
}

.playground button {
  background: var(--playground-accent);
  border: 1px solid var(--playground-accent);
  border-radius: .45rem;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  padding: .65rem .9rem;
}

.playground button:hover { background: var(--playground-accent-dark); }
.playground button:focus-visible,
.playground input:focus-visible,
.playground select:focus-visible,
.playground textarea:focus-visible,
.playground summary:focus-visible {
  outline: 3px solid #a5b4fc;
  outline-offset: 2px;
}

.playground__status {
  color: var(--playground-muted);
  font-size: .9rem;
}

.playground__status[data-state="error"] { color: #b42318; }
.playground__status[data-state="success"] { color: #027a48; }

.playground__grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.playground__panel,
.playground__contracts {
  background: #fff;
  border: 1px solid var(--playground-line);
  border-radius: .8rem;
  min-width: 0;
}

.playground__panel { padding: 1rem; }

.playground__panel-heading {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin-bottom: .8rem;
  min-height: 3.1rem;
}

.playground__panel-heading h2 {
  font-size: 1.15rem;
  margin: .2rem 0 0;
}

.playground__title-line {
  align-items: baseline;
  display: flex;
  gap: .5rem;
}

.playground .playground__text-action {
  background: var(--playground-soft);
  border: 1px solid var(--playground-line);
  border-radius: .35rem;
  color: var(--playground-accent-dark);
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.2;
  padding: .18rem .4rem;
}

.playground .playground__text-action:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
  color: var(--playground-accent-dark);
}

.playground__panel-actions {
  align-items: center;
  display: flex;
  gap: .55rem;
}

.playground__panel-toggle {
  align-items: center;
  color: var(--playground-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: .72rem;
  gap: .3rem;
  white-space: nowrap;
}

.playground__panel-toggle input { margin: 0; }

.playground__panel-badge {
  background: var(--playground-soft);
  border-radius: 999px;
  color: var(--playground-muted);
  font-size: .72rem;
  padding: .25rem .5rem;
}

.playground__render-call {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

.playground__call-instance { color: #6941c6; }
.playground__call-method { color: #027a48; }
.playground__call-payload { color: #b54708; }
.playground__call-options { color: #175cd3; }
.playground__call-boolean.is-false { color: #b42318; }
.playground__call-boolean.is-true { color: #027a48; }

.playground textarea,
.playground select,
.playground input:not([type="checkbox"]):not([type="radio"]) {
  background: #fff;
  border: 1px solid var(--playground-line);
  border-radius: .45rem;
  color: var(--playground-ink);
  font: inherit;
  padding: .58rem .65rem;
  width: 100%;
}

.playground__code-editor {
  background: #111827;
  border: 1px solid #111827;
  border-radius: .45rem;
  min-height: 31rem;
  overflow: hidden;
  position: relative;
  resize: vertical;
}

.playground__code-editor[data-state="error"] {
  border-color: #d92d20;
  box-shadow: 0 0 0 1px #d92d20;
}

.playground__editor-message {
  color: #b42318;
  font-size: .78rem;
  line-height: 1.35;
  margin: .4rem 0 0;
  min-height: 1.1em;
}

.playground__format-progress {
  background: #eaecf0;
  border-radius: 999px;
  height: 2px;
  margin-top: .65rem;
  overflow: hidden;
}

.playground__format-progress[hidden] {
  display: block;
  visibility: hidden;
}

.playground__format-progress > span {
  background: #98a2b3;
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
}

.playground__format-progress.is-running > span {
  animation: playground-format-progress var(--playground-format-delay, 3s) linear forwards;
}

@keyframes playground-format-progress {
  to { transform: scaleX(1); }
}

.playground__code-editor--payload { min-height: 31rem; }

.playground .playground__code-editor > pre,
.playground .playground__code-editor > textarea {
  background: transparent;
  border: 0;
  border-radius: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .83rem;
  height: 100%;
  inset: 0;
  line-height: 1.55;
  margin: 0;
  min-height: 0;
  overflow: auto;
  padding: .75rem;
  position: absolute;
  resize: none;
  tab-size: 2;
  white-space: pre;
  width: 100%;
}

.playground .playground__code-editor > pre {
  color: #cbd5e1;
  display: none;
  pointer-events: none;
  scrollbar-width: none;
}

.playground .playground__code-editor > pre::-webkit-scrollbar { display: none; }

.playground .playground__code-editor > textarea {
  color: #e5e7eb;
  z-index: 1;
}

.playground .playground__code-editor.is-highlighted > pre { display: block; }

.playground .playground__code-editor.is-highlighted > textarea {
  -webkit-text-fill-color: transparent;
  caret-color: #f8fafc;
}

.playground .playground__code-editor.is-highlighted > textarea::selection {
  background: rgb(99 102 241 / 42%);
}

.playground .playground__code-editor.is-wrapped > pre,
.playground .playground__code-editor.is-wrapped > textarea {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.json-key { color: #93c5fd; }
.json-string { color: #86efac; }
.json-number { color: #c4b5fd; }
.json-boolean,
.json-null { color: #fbbf24; }
.json-quote,
.token-delimiter,
.token-punctuation { color: #94a3b8; }
.token-variable { color: #67e8f9; }
.token-type,
.token-function,
.token-transformer { color: #c4b5fd; }
.token-operator,
.token-keyword { color: #fb923c; }
.token-action,
.token-value { color: #fde68a; }
.token-validator { color: #7dd3fc; }
.token-interaction { color: #f9a8d4; }
.token-unknown { color: #fca5a5; text-decoration: underline wavy; }
.token-whitespace { color: inherit; }

#rendered-json .json-key { color: #2457a7; }
#rendered-json .json-string { color: #137333; }
#rendered-json .json-number { color: #6d28d9; }
#rendered-json .json-boolean,
#rendered-json .json-null { color: #9a5800; }
#rendered-json .json-quote { color: #667085; }

.playground pre {
  background: var(--playground-soft);
  border-radius: .45rem;
  font-size: .8rem;
  line-height: 1.5;
  margin: 0;
  min-height: 7rem;
  overflow: auto;
  padding: .8rem;
  white-space: pre-wrap;
}

.playground__panel--code > pre { min-height: 31rem; }

.playground__errors {
  background: #fff1f0;
  border: 1px solid #fecdca;
  border-radius: .45rem;
  color: #b42318;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.5;
  margin: 0;
  min-height: 31rem;
  overflow-wrap: anywhere;
  padding: .8rem .8rem .8rem 2rem;
}

.playground__note,
.playground__footnote {
  color: var(--playground-muted);
  font-size: .85rem;
}

.playground__note {
  margin: -.25rem 0 1rem;
  min-height: 2.6rem;
}

.playground__section {
  border: 0;
  border-top: 1px solid var(--playground-line);
  margin: 0 0 1.2rem;
  padding: 1rem 0 0;
}

.playground__section:first-child { border-top: 0; padding-top: 0; }

.playground__section > legend {
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .08em;
  padding: 0;
  text-transform: uppercase;
}

.playground__field { margin: 0 0 1rem; }
.playground__field > label,
.playground__field-label { display: block; font-weight: 650; margin-bottom: .25rem; }
.playground__required { color: #d92d20; margin-left: .2em; }

.playground__meta {
  color: var(--playground-muted);
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .7rem;
  margin-bottom: .45rem;
  overflow-wrap: anywhere;
}

.playground__options { display: grid; gap: .35rem; }
.playground__option { align-items: center; display: flex; gap: .45rem; }
.playground__option label { cursor: pointer; }
.playground__rating label { color: #a15c00; font-size: 1.05rem; }
.playground__empty { color: var(--playground-muted); }

.playground__contracts { margin-top: 1rem; padding: 1rem; }

.playground__contracts-heading {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: .85rem;
}

.playground__contracts-heading h2 {
  font-size: 1rem;
  margin: 0;
}

.playground__contracts-heading h2 span { color: var(--playground-muted); }

.playground__contracts-heading p {
  color: var(--playground-muted);
  font-size: .8rem;
  margin: .2rem 0 0;
}

.playground__contract-grid {
  display: grid;
  gap: .65rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.playground__contract-card {
  border: 1px solid var(--playground-line);
  border-radius: .55rem;
  min-width: 0;
  padding: .7rem;
}

.playground__contract-card-heading {
  align-items: center;
  display: flex;
  gap: .5rem;
  justify-content: space-between;
  margin-bottom: .55rem;
}

.playground__contract-card-heading code {
  color: var(--playground-accent-dark);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.playground__contract-card-heading span {
  background: var(--playground-soft);
  border-radius: 999px;
  color: var(--playground-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .66rem;
  padding: .2rem .4rem;
  white-space: nowrap;
}

.playground__contract-card dl {
  display: grid;
  gap: .35rem;
  margin: 0;
}

.playground__contract-card dl > div {
  display: grid;
  gap: .4rem;
  grid-template-columns: 4.5rem minmax(0, 1fr);
}

.playground__contract-card dt {
  color: var(--playground-muted);
  font-size: .68rem;
}

.playground__contract-card dd {
  font-size: .72rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.playground__contracts > pre { margin-top: .8rem; }
.playground__footnote { margin: 1rem 0 0; }

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

@media (max-width: 1050px) {
  .playground__grid { grid-template-columns: 1fr 1fr; }
  .playground__panel:last-child { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .playground__grid { grid-template-columns: 1fr; }
  .playground__panel:last-child { grid-column: auto; }
  .playground__code-editor { min-height: 22rem; }
}
