:root {
    --pg-dark: #0f172a;
    --pg-panel: #111827;
    --pg-editor: #0b1220;
    --pg-border: #263244;
    --pg-muted: #94a3b8;
    --pg-blue: #2563eb;
}

.playground-page { margin: 0; background: #f1f5f9; }
.playground-shell { max-width: 1600px; margin: 0 auto; padding: 20px; }
.playground-header {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
    margin-bottom: 18px;
}
.playground-header h1 { margin: 10px 0 4px; font-size: 25px; }
.playground-header h1 a { color: var(--pg-dark); text-decoration: none; }
.playground-header p { margin: 0; color: #64748b; }
.playground-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auto-run-control { font-size: 14px; color: #475569; margin-right: 4px; }
.primary-button, .secondary-button {
    border: 1px solid transparent; border-radius: 7px; padding: 9px 15px;
    font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.primary-button { background: var(--pg-blue); color: #fff; }
.primary-button:hover { background: #1d4ed8; }
.secondary-button { background: #fff; color: #334155; border-color: #cbd5e1; }
.playground-workspace {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 650px; height: calc(100vh - 190px); border-radius: 12px;
    overflow: hidden; border: 1px solid var(--pg-border); box-shadow: 0 15px 40px rgba(15,23,42,.12);
}
.editor-panel, .result-panel { min-width: 0; display: flex; flex-direction: column; }
.editor-panel { background: var(--pg-editor); border-right: 1px solid var(--pg-border); }
.editor-tabs, .result-header {
    min-height: 48px; display: flex; align-items: center; background: var(--pg-panel);
    border-bottom: 1px solid var(--pg-border);
}
.editor-tab, .result-tab {
    align-self: stretch; padding: 0 20px; border: 0; border-bottom: 2px solid transparent;
    background: transparent; color: var(--pg-muted); font: inherit; font-size: 13px;
    font-weight: 700; cursor: pointer;
}
.editor-tab.active, .result-tab.active { color: #fff; border-bottom-color: #60a5fa; background: rgba(255,255,255,.03); }
.editor-area { position: relative; flex: 1; min-height: 0; }
.code-editor {
    display: none; position: absolute; inset: 0; width: 100%; height: 100%; resize: none;
    border: 0; outline: none; box-sizing: border-box; padding: 20px; tab-size: 4;
    background: var(--pg-editor); color: #dbeafe; caret-color: #fff;
    font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-editor.active { display: block; }
.editor-footer {
    display: flex; gap: 14px; align-items: center; min-height: 42px; padding: 0 14px;
    background: var(--pg-panel); color: var(--pg-muted); font-size: 12px; border-top: 1px solid var(--pg-border);
}
.editor-footer span { margin-right: auto; }
.text-button { border: 0; background: transparent; color: #64748b; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }
.editor-panel .text-button { color: #cbd5e1; }
.result-panel { background: #fff; }
.result-header { justify-content: space-between; padding-right: 12px; }
.result-tabs { align-self: stretch; display: flex; }
.result-tab { color: #94a3b8; }
.result-tab.active { color: #fff; }
#consoleCount { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #334155; font-size: 10px; }
#previewFrame { flex: 1; width: 100%; border: 0; background: #fff; }
.console-panel { flex: 1; overflow: auto; padding: 14px; background: #090f1a; color: #dbeafe; font: 13px/1.55 ui-monospace, monospace; }
.console-entry { padding: 8px 10px; border-bottom: 1px solid #1e293b; white-space: pre-wrap; overflow-wrap: anywhere; }
.console-error { color: #fca5a5; }
.console-warn { color: #fde68a; }
.playground-note { color: #64748b; font-size: 13px; text-align: center; margin: 12px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 800px) {
    .playground-shell { padding: 14px; }
    .playground-header { align-items: flex-start; flex-direction: column; }
    .playground-workspace { grid-template-columns: 1fr; height: auto; min-height: 0; }
    .editor-panel { height: 480px; border-right: 0; border-bottom: 1px solid var(--pg-border); }
    .result-panel { height: 480px; }
}
