#external-editor-status {
    display: flex;
    align-items: center;
    gap: 10px;
    max-height: 0;
    margin-bottom: 0;
    padding: 0 12px;
    border-radius: 14px;
    border: 0 solid var(--panel-border);
    background: var(--surface-tint);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
        max-height 0.22s ease,
        margin-bottom 0.22s ease,
        padding-top 0.22s ease,
        padding-bottom 0.22s ease,
        border-width 0.22s ease,
        opacity 0.18s ease;
}

#external-editor-status.is-visible {
    max-height: 52px;
    margin-bottom: 8px;
    padding-top: 9px;
    padding-bottom: 9px;
    border-width: 1px;
    opacity: 1;
    pointer-events: auto;
}

#external-editor-status.is-error {
    border-color: rgba(230, 44, 22, 0.38);
    background: rgba(108, 22, 18, 0.18);
}

:root[data-theme="light"] #external-editor-status.is-error {
    border-color: rgba(204, 60, 37, 0.28);
    background: rgba(255, 236, 232, 0.92);
}

#external-editor-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex: 0 0 auto;
    background: #22c55e;
}

#external-editor-status-dot.is-live {
    animation: external-editor-status-pulse 2.7s ease-in-out infinite;
}

#external-editor-status-dot.is-error {
    background: #ff5c5c;
    box-shadow: 0 0 0 0 rgba(255, 92, 92, 0.26);
    animation: none;
}

#external-editor-status-text {
    min-width: 0;
}

#external-editor-status-copy {
    min-width: 0;
    flex: 1 1 auto;
    display: inline;
    line-height: 1.35;
}

#external-editor-status-link {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    margin-left: 0.4em;
}

#external-editor-status-link:hover {
    text-decoration: underline;
}

@keyframes external-editor-status-pulse {
    0%,
    100% {
        opacity: 0.28;
    }

    50% {
        opacity: 1;
    }
}

#editor-tab-bar {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 6px;
}

#editor-tab-add {
    outline: none;
    max-width: 45px;
    appearance: none;
    background-color: var(--surface-soft);
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 14px 14px 0 0;
    border: 1px solid var(--panel-border);
    padding-top: 5px;
    padding-left: 14px;
    padding-right: 14px;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    cursor: pointer;
    color: var(--text);
}

.editor-tab-item {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    background-color: var(--tab-surface);
    border: 1px solid var(--panel-border);
    border-radius: 14px 14px 0 0;
    padding-top: 7px;
    padding-left: 8px;
    padding-right: 8px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    display: flex;
    gap: 5px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.editor-tab-item:hover {
    background-color: rgba(77, 182, 255, 0.28);
    border-color: rgba(77, 182, 255, 0.52);
    box-shadow: inset 0 0 0 1px rgba(77, 182, 255, 0.26);
}

:root[data-theme="light"] .editor-tab-item:hover {
    background-color: rgba(77, 182, 255, 0.30);
    border-color: rgba(17, 129, 200, 0.82);
    box-shadow:
        inset 0 0 0 1px rgba(77, 182, 255, 0.30),
        0 0 0 1px rgba(17, 129, 200, 0.20);
}

.editor-tab-item.is-broken {
    box-shadow:
        inset 0 0 0 2px rgba(255, 54, 54, 0.96),
        0 0 0 3px rgba(255, 54, 54, 0.34);
    color: #ffe0e0;
}

:root[data-theme="light"] .editor-tab-item.is-broken {
    color: #8f0900;
    box-shadow:
        inset 0 0 0 2px rgba(230, 44, 22, 0.9),
        0 0 0 3px rgba(230, 44, 22, 0.24);
}

.editor-tab-label {
    padding-left: 15px;
    padding-right: 0px;
}

.editor-tab-X {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1ch;
    margin-left: 4px;
    padding-left: 4px;
    line-height: 1;
    transform: translateY(-3px);
    cursor: pointer;
    transition: color 0.15s ease;
}

.editor-tab-X:hover {
    color: #ff5c5c;
}

#editor-yellow-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    margin-bottom: 5px;
    border-radius: 999px;
    opacity: 0.85;
}

#editor-shader-inputs-bar {
    background-color: var(--surface-tint);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    padding: 8px 10px;
    min-height: 34px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid var(--panel-border);
    color: var(--text);
}

#editor-shader-uniforms {
    height: 0px;
    font-size: 10px;
    background-color: var(--code-bg);
    padding-left: 10px;
    padding-right: 10px;
    margin-bottom: 5px;
    overflow: hidden;
    overflow-x: scroll;
    transition: height 0.3s ease;
    font-family: monospace;
    color: var(--code-text);
    border-left: 1px solid var(--panel-border);
    border-right: 1px solid var(--panel-border);
    border-bottom: 1px solid var(--panel-border);
}

#editor-area {
    display: flex;
    height: 60vh;
    overflow-y: auto;
    overflow-x: scroll;
    position: relative;
    transition: box-shadow 0.16s ease;
}

#editor-line-numbers-div {
    flex-shrink: 0;
    padding-right: 8px;
    padding-top: 8px;
    border-right: 1px solid var(--code-line);
    background-color: var(--line-number-bg);
    color: var(--line-number-text);
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
    overflow: hidden;
    position: relative;
}

#editor-line-numbers-code {
    font-size: 12px;
    font-family: monospace;
    font-weight: 900;
    margin: 0px;
}

#editor-content-div {
    flex-grow: 1;
    background-color: var(--code-bg);
    padding-top: 8px;
    padding-left: 10px;
    color: var(--text);
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    position: relative;
}

#editor-content-div > pre {
    min-height: 100%;
    margin: 0;
}

#editor-content-code {
    display: block;
    font-size: 12px;
    font-family: monospace;
    font-weight: 900;
    margin: 0px;
    min-height: 100%;
    outline: none;
    position: relative;
    width: 100%;
    z-index: 1;
}

#editor-section.compile-error #editor-area {
    box-shadow:
        0 0 0 2px rgba(255, 92, 92, 0.58),
        0 0 24px rgba(255, 92, 92, 0.18);
}

:root[data-theme="light"] #editor-section.compile-error #editor-area {
    box-shadow:
        0 0 0 3px rgba(204, 60, 37, 0.62),
        0 0 0 7px rgba(204, 60, 37, 0.16),
        0 0 30px rgba(204, 60, 37, 0.24);
}

#editor-section.compile-success #editor-area {
    box-shadow:
        0 0 0 2px rgba(83, 215, 135, 0.52),
        0 0 22px rgba(83, 215, 135, 0.16);
}

:root[data-theme="light"] #editor-section.compile-success #editor-area {
    box-shadow:
        0 0 0 3px rgba(46, 166, 88, 0.60),
        0 0 0 7px rgba(46, 166, 88, 0.16),
        0 0 28px rgba(46, 166, 88, 0.22);
}

#editor-inline-errors,
#editor-line-error-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

#editor-inline-errors {
    top: 8px;
    left: 10px;
    right: 10px;
    bottom: 8px;
}

#editor-line-error-overlay {
    top: 8px;
    left: 0;
    right: 0;
    bottom: 8px;
}

.editor-inline-error {
    position: absolute;
    left: 0;
    right: 0;
    padding: 3px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 92, 92, 0.56);
    background: rgba(72, 12, 12, 0.94);
    color: #ffd7d7;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.3;
    white-space: pre-wrap;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.editor-inline-error.is-visible {
    opacity: 1;
}

:root[data-theme="light"] .editor-inline-error {
    border-color: rgba(204, 60, 37, 0.38);
    background: rgba(255, 234, 228, 0.98);
    color: #8c1805;
}

.editor-line-error-marker {
    position: absolute;
    left: 4px;
    right: 4px;
    min-height: 15px;
    padding: 0 4px;
    border-radius: 5px;
    background: #ff2a2a;
    color: #ffffff;
    font-family: monospace;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .editor-line-error-marker {
    background: #e12612;
    color: #ffffff;
}

#controls-panel {
    display: none;
    flex-direction: column;
    gap: 10px;
    min-height: 60vh;
    padding: 12px;
    background-color: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
}

.controls-panel-row {
    display: grid;
    grid-template-columns: minmax(108px, 156px) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
}

.controls-panel-row-toggle {
    grid-template-columns: minmax(108px, 156px) minmax(0, 1fr);
}

.controls-panel-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.controls-panel-label-hinted {
    cursor: help;
}

.controls-panel-input {
    width: 100%;
    accent-color: rgba(77, 182, 255, 0.72);
}

.controls-panel-control {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
}

.controls-panel-value {
    font-family: monospace;
    font-size: 12px;
    text-align: left;
    color: var(--muted);
    min-width: 48px;
}

.controls-panel-empty {
    font-size: 13px;
    color: var(--muted);
}

.controls-panel-group {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent-2);
}

.controls-panel-group:first-child {
    margin-top: 0;
}

#editor-controls-bar {
    display: flex;
    margin-top: 5px;
    margin-bottom: 10px;
    background-color: var(--surface-tint);
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    border: 1px solid var(--panel-border);
}

.editor-button {
    padding: 5px;
    padding-left: 8px;
    padding-right: 8px;
    cursor: pointer;
    font-size:24px;
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.editor-button-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.editor-button:hover {
    border-color: rgba(77, 182, 255, 0.42);
    background-color: rgba(77, 182, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(77, 182, 255, 0.14);
}

.editor-button:active {
    background-color: rgba(255, 255, 255, 0.12);
}

.editor-button.is-active {
    border-color: rgba(255, 138, 61, 0.4);
    background-color: rgba(255, 138, 61, 0.16);
}

#editor-channels-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.editor-channel-tile {
    display: flex;
    flex-direction: column;
    color: var(--text);
    font-weight: 800;
    border-radius: 14px;
    background-color: var(--surface-tint);
    border: 1px solid var(--panel-border);
    overflow: hidden;
}

.editor-channel-label {
    padding: 8px 8px 6px;
    font-size: 12px;
}

.editor-channel-select {
    width: 100%;
    color: var(--text);
    background: var(--surface-tint);
    border: 0;
    border-top: 1px solid var(--panel-border);
    border-radius: 0;
    padding: 6px 8px;
    font-size: 13px;
}

#editor-tab-add:hover,
.editor-channel-select:hover,
.controls-panel-input:hover,
.controls-panel-color:hover {
    border-color: rgba(77, 182, 255, 0.42);
    background-color: rgba(77, 182, 255, 0.1);
}

.controls-panel-checkbox,
.controls-panel-color {
    accent-color: var(--accent);
}
