/* The playground's editor/console/sidebar follow the site-wide light/dark
   theme toggle via the --code-* tokens defined in base.css. The CodeMirror
   syntax theme itself ("dracula" for dark, "default" for light) is switched
   in run.js alongside these, in response to the same toggle. */

.playground-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--code-border);
  overflow: hidden;
  min-height: 0;
}

.playground-main.has-sidebar {
  grid-template-columns: 170px 1fr 1fr;
}

.playground-main.has-sidebar.sidebar-collapsed {
  grid-template-columns: 1fr 1fr;
}

.playground-main.sidebar-collapsed .playground-sidebar {
  display: none;
}

@media (max-width: 800px) {
  .playground-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .playground-main.has-sidebar,
  .playground-main.has-sidebar.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .playground-sidebar {
    display: none;
  }
}

.pane {
  background: var(--code-panel-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pane-header {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--code-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pane-header span.pane-title {
  font-weight: 600;
  margin-right: auto;
  color: var(--code-text);
}

.CodeMirror {
  flex: 1;
  height: auto !important;
  font-size: 0.95rem;
}

#status,
#save-status {
  color: var(--code-muted);
  font-size: 0.85rem;
}

#output {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--code-text);
}

.output-error {
  color: var(--code-danger);
}

.output-input {
  outline: none;
  border-bottom: 1px solid var(--code-accent);
  min-width: 1ch;
  display: inline-block;
}

.submit-bar {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--code-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.submit-bar .pane-title {
  font-weight: 600;
  margin-right: auto;
  color: var(--code-text);
}

.explorer-header {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--code-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.explorer-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--code-muted);
  margin-right: auto;
}

.explorer-new {
  color: var(--code-muted);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
}

.explorer-new:hover {
  color: var(--code-text);
}

.snippet-explorer {
  list-style: none;
  margin: 0;
  padding: 0.2rem 0;
  overflow-y: auto;
  flex: 1;
}

.snippet-explorer-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.75rem;
  color: var(--code-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid transparent;
  font-size: 0.82rem;
  line-height: 1.7;
}

.snippet-explorer-icon {
  flex-shrink: 0;
  font-size: 0.8em;
  opacity: 0.8;
}

.snippet-explorer-item:hover {
  background: var(--code-bg);
}

.snippet-explorer-item.is-active {
  border-left-color: var(--code-accent);
  background: color-mix(in srgb, var(--code-accent) 12%, transparent);
}

.snippet-explorer-empty {
  color: var(--code-muted);
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
}
