/* ============================================================
 *  css/shell.css  —— 代码面板布局（原版 Scratch/浅色风格）
 * ============================================================ */
:root {
    --code-bg: #FFFFFF;
    --code-fg: #575E75;
    --code-ln: #B0B8BF;
    --code-line: rgba(0, 0, 0, 0.12);
    --code-sel: rgba(76, 151, 255, 0.25);
    --code-syn-comment: #6A737D;
    --code-syn-string: #032F62;
    --code-syn-number: #005CC5;
    --code-syn-keyword: #D73A49;
    --code-syn-variable: #005CC5;
    --code-syn-func: #6F42C1;
    --code-err: #D1242F;
    --code-sys: #1A7F37;
}

.code-panel { display: flex; flex-shrink: 0; width: 380px; min-width: 220px; max-width: 70vw; }
.code-panel.collapsed { width: 0 !important; min-width: 0 !important; overflow: hidden; }
.code-panel-inner { flex: 1; display: flex; flex-direction: column; background: var(--code-bg); min-width: 0; }

.code-header {
    min-height: 42px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--code-line);
    display: flex; align-items: center;
    padding: 0 8px 0 14px;
    font-size: 13px; font-weight: 600; color: var(--gui-text, #575E75);
    gap: 8px; flex-shrink: 0;
}
.code-header .spacer { flex: 1; }
.code-header button {
    height: 28px; padding: 0 10px;
    border-radius: 4px;
    font-size: 12px; color: var(--gui-text, #575E75);
    background: #F2F2F2;
}
.code-header button:hover { background: #E6E6E6; }

.code-body { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.code-scroll { flex: 1; display: flex; min-height: 0; overflow: hidden; background: var(--code-bg); }

.line-numbers {
    flex-shrink: 0;
    padding: 12px 8px;
    color: var(--code-ln);
    font-family: var(--gui-mono, monospace);
    font-size: var(--code-font-size, 13px);
    line-height: 1.55;
    text-align: right;
    overflow: hidden; user-select: none;
    border-right: 1px solid var(--code-line);
    white-space: pre; min-width: 40px;
}
.code-view { flex: 1; min-width: 0; position: relative; overflow: hidden; }
.code-highlight, .code-output {
    position: absolute; inset: 0; margin: 0; padding: 12px;
    font-family: var(--gui-mono, monospace);
    font-size: var(--code-font-size, 13px);
    line-height: 1.55; white-space: pre; overflow: auto;
    tab-size: 4; box-sizing: border-box;
}
.code-highlight { background: var(--code-bg); color: var(--code-fg); z-index: 1; pointer-events: none; user-select: none; }
.code-highlight::-webkit-scrollbar { display: none; }
.code-output {
    background: transparent; color: transparent; caret-color: var(--code-fg);
    z-index: 2; border: none; outline: none; resize: none; min-height: 0;
}
.code-output::selection { background: var(--code-sel); }

.lua-comment  { color: var(--code-syn-comment); font-style: italic; }
.lua-string   { color: var(--code-syn-string); }
.lua-number   { color: var(--code-syn-number); }
.lua-keyword  { color: var(--code-syn-keyword); }
.lua-variable { color: var(--code-syn-variable); }
.lua-func     { color: var(--code-syn-func); }

.h-resizer { height: 6px; flex-shrink: 0; cursor: row-resize; background: var(--code-line); display: none; }
.h-resizer.visible { display: block; }
.h-resizer:hover { background: var(--gui-blue, #4C97FF); }
.run-output {
    height: 200px; min-height: 60px; flex-shrink: 0;
    border-top: 1px solid var(--code-line);
    background: #F9F9F9; color: var(--gui-text, #575E75);
    font-family: var(--gui-mono, monospace); font-size: 12px;
    padding: 10px 12px; overflow-y: auto; white-space: pre-wrap; line-height: 1.55; display: none;
}
.run-output.visible { display: block; }
.run-output .err { color: var(--code-err); }
.run-output .sys { color: var(--code-sys); }

body.dragging-h, body.dragging-v { user-select: none; -webkit-user-select: none; }
body.dragging-h { cursor: row-resize !important; }
body.dragging-v { cursor: col-resize !important; }
