/* ══════════════════════════════════════════════════════════════
   Tutorial interactive — styles for WASM-powered live SQL
   ══════════════════════════════════════════════════════════════ */

/* ── Sticky reset bar ─────────────────────────────────────── */
.tutorial-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
}
.tutorial-bar .bar-status {
    color: var(--fg-dim);
    font-style: italic;
}
.tutorial-bar .bar-status.error {
    color: var(--accent);
    font-style: normal;
}
.tutorial-bar button {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 0.85rem;
    padding: 0.25rem 0.8rem;
    border: 1px solid var(--rule);
    background: var(--bg);
    color: var(--fg);
    border-radius: 3px;
    cursor: pointer;
}
.tutorial-bar button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Run button per block ─────────────────────────────────── */
.sql-run-btn {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 0.85rem;
    padding: 0.2rem 0.7rem;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.sql-run-btn:hover {
    background: #800;
    border-color: #800;
}
.sql-run-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ── Run All button ───────────────────────────────────────── */
.run-all-btn {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 0.85rem;
    padding: 0.25rem 0.8rem;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 600;
}
.run-all-btn:hover {
    background: #800;
    border-color: #800;
}

/* ── Editor wrap (textarea over highlighted code) ─────────── */
.tut-editor-wrap {
    position: relative;
    min-height: 80px;
    border: 1px solid var(--rule);
    border-left: 3px solid var(--accent);
    background: var(--code-bg);
    margin: 0;
}
.tut-editor-wrap pre {
    margin: 0;
    padding: 0.8rem 1rem;
    border: none;
    background: transparent;
    font-family: 'Menlo', 'Consolas', 'DejaVu Sans Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
}
.tut-editor-wrap pre code {
    font-family: inherit;
    font-size: inherit;
    background: none;
    padding: 0;
    border-radius: 0;
}
.tut-editor-wrap pre code.hljs {
    background: transparent;
    padding: 0;
}
.tut-editor-wrap textarea {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    font-family: 'Menlo', 'Consolas', 'DejaVu Sans Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    padding: 0.8rem 1rem;
    border: none;
    background: transparent;
    color: transparent;
    caret-color: var(--fg);
    resize: none;
    tab-size: 4;
    outline: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
}
.tut-editor-wrap textarea::selection {
    background: rgba(160, 0, 0, 0.2);
    color: transparent;
}

/* ── query-pair layout override when interactive ──────────── */
.query-pair.interactive {
    flex-direction: column;
    gap: 0;
}
.query-pair.interactive > pre {
    /* hide original static pre — replaced by editor-wrap */
    display: none;
}
.query-pair.interactive .tut-editor-wrap {
    margin-bottom: 0.5rem;
}

/* ── Live result area ─────────────────────────────────────── */
.live-result {
    margin: 0.4rem 0 0.8rem 0;
}
.live-result .live-status {
    font-size: 0.82rem;
    color: var(--fg-dim);
    font-style: italic;
    margin-bottom: 0.3rem;
}
.live-result .live-status.error {
    color: var(--accent);
    font-style: normal;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.78rem;
}

/* ── Expected result toggle ───────────────────────────────── */
details.expected-result {
    margin: 0.3rem 0 0.6rem 0;
}
details.expected-result summary {
    font-size: 0.82rem;
    color: var(--fg-dim);
    cursor: pointer;
    font-style: italic;
    user-select: none;
}
details.expected-result summary:hover {
    color: var(--accent);
}

/* ── Setup block status ───────────────────────────────────── */
.setup-status {
    font-size: 0.82rem;
    color: var(--fg-dim);
    font-style: italic;
    margin: 0.2rem 0 0.6rem 0;
}
.setup-status.error {
    color: var(--accent);
    font-style: normal;
}
.setup-status.ok {
    color: #1a7a1a;
}
