/* Code playground — layout, cards, CodeMirror, output */
.code-playground-section .playground-container {
    max-width: 100%;
}

/* Full-width in-place playground: zero Bootstrap py-*/px-* gutters on the
   section and container-fluid so the editor + output cards sit flush to the
   host edges. The parent lesson card / CKEditor widget mount already provide
   spacing; py-3/py-4 left large empty bands above and below the outer box.
   !important is required because Bootstrap's spacing utilities use !important.
   Scoped to in-place hosts so the standalone /course/code_playground page
   keeps its container-fluid padding. */
.vaanii-snippet-inplace > .code-playground-section,
.cke_snr_widget_mount > .code-playground-section {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.vaanii-snippet-inplace,
.cke_snr_widget_mount {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.vaanii-snippet-inplace .playground-container,
.cke_snr_widget_mount .playground-container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Hero */
.playground-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem 1.5rem;
    margin-bottom: 1.15rem;
    padding: 1.25rem 1.35rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.playground-page .playground-hero {
    background: linear-gradient(135deg, #0f6ea3 0%, #1586c3 52%, #52b6ec 100%);
    border: none;
    box-shadow: 0 16px 36px rgba(21, 134, 195, 0.2);
    color: #fff;
}

.playground-hero-main {
    flex: 1 1 280px;
    min-width: 0;
}

.playground-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.playground-page .playground-eyebrow {
    color: rgba(255, 255, 255, 0.82);
}

.playground-title {
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.playground-page .playground-title {
    color: #fff;
    font-size: clamp(1.35rem, 2vw, 1.75rem);
}

.playground-lead {
    font-size: 0.95rem;
    line-height: 1.55;
}

.playground-page .playground-lead {
    color: rgba(255, 255, 255, 0.92);
    max-width: 40rem;
}

.playground-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.playground-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.playground-page .playground-badge {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
}

.playground-hero-side {
    flex: 0 0 auto;
    min-width: 11rem;
}

.playground-page .playground-hero-side {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    min-width: 15.5rem;
}

.playground-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.playground-page .playground-label {
    color: rgba(255, 255, 255, 0.85);
}

.code-playground-section .playground-language-select {
    min-width: 11.5rem;
    border-radius: 8px;
    border-color: #cbd5e1;
}

.pg-lang {
    position: relative;
    min-width: 13.75rem;
}

.pg-lang-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pg-lang-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.52rem 0.65rem;
    background: #fff;
    border: 0;
    border-radius: 10px;
    color: #142433;
    font-weight: 700;
    font-size: 0.94rem;
    line-height: 1.2;
    box-shadow: 0 8px 18px rgba(12, 28, 42, 0.16);
    cursor: pointer;
    text-align: left;
}

.pg-lang-toggle:hover {
    background: #f8fbff;
}

.pg-lang-toggle:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.pg-lang-icon {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8f4fb;
    color: #1586c3;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.pg-lang-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pg-lang-caret {
    margin-left: auto;
    font-size: 0.68rem;
    color: #5b6b7c;
    transition: transform 0.16s ease;
}

.pg-lang-toggle[aria-expanded="true"] .pg-lang-caret {
    transform: rotate(180deg);
}

.pg-lang-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    z-index: 50;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: #fff;
    border: 1px solid #dce7f0;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    max-height: 18.5rem;
    overflow: auto;
}

.pg-lang-menu[hidden] {
    display: none !important;
}

.pg-lang-menu li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.52rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 650;
    font-size: 0.88rem;
    color: #142433;
}

.pg-lang-menu li i {
    width: 1.1rem;
    text-align: center;
    color: #1586c3;
}

.pg-lang-menu li:hover {
    background: #f3f8fc;
}

.pg-lang-menu li[aria-selected="true"] {
    background: #e8f4fb;
    color: #0f6ea3;
}

.playground-sql-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin: 0 0 1.15rem;
    padding: 0.9rem 1.05rem;
    background: #fff8e8;
    border: 1px solid #f0dfb0;
    border-radius: 12px;
}

.playground-sql-notice[hidden] {
    display: none !important;
}

.playground-sql-notice-icon {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff4d6;
    color: #8a6110;
    flex-shrink: 0;
}

.playground-sql-notice-title {
    margin: 0 0 0.2rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: #142433;
}

.playground-sql-notice-copy {
    margin: 0;
    font-size: 0.88rem;
    color: #6b5728;
    line-height: 1.45;
}

.playground-sql-notice-copy code {
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.7);
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
}

.playground-sql-notice-block {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: #8a6110;
}

.playground-kbd {
    display: inline-block;
    padding: 0.1em 0.4em;
    font-size: 0.7rem;
    font-family: ui-monospace, Consolas, monospace;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #334155;
    vertical-align: middle;
}

/* Cards */
.playground-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.playground-card:hover {
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.09);
    border-color: #cbd5e1;
}

.playground-card-head {
    background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.playground-card-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1e293b;
}

.playground-status-badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* Icon-only editor/output toolbar (snippet embed + Quick Code Playground) */
.playground-toolbar-icons .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
}

.playground-toolbar-icons .btn > i {
    line-height: 1;
}

/* Editor / output split (draggable handle on large viewports) */
.playground-panels-split-wrap {
    width: 100%;
    min-width: 0;
}

.playground-panels-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 10px minmax(0, 1fr);
    column-gap: 0.75rem;
    row-gap: 0;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}

.playground-panels-split .playground-panel-editor,
.playground-panels-split .playground-panel-output {
    min-width: 0;
}

/* Lesson / section embeds: panel height follows code, not equal stretch to tallest column */
.vaanii-snippet-playground-root .playground-panels-split,
.vaanii-snippet-inplace .playground-panels-split,
.cke_snr_widget_mount .playground-panels-split {
    align-items: start;
}

.vaanii-snippet-playground-root .playground-card.h-100,
.vaanii-snippet-inplace .playground-card.h-100,
.cke_snr_widget_mount .playground-card.h-100 {
    height: auto;
}

/* Snippet with no language: editor column only (no output / handle in DOM) */
.vaanii-snippet-editor-only .playground-panels-split {
    grid-template-columns: minmax(0, 1fr);
}

.playground-resize-handle {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    width: 10px;
    min-height: 120px;
    align-self: stretch;
    margin: 0;
    padding: 0;
    border-radius: 6px;
    box-sizing: border-box;
    border: 1px solid #94a3b8;
    background: linear-gradient(180deg, #e2e8f0, #cbd5e1);
    cursor: col-resize;
    flex-shrink: 0;
}

/*
 * Lesson / CK embeds size to code height, so a 120px handle min-height was
 * taller than the editor cards. Drop the floor and center the grip.
 */
.vaanii-snippet-playground-root .playground-resize-handle,
.vaanii-snippet-inplace .playground-resize-handle,
.cke_snr_widget_mount .playground-resize-handle {
    min-height: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playground-resize-handle:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.playground-resize-handle::after {
    content: '';
    display: block;
    width: 2px;
    height: 32px;
    margin: 12px auto 0;
    border-radius: 1px;
    background: #64748b;
    opacity: 0.85;
}

.vaanii-snippet-playground-root .playground-resize-handle::after,
.vaanii-snippet-inplace .playground-resize-handle::after,
.cke_snr_widget_mount .playground-resize-handle::after {
    margin: 0;
    max-height: 48%;
    height: 32px;
}

.playground-panels-split--stacked {
    display: flex !important;
    flex-direction: column;
    gap: 0.75rem;
}

.playground-panels-split--stacked .playground-resize-handle {
    display: none !important;
}

@media (max-width: 991.98px) {
    .playground-panels-split:not(.playground-panels-split--stacked) {
        display: flex !important;
        flex-direction: column;
        gap: 0.75rem;
    }

    .playground-panels-split .playground-resize-handle {
        display: none !important;
    }
}

.playground-cm-wrap {
    border-left: 3px solid #3b82f6;
}

.playground-card-output .output-box {
    border-left: 3px solid #0ea5e9;
}

/* Output panel full-screen overlay */
.playground-card.playground-output-fullscreen {
    position: fixed !important;
    inset: 0;
    z-index: 10040;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: none;
}

.playground-card.playground-output-fullscreen .card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.playground-card.playground-output-fullscreen .output-box {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    overflow: auto;
}

.playground-card.playground-output-fullscreen .output-meta {
    flex: 0 0 auto;
}

body.playground-output-fs-open {
    overflow: hidden;
}

.playground-textarea {
    min-height: 280px;
    height: clamp(280px, 52vh, 560px);
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.45;
    padding: 10px;
    resize: vertical;
}

.CodeMirror {
    height: clamp(280px, 52vh, 560px);
    min-height: 280px;
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.45;
    border: none;
}

/* Embedded snippet editors (lesson reader + CK): height set in JS — line count + 3 buffer rows, max 20 rows, then scroll */
.vaanii-snippet-playground-root .CodeMirror,
.vaanii-snippet-inplace .CodeMirror,
.cke_snr_widget_mount .CodeMirror {
    min-height: 0;
    height: auto;
    text-align: left;
}

/* Lesson sections often use text-align:center; do not inherit into the code editor */
.vaanii-snippet-playground-root .playground-cm-wrap,
.vaanii-snippet-inplace .playground-cm-wrap,
.cke_snr_widget_mount .playground-cm-wrap,
.vaanii-snippet-playground-root .CodeMirror .CodeMirror-scroll,
.vaanii-snippet-inplace .CodeMirror .CodeMirror-scroll,
.cke_snr_widget_mount .CodeMirror .CodeMirror-scroll,
.vaanii-snippet-playground-root .CodeMirror .CodeMirror-lines,
.vaanii-snippet-inplace .CodeMirror .CodeMirror-lines,
.cke_snr_widget_mount .CodeMirror .CodeMirror-lines,
.vaanii-snippet-playground-root .CodeMirror pre.CodeMirror-line,
.vaanii-snippet-inplace .CodeMirror pre.CodeMirror-line,
.cke_snr_widget_mount .CodeMirror pre.CodeMirror-line {
    text-align: left !important;
}

/* Snippet embed: output scroll area matches CodeMirror height (pixels set in JS) */
.vaanii-snippet-inplace .output-box.vaanii-snippet-output,
.vaanii-snippet-playground-root:not(.vaanii-snippet-editor-only) .output-box.vaanii-snippet-output,
.cke_snr_widget_mount .output-box.vaanii-snippet-output {
    min-height: 0;
    height: auto;
    max-height: none;
}

/* CKEditor Image dialog above lesson chrome / fullscreen overlay */
.cke_dialog_container,
.cke_dialog {
    z-index: 10050 !important;
}

body .cke_dialog_body {
    z-index: 10051 !important;
}

.CodeMirror-scroll {
    min-height: 100%;
}

/* Embedded snippets: scroll area follows content height set in JS (not 100% of a tall parent) */
.vaanii-snippet-playground-root .CodeMirror-scroll,
.vaanii-snippet-inplace .CodeMirror-scroll,
.cke_snr_widget_mount .CodeMirror-scroll {
    min-height: 0;
}

.editor-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid #e2e8f0;
    color: #475569;
    font-size: 11px;
}

.editor-tip {
    color: #64748b;
}

/* Standalone Quick Code Playground (/course/code_playground only — not lesson snippet embeds) */
.code-playground-section.py-4:not(.vaanii-snippet-playground-root) .playground-card-editor .card-body,
.code-playground-section.py-4:not(.vaanii-snippet-playground-root) .playground-card-output .card-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.code-playground-section.py-4:not(.vaanii-snippet-playground-root) .playground-card-editor .playground-cm-wrap,
.code-playground-section.py-4:not(.vaanii-snippet-playground-root) .playground-card-output .output-box {
    flex: 1 1 auto;
    min-height: 280px;
    max-height: clamp(280px, 52vh, 560px);
}

.code-playground-section.py-4:not(.vaanii-snippet-playground-root) .playground-card-editor .CodeMirror {
    height: 100% !important;
    min-height: 280px;
    max-height: none;
}

.code-playground-section.py-4:not(.vaanii-snippet-playground-root) .playground-card-output .output-box {
    height: auto !important;
}

.code-playground-section.py-4:not(.vaanii-snippet-playground-root) .playground-card-editor .editor-meta,
.code-playground-section.py-4:not(.vaanii-snippet-playground-root) .playground-card-output .output-meta {
    flex: 0 0 auto;
}

/* Snippet embed: never inherit standalone 280px floors; JS sets editor + output height */
.vaanii-snippet-playground-root .playground-card-editor .playground-cm-wrap,
.vaanii-snippet-playground-root .playground-card-output .output-box.vaanii-snippet-output,
.vaanii-snippet-inplace .playground-card-editor .playground-cm-wrap,
.vaanii-snippet-inplace .playground-card-output .output-box.vaanii-snippet-output,
.cke_snr_widget_mount .playground-card-editor .playground-cm-wrap,
.cke_snr_widget_mount .playground-card-output .output-box.vaanii-snippet-output {
    flex: 0 0 auto;
    min-height: 0 !important;
    max-height: none !important;
}

.vaanii-snippet-playground-root .playground-card-editor .CodeMirror,
.vaanii-snippet-inplace .playground-card-editor .CodeMirror,
.cke_snr_widget_mount .playground-card-editor .CodeMirror {
    min-height: 0 !important;
    max-height: none !important;
}

.output-box {
    min-height: 280px;
    height: clamp(280px, 52vh, 560px);
    margin: 0;
    padding: 12px 14px;
    overflow: auto;
    font-family: ui-monospace, Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    background: linear-gradient(165deg, #f8fafc 0%, #f1f5f9 100%);
    color: #0f172a;
    border-top: 1px solid #e2e8f0;
}

.output-box > div {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.output-box iframe {
    border-radius: 8px !important;
}

/* Eclipse theme only — do not override Monokai (.cm-s-monokai) in lesson dark mode */
.cm-s-eclipse .cm-keyword { color: #005cc5 !important; font-weight: 600; }
.cm-s-eclipse .cm-atom { color: #6f42c1 !important; }
.cm-s-eclipse .cm-number { color: #d73a49 !important; }
.cm-s-eclipse .cm-def { color: #6f42c1 !important; }
.cm-s-eclipse .cm-variable,
.cm-s-eclipse .cm-variable-2,
.cm-s-eclipse .cm-variable-3 { color: #24292e !important; }
.cm-s-eclipse .cm-property { color: #005cc5 !important; }
.cm-s-eclipse .cm-operator { color: #d73a49 !important; }
.cm-s-eclipse .cm-string,
.cm-s-eclipse .cm-string-2 { color: #22863a !important; }
.cm-s-eclipse .cm-comment { color: #6a737d !important; font-style: italic; }
.cm-s-eclipse .cm-tag { color: #22863a !important; }
.cm-s-eclipse .cm-attribute { color: #6f42c1 !important; }
.cm-s-eclipse .cm-builtin { color: #e36209 !important; }
.cm-s-eclipse .cm-meta { color: #6a737d !important; }

.output-box table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 12px;
}

.output-box th,
.output-box td {
    border: 1px solid #cbd5e1;
    padding: 8px 10px;
    text-align: left;
}

.output-box th {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 600;
}

@media (max-width: 991px) {
    .code-playground-section:not(.vaanii-snippet-playground-root) .playground-textarea,
    .code-playground-section:not(.vaanii-snippet-playground-root) .output-box:not(.vaanii-snippet-output),
    .code-playground-section:not(.vaanii-snippet-playground-root) .CodeMirror {
        height: clamp(240px, 45vh, 480px);
        min-height: 240px;
    }

    .vaanii-snippet-playground-root .CodeMirror,
    .vaanii-snippet-inplace .CodeMirror,
    .cke_snr_widget_mount .CodeMirror {
        min-height: 0;
        height: auto;
    }

    .vaanii-snippet-inplace .output-box.vaanii-snippet-output,
    .vaanii-snippet-playground-root:not(.vaanii-snippet-editor-only) .output-box.vaanii-snippet-output,
    .cke_snr_widget_mount .output-box.vaanii-snippet-output {
        height: auto;
        min-height: 0;
        max-height: none;
    }

    .playground-toolbar {
        width: 100%;
        justify-content: flex-start;
    }
}

/*
 * Snippet embed: Eclipse chrome only (.cm-s-eclipse). Monokai (.cm-s-monokai) is unchanged
 * so lesson dark mode + JS theme switch work on any page (module reader, section_detail, CK).
 */
.vaanii-snippet-playground-root .CodeMirror.cm-s-eclipse,
.vaanii-snippet-inplace .CodeMirror.cm-s-eclipse,
.cke_snr_widget_mount .CodeMirror.cm-s-eclipse {
    background: #fafafa !important;
    color: #24292e !important;
}

.vaanii-snippet-playground-root .CodeMirror.cm-s-eclipse .CodeMirror-gutters,
.vaanii-snippet-inplace .CodeMirror.cm-s-eclipse .CodeMirror-gutters,
.cke_snr_widget_mount .CodeMirror.cm-s-eclipse .CodeMirror-gutters {
    background: #f5f5f5 !important;
    border-right: 1px solid #e0e0e0 !important;
}

.vaanii-snippet-playground-root .CodeMirror.cm-s-eclipse pre.CodeMirror-line,
.vaanii-snippet-inplace .CodeMirror.cm-s-eclipse pre.CodeMirror-line,
.cke_snr_widget_mount .CodeMirror.cm-s-eclipse pre.CodeMirror-line {
    background: transparent !important;
    color: inherit !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 0.25em !important;
}

.vaanii-snippet-playground-root .CodeMirror.cm-s-eclipse .CodeMirror-cursor,
.vaanii-snippet-inplace .CodeMirror.cm-s-eclipse .CodeMirror-cursor,
.cke_snr_widget_mount .CodeMirror.cm-s-eclipse .CodeMirror-cursor {
    border-left-color: #24292e !important;
}

.vaanii-snippet-playground-root,
.vaanii-snippet-inplace,
.cke_snr_widget_mount {
    color-scheme: light;
}

/*
 * Lesson reader — dark mode NOT selected: same explicit light chrome as the rest
 * of the light lesson (cards, headers, text) so the playground does not pick up
 * stray inherited colors from .section-content / authored HTML.
 */
.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace,
.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace .code-playground-section {
    color: #24292e;
}

.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace .playground-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace .playground-card-head {
    background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
    border-bottom-color: #e2e8f0;
    color: #1e293b;
}

.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace .playground-card-title,
.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace .editor-meta,
.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace .editor-tip,
.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace .vaanii-snippet-stats,
.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace .vaanii-snippet-output-stats {
    color: #1e293b;
}

.lesson-content-modern:not(.dark-mode) .vaanii-snippet-inplace .card-body {
    background: #ffffff;
}

/* Fullscreen reader — overlay not in dark mode (matches inline light fullscreen chrome) */
#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace,
#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace .code-playground-section {
    color: #24292e;
}

#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace .playground-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace .playground-card-head {
    background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
    border-bottom-color: #e2e8f0;
    color: #1e293b;
}

#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace .playground-card-title,
#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace .editor-meta,
#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace .editor-tip,
#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace .vaanii-snippet-stats,
#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace .vaanii-snippet-output-stats {
    color: #1e293b;
}

#fullscreen-overlay:not(.dark-mode) .vaanii-snippet-inplace .card-body {
    background: #ffffff;
}

/* Lesson / fullscreen dark mode: snippet cards, toolbar, output (CodeMirror theme = Monokai via JS) */
.lesson-content-modern.dark-mode .vaanii-snippet-inplace,
.lesson-content-modern.dark-mode .vaanii-snippet-playground-root,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace,
#fullscreen-overlay.dark-mode .vaanii-snippet-playground-root {
    color-scheme: dark;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .playground-card,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .playground-card {
    background: #1e222a !important;
    border-color: #3d4454 !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .playground-card-head,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .playground-card-head {
    background: linear-gradient(180deg, #2a303c 0%, #1e222a 100%) !important;
    border-bottom-color: #3d4454 !important;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .playground-card-title,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .playground-card-title {
    color: #e6edf3 !important;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .editor-meta,
.lesson-content-modern.dark-mode .vaanii-snippet-inplace .editor-tip,
.lesson-content-modern.dark-mode .vaanii-snippet-inplace .vaanii-snippet-stats,
.lesson-content-modern.dark-mode .vaanii-snippet-inplace .vaanii-snippet-output-stats,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .editor-meta,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .editor-tip,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .vaanii-snippet-stats,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .vaanii-snippet-output-stats {
    color: #94a3b8 !important;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .card-body,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .card-body {
    background: #1e222a !important;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .output-box,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .output-box {
    background: linear-gradient(165deg, #0f1720 0%, #1a2332 100%) !important;
    color: #e2e8f0 !important;
    border-color: #2b3642 !important;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .output-box > div,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .output-box > div {
    background: #151f2e !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
    box-shadow: none;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .playground-toolbar-icons .btn-outline-secondary,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .playground-toolbar-icons .btn-outline-secondary {
    color: #cbd5e1 !important;
    border-color: #64748b !important;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .playground-toolbar-icons .btn-outline-primary,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .playground-toolbar-icons .btn-outline-primary {
    color: #7dd3fc !important;
    border-color: #38bdf8 !important;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .playground-toolbar-icons .btn-outline-danger,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .playground-toolbar-icons .btn-outline-danger {
    color: #fca5a5 !important;
    border-color: #f87171 !important;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .playground-resize-handle,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .playground-resize-handle {
    background: linear-gradient(180deg, #2a303c, #1e222a) !important;
    border-color: #64748b !important;
}

.lesson-content-modern.dark-mode .vaanii-snippet-inplace .playground-resize-handle::after,
#fullscreen-overlay.dark-mode .vaanii-snippet-inplace .playground-resize-handle::after {
    background: #94a3b8 !important;
}

/* Snippet reader on Bootstrap 4 pages (AdminLTE section_detail): reader partial does not load BS5 */
.code-playground-section .gap-1 {
    gap: 0.25rem;
}
.code-playground-section .gap-2 {
    gap: 0.5rem;
}
.code-playground-section .badge.text-bg-secondary {
    color: #fff;
    background-color: #6c757d;
}
