:root {
    --bg: #15171c;
    --panel: #1c1f26;
    --line: #2b2f39;
    --text: #d8dbe2;
    --muted: #8a90a0;
    --accent: #4f9dff;
    --error: #ff8f7a;
    --ok: #7fd18b;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font: 13px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
    overflow: hidden;
}

header {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    padding: 0 12px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-weight: 600;
    font-size: 15px;
    margin-right: 8px;
    white-space: nowrap;
}

.brand span {
    color: var(--accent);
}

.field {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    white-space: nowrap;
}

select, button {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 4px 10px;
    font: inherit;
    cursor: pointer;
}

button:hover, select:hover {
    border-color: var(--accent);
}

#run {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.status {
    margin-left: auto;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status.bad {
    color: var(--error);
}

.status.good {
    color: var(--ok);
}

main {
    display: flex;
    height: calc(100% - 44px);
}

#viewport {
    position: relative;
    flex: 0 0 55%;
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

#stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

/* Out of the flow, so that giving the canvas more pixels never makes its box grow. */
#evergine-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    outline: none;
}

#credits {
    position: absolute;
    left: 10px;
    bottom: 8px;
    max-width: calc(100% - 20px);
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.45);
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    pointer-events: none;
}

#console {
    flex: 0 0 auto;
    max-height: 30%;
    overflow-y: auto;
    padding: 6px 10px;
    background: var(--panel);
    border-top: 1px solid var(--line);
    font: 12px/1.45 ui-monospace, "Cascadia Code", Consolas, monospace;
    white-space: pre-wrap;
}

#console:empty {
    display: none;
}

#console .error {
    color: var(--error);
}

#console .warn {
    color: #ffd27a;
}

#splitter {
    flex: 0 0 5px;
    cursor: col-resize;
    background: var(--line);
}

#editor-pane {
    flex: 1 1 auto;
    min-width: 200px;
    position: relative;
}

#editor {
    position: absolute;
    inset: 0;
}

#editor textarea {
    width: 100%;
    height: 100%;
    resize: none;
    border: 0;
    padding: 10px;
    background: #1e1e1e;
    color: #d4d4d4;
    font: 13px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace;
    outline: none;
}

@media (max-width: 800px) {
    main {
        flex-direction: column;
    }

    #viewport {
        flex-basis: 45%;
    }

    #splitter {
        display: none;
    }

    .field.check, .brand span {
        display: none;
    }
}
