.mocno-playground {
  --playground-border: rgba(148, 163, 184, .32);
  --playground-bg: rgba(248, 250, 252, .82);
  --playground-panel: rgba(255, 255, 255, .92);
  --playground-text: #0f172a;
  --playground-muted: #64748b;
  --playground-accent: #0ea5e9;
  --playground-editor-bg: rgba(255, 255, 255, .48);
  --playground-shadow: 0 18px 45px rgba(15, 23, 42, .10);
  margin: 1.45rem 0;
  border: 1px solid var(--playground-border);
  border-radius: 18px;
  background: var(--playground-bg);
  box-shadow: var(--playground-shadow);
  overflow: hidden;
  color: var(--playground-text);
}

.dark .mocno-playground,
body.dark .mocno-playground,
[data-theme="dark"] .mocno-playground {
  --playground-border: rgba(148, 163, 184, .22);
  --playground-bg: rgba(15, 23, 42, .78);
  --playground-panel: rgba(2, 6, 23, .56);
  --playground-text: #e5e7eb;
  --playground-muted: #94a3b8;
  --playground-accent: #38bdf8;
  --playground-editor-bg: rgba(2, 6, 23, .24);
  --playground-shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

.mocno-playground__title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--playground-border);
  color: var(--playground-muted);
  font-size: .88rem;
  font-weight: 800;
  letter-spacing: .04em;
}

.mocno-playground__title-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 22px;
  border: 1px solid color-mix(in srgb, var(--playground-accent) 42%, var(--playground-border));
  border-radius: 8px;
  color: var(--playground-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: .74rem;
  line-height: 1;
}

.mocno-playground__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 280px;
  height: clamp(280px, 42vh, 420px);
}

.mocno-playground__editor,
.mocno-playground__preview-wrap {
  min-width: 0;
  background: var(--playground-panel);
}

.mocno-playground__editor {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border-right: 1px solid var(--playground-border);
}

.mocno-playground__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px;
  border-bottom: 1px solid var(--playground-border);
}

.mocno-playground__tabs {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
}

.mocno-playground__tab {
  appearance: none;
  border: 1px solid var(--playground-border);
  border-radius: 999px;
  background: transparent;
  color: var(--playground-muted);
  cursor: pointer;
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  line-height: 1;
  padding: 8px 11px;
  transition: transform .16s ease, border-color .16s ease, color .16s ease, background .16s ease;
}

.mocno-playground__tab:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--playground-accent) 50%, var(--playground-border));
  color: var(--playground-text);
}

.mocno-playground__tab.is-active {
  border-color: color-mix(in srgb, var(--playground-accent) 70%, var(--playground-border));
  background: color-mix(in srgb, var(--playground-accent) 12%, transparent);
  color: var(--playground-accent);
}

.mocno-playground__color-tools {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
  padding: 5px 7px;
  border: 1px solid var(--playground-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--playground-accent) 7%, transparent);
  color: var(--playground-muted);
  font-size: .8rem;
  font-weight: 800;
}

.mocno-playground__color-tools[hidden] {
  display: none;
}

.mocno-playground__color-input {
  width: 38px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--playground-border);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.mocno-playground__color-value {
  overflow: hidden;
  max-width: min(210px, 42vw);
  padding: 4px 7px;
  border: 1px solid var(--playground-border);
  border-radius: 999px;
  color: var(--playground-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mocno-playground__code-host {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  height: 100%;
  background: var(--playground-editor-bg);
  overflow: hidden;
}

.mocno-playground__editor-loading {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 18px;
  color: var(--playground-muted);
  font-size: .86rem;
  font-weight: 700;
}

.mocno-playground__code-host .cm-editor {
  height: 100%;
  max-width: 100%;
}

.mocno-playground__code-host .cm-scroller {
  overflow: auto;
}

.mocno-playground__code-host .cm-line {
  padding-inline: 8px 14px;
}

.mocno-playground__textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  resize: none;
  overflow: auto;
  border: 0;
  outline: 0;
  padding: 14px;
  background: transparent;
  color: var(--playground-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: .9rem;
  line-height: 1.55;
  tab-size: 2;
}

.mocno-playground__textarea:focus {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--playground-accent) 50%, transparent);
}

.mocno-playground__textarea--fallback {
  background: var(--playground-editor-bg);
}

.mocno-playground__preview-wrap {
  min-height: 0;
  padding: 10px;
}

.mocno-playground__preview {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  border: 1px solid var(--playground-border);
  border-radius: 14px;
  background: #fff;
}

@media (max-width: 820px) {
  .mocno-playground__layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .mocno-playground__editor {
    border-right: 0;
    border-bottom: 1px solid var(--playground-border);
  }

  .mocno-playground__code-host,
  .mocno-playground__textarea,
  .mocno-playground__preview {
    min-height: 280px;
  }
}
