#game-brain-editor:not([hidden]) {
    position: absolute;
    inset: 8% 5%;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    background: #0c1820;
    color: #e8fff5;
    border: 1px solid #59cdb4;
    border-radius: 10px;
    box-shadow: 0 12px 40px #000a;
}
.brain-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brain-workspace { position: relative; flex: 1; min-height: 100px; overflow: hidden; background: #10232b; }
.brain-lines, .brain-marks, .brain-highlight, #game-brain-source {
    box-sizing: border-box;
    margin: 0;
    padding: 12px;
    font: 15px/1.5 monospace;
    tab-size: 4;
    white-space: pre;
    border: 0;
}
.brain-lines { position: absolute; inset: 0 auto 0 0; width: 52px; overflow: hidden; color: #83a69e; text-align: right; }
.brain-highlight, #game-brain-source { position: absolute; inset: 0 0 0 52px; width: calc(100% - 52px); height: 100%; overflow: auto; }
.brain-highlight { pointer-events: none; color: #e8fff5; }
#game-brain-source { z-index: 2; background: transparent; color: transparent; caret-color: white; resize: none; outline: 1px solid #59cdb4; }
#game-brain-source::selection { background: #50cbb455; color: transparent; }
.lua-keyword { color: #c792ea; }
.lua-string { color: #c3e88d; }
.lua-comment { color: #89a1a1; }
.lua-number { color: #f7b76b; }
.lua-api { color: #82d5f7; }
.brain-completions:not([hidden]) {
    position: absolute;
    z-index: 4;
    display: flex;
    flex-direction: column;
    width: min(380px, calc(100% - 8px));
    max-height: min(216px, 60%);
    overflow-y: auto;
    padding: 2px 0;
    background: #071116;
    border: 1px solid #3e6f68;
    border-radius: 4px;
    box-shadow: 0 6px 18px #000b;
}
.brain-completion {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
    padding: 0 8px 0 4px;
    font: 14px/22px monospace;
    color: #cde9df;
    white-space: nowrap;
    cursor: pointer;
}
.brain-completion[aria-selected="true"] { background: #27584f; color: #ffffff; outline: 1px solid #59edc7; outline-offset: -1px; }
.brain-completion-label { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.brain-completion-label b { color: #59edc7; font-weight: bold; }
.brain-completion small { flex: 1 1 auto; min-width: 0; margin-left: 12px; overflow: hidden; text-overflow: ellipsis; text-align: right; color: #83a69e; font-size: 12px; }
.brain-kind { flex: none; width: 18px; font: bold 12px/18px monospace; text-align: center; border-radius: 3px; }
.brain-kind-function { color: #c792ea; }
.brain-kind-field { color: #82d5f7; }
.brain-kind-variable { color: #f7b76b; }
.brain-kind-keyword { color: #e8fff5; }
.brain-kind-text { color: #83a69e; font-size: 9px; }
.brain-completion-doc:not([hidden]) {
    position: absolute;
    z-index: 4;
    max-width: min(320px, 70%);
    max-height: 216px;
    overflow: auto;
    padding: 6px 8px;
    font: 13px/1.4 monospace;
    white-space: pre-wrap;
    color: #cde9df;
    background: #071116;
    border: 1px solid #3e6f68;
    border-radius: 4px;
    box-shadow: 0 6px 18px #000b;
}
.brain-status, .brain-help { font: 12px/1.4 monospace; color: #add0c5; }
.brain-marks { position: absolute; inset: 0 0 0 52px; width: calc(100% - 52px); height: 100%; overflow: hidden; z-index: 1; color: transparent; pointer-events: none; }
.brain-marks span { text-decoration-skip-ink: none; }
.brain-diag-error { text-decoration: underline wavy #ff5f6d; text-underline-offset: 3px; background: #ff5f6d1f; }
.brain-diag-warning { text-decoration: underline wavy #ffc44d; text-underline-offset: 3px; }
.brain-diag-info { text-decoration: underline dotted #6fb8ff; text-underline-offset: 3px; }
.brain-diag-hint { text-decoration: underline dotted #83a69e; text-underline-offset: 3px; }
.brain-unnecessary { background: #10232b8c; }
.brain-read { background: #59cdb433; }
.brain-write { background: #f7b76b40; }
.brain-lines span[class] { font-weight: bold; }
.brain-gutter-error { color: #ff5f6d; }
.brain-gutter-warning { color: #ffc44d; }
.brain-gutter-info, .brain-gutter-hint { color: #6fb8ff; }
.brain-tooltip:not([hidden]) {
    position: absolute;
    z-index: 3;
    max-width: min(420px, 80%);
    padding: 8px 10px;
    font: 13px/1.4 monospace;
    white-space: pre-wrap;
    color: #e8fff5;
    background: #071116;
    border: 1px solid #59cdb4;
    border-radius: 6px;
    pointer-events: none;
}
.brain-actions:not([hidden]), .brain-rename:not([hidden]) { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.brain-actions button, .brain-rename button, .brain-problems button {
    font: 13px monospace;
    color: #e8fff5;
    background: #17333d;
    border: 1px solid #527c76;
    border-radius: 4px;
    padding: 4px 8px;
}
.brain-rename input { font: 14px monospace; color: #e8fff5; background: #10232b; border: 1px solid #59cdb4; padding: 4px 6px; }
.brain-info { min-height: 1.4em; font: 13px/1.4 monospace; color: #cde9df; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brain-problems { display: flex; flex-direction: column; gap: 2px; max-height: 96px; overflow: auto; font: 12px/1.4 monospace; color: #add0c5; }
.brain-problems button { text-align: left; background: transparent; border: 0; padding: 1px 4px; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.brain-problems button:hover, .brain-problems button:focus-visible { background: #17333d; }
.brain-problems-title { font-weight: bold; }
.brain-problems .brain-problem-error { color: #ff8a93; }
.brain-problems .brain-problem-warning { color: #ffd480; }
.brain-problems .brain-problem-info, .brain-problems .brain-problem-hint { color: #9cccff; }
@media (max-width: 600px), (max-height: 520px) {
    .brain-help { display: none; }
    .brain-problems { max-height: 64px; }
}
