/* Slide code-runner: the small launch button + the centered run overlay.
   Scoped to not disturb the deck's fixed-canvas layout. */

.cr-launch {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.35rem 0.8rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.cr-launch:hover { background: #1e293b; }

.cr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}
.cr-overlay.open { display: flex; }

.cr-panel {
    background: #fff;
    border-radius: 14px;
    width: min(760px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    font-family: 'Inter', sans-serif;
}

.cr-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}
.cr-title { font-weight: 700; color: #0f172a; font-size: 0.95rem; }
.cr-close { border: none; background: none; font-size: 1.4rem; line-height: 1; color: #64748b; cursor: pointer; }
.cr-close:hover { color: #0f172a; }

.cr-code {
    margin: 0.9rem 1rem 0;
    /* Same content-driven sizing as .lab-code — code-runner.js calls autoGrow().
       The old min-height/max-height pair scrolled anything past ~5 lines. */
    overflow-y: hidden;
    max-height: 60vh;   /* only a ceiling for very long snippets inside the overlay */
    resize: vertical;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    font-family: 'SF Mono', 'Fira Code', Menlo, Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #0f172a;
    tab-size: 4;
}

.cr-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 1rem;
}
.cr-run { background: #0E7490; color: #fff; border: none; border-radius: 8px; padding: 0.45rem 1.1rem; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.cr-run:hover { background: #0c5f77; }
.cr-run:disabled { opacity: 0.6; cursor: default; }
.cr-reset { background: #fff; color: #475569; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0.45rem 0.9rem; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.cr-reset:hover { background: #f1f5f9; }
.cr-status { color: #64748b; font-size: 0.85rem; }

.cr-output {
    margin: 0 1rem 1rem;
    min-height: 3rem;
    max-height: 30vh;
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
    font-family: 'SF Mono', 'Fira Code', Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.cr-output.ok { color: #86efac; }
.cr-output.err { color: #fca5a5; }

@media (prefers-reduced-motion: reduce) {
    .cr-overlay { transition: none; }
}

/* Colour-coded editor (code-editor.js) in the overlay: same place and ceiling as .cr-code */
.cr-panel .CodeMirror { margin: 0.9rem 1rem 0; }
.cr-panel .CodeMirror-scroll { max-height: 60vh; }
