/* The playground needs the full window width, unlike the prose pages. */
.pg-main {
  max-width: none;
  margin: 0 auto;
}

.pg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pg-spacer {
  flex: 1 1 auto;
}

.pg-label {
  color: var(--text-color);
  opacity: 0.7;
  font-size: 0.85rem;
}

.pg-toolbar button,
.pg-toolbar select {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text-color);
  background-color: var(--card-background);
  border: 1px solid var(--code-border);
  border-radius: 5px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
}

.pg-toolbar button:hover:not(:disabled),
.pg-toolbar select:hover {
  border-color: var(--primary-color);
}

.pg-toolbar button:disabled {
  opacity: 0.45;
  cursor: default;
}

.pg-toolbar .pg-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
  font-weight: bold;
}

.pg-toolbar kbd {
  font-family: inherit;
  font-size: 0.75rem;
  opacity: 0.75;
}

.pg-panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  height: min(70vh, 40rem);
}

.pg-pane {
  position: relative;
  background-color: var(--code-background);
  border: 1px solid var(--code-border);
  border-radius: 5px;
  overflow: hidden;
}

#code {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  border: 0;
  resize: none;
  color: var(--code-text);
  background-color: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  tab-size: 2;
}

#code:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

.pg-viewer {
  padding: 0;
}

#view {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

body.is-running #view {
  cursor: progress;
}

.pg-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  text-align: center;
  color: var(--text-color);
  opacity: 0.55;
  pointer-events: none;
}

.pg-fallback {
  padding: 2rem;
  text-align: center;
}

.pg-status {
  margin: 0.6rem 0 0.3rem;
  font-size: 0.85rem;
  min-height: 1.4em;
  opacity: 0.8;
}

.pg-status.error {
  color: #d33;
  opacity: 1;
  font-weight: bold;
}

.pg-output {
  margin: 0;
  padding: 0.6rem 0.75rem;
  max-height: 12rem;
  overflow: auto;
  background-color: var(--code-background);
  border: 1px solid var(--code-border);
  border-radius: 5px;
  color: var(--code-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.pg-output:empty {
  display: none;
}

.pg-output .error {
  color: #d33;
}

.pg-note {
  max-width: 60rem;
  margin: 1.5rem auto 0;
  font-size: 0.9rem;
  opacity: 0.85;
}

@media (max-width: 900px) {
  .pg-panes {
    grid-template-columns: 1fr;
    height: auto;
  }

  .pg-pane {
    height: 22rem;
  }
}
