/* ── Playground layout ─────────────────────────────────── */
.pg-container {
    margin-top: 60px;
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
}

.pg-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}

.pg-titlewrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-right: auto;
}

.pg-toolbar .pg-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.pg-version {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    border: 1px solid var(--border);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    white-space: nowrap;
}

.pg-btn {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.pg-btn:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.pg-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.pg-btn-run:hover {
    opacity: 0.85;
    background: var(--accent);
    color: #fff;
}

.pg-select {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}

/* ── Split panes ───────────────────────────────────────── */
.pg-panes {
    flex: 1;
    display: flex;
    min-height: 0;
}

.pg-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pg-pane + .pg-pane {
    border-left: 2px solid var(--border);
}

.pg-pane-header {
    padding: 0.45rem 1rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pg-status {
    margin-left: auto;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.pg-status.ok { color: #2a9d5c; }
.pg-status.err { color: #d9534f; }
.pg-status.busy { color: var(--accent); }

/* ── Editor (highlighted textarea overlay) ─────────────── */
.pg-editor {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: var(--bg-primary);
    font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.55;
}

.pg-editor textarea,
.pg-editor pre {
    margin: 0;
    border: 0;
    padding: 1rem 1rem 1rem 1rem;
    width: 100%;
    height: 100%;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    tab-size: 4;
    white-space: pre;
    overflow: auto;
    box-sizing: border-box;
}

.pg-editor pre {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: none;
    z-index: 0;
}

.pg-editor pre code {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.pg-editor textarea {
    position: absolute;
    inset: 0;
    z-index: 1;
    resize: none;
    color: transparent;
    background: transparent;
    caret-color: var(--text-primary);
    outline: none;
}

.pg-editor textarea::selection {
    background: rgba(217, 119, 6, 0.3);
}

/* ── Output console ────────────────────────────────────── */
.pg-output {
    flex: 1;
    margin: 0;
    padding: 1rem;
    overflow: auto;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.pg-output .pg-out-section { display: block; }
.pg-output .pg-label {
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
    display: block;
    margin: 0.75rem 0 0.25rem;
}
.pg-output .pg-label:first-child { margin-top: 0; }
.pg-output .pg-stderr { color: #d9534f; }
.pg-output .pg-meta { color: var(--text-secondary); }
.pg-output .pg-placeholder { color: var(--text-secondary); }

.pg-stdin-wrap {
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}
.pg-stdin-wrap summary {
    cursor: pointer;
    padding: 0.45rem 1rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-secondary);
}
.pg-stdin {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    border: 0;
    border-top: 1px solid var(--border);
    padding: 0.6rem 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
}

/* ── Responsive: stack panes ───────────────────────────── */
@media (max-width: 820px) {
    .pg-container { height: auto; }
    .pg-panes { flex-direction: column; }
    .pg-pane + .pg-pane { border-left: none; border-top: 2px solid var(--border); }
    .pg-pane { min-height: 320px; }
    .pg-toolbar .pg-title { width: 100%; margin-bottom: 0.25rem; }
}
