.playground-page {
  --playground-split: minmax(0, 1fr) minmax(0, 1fr);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-height));
}

.playground-intro {
  padding: 20px 24px 0;
  max-width: 1200px;
}

.playground-intro h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  color: var(--heading);
}

.playground-intro p {
  margin: 0 0 16px;
  color: var(--text-muted);
  max-width: 72ch;
}

.playground-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  padding: 0 24px 16px;
  max-width: 1200px;
}

.playground-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 280px;
  flex: 1;
}

.playground-controls select {
  font: inherit;
  font-weight: 500;
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.playground-controls__hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.playground-split {
  flex: 1;
  display: grid;
  grid-template-columns: var(--playground-split);
  gap: 0;
  min-height: 0;
  border-top: 1px solid var(--border);
}

.playground-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.playground-pane + .playground-pane {
  border-left: 1px solid var(--border);
}

.playground-pane__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.playground-pane__actions {
  display: flex;
  gap: 8px;
}

.playground-btn {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.playground-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.playground-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.playground-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.playground-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.playground-toolbar__status {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
}

.playground-toolbar__status.is-running {
  color: var(--accent);
}

.playground-toolbar__status.is-ok {
  color: var(--green);
}

.playground-toolbar__status.is-error {
  color: #cf222e;
}

.playground-editor-wrap {
  position: relative;
  flex: 1;
  min-height: 360px;
  overflow: hidden;
  display: grid;
  background: var(--bg);
}

.playground-editor-highlight,
#code-editor {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-height: 360px;
  margin: 0;
  padding: 16px;
  border: 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.55;
  tab-size: 2;
  overflow: auto;
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
  box-sizing: border-box;
}

.playground-editor-highlight {
  pointer-events: none;
  z-index: 0;
  background: var(--bg);
  color: var(--text);
}

.playground-editor-highlight code {
  display: block;
  min-height: calc(100% - 32px);
  padding: 0;
  margin: 0;
  font: inherit;
  line-height: inherit;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: inherit;
}

.playground-editor-highlight code.hljs {
  padding: 0 !important;
  border: 0 !important;
  border-left: 0 !important;
}

#code-editor {
  resize: none;
  z-index: 1;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: var(--text);
  background: transparent;
}

#code-editor:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}

#code-editor::selection {
  background: rgba(91, 127, 255, 0.35);
  color: transparent;
  -webkit-text-fill-color: transparent;
}

@media (prefers-color-scheme: dark) {
  .playground-editor-wrap,
  .playground-editor-highlight {
    background: #0d1117;
    color: #e6edf3;
  }

  #code-editor {
    caret-color: #e6edf3;
  }
}

#output {
  flex: 1;
  min-height: 360px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.55;
  background: #0d1117;
  color: #e6edf3;
}

.playground-output__line {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 2px 0;
}

.playground-output__line.is-error {
  color: #ff7b72;
}

@media (max-width: 960px) {
  .playground-split {
    grid-template-columns: 1fr;
  }

  .playground-pane + .playground-pane {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
}
