/* ===== МОДАЛЬНОЕ ОКНО РЕДАКТОРА КОДА ===== */

.editor-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.editor-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

body.light-theme .editor-modal-overlay {
    background-color: rgba(255, 255, 255, 0.85);
}

/* Блокировка прокрутки страницы */
body.modal-open-editor {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

.editor-modal {
    width: 100%;
    max-width: 1120px;
    height: 90vh;
    max-height: 800px;
    background-color: #0a0a0a;
    border: 1px solid #333;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    transform: translateY(30px) scale(0.95);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.5s ease, border-color 0.5s ease;
}

.editor-modal-overlay.active .editor-modal {
    transform: translateY(0) scale(1);
}

body.light-theme .editor-modal {
    background-color: #ffffff;
    border: 1px solid #ddd;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* ===== ЗАГОЛОВОК ===== */
.editor-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    transition: border-color 0.5s ease;
}

body.light-theme .editor-modal-header {
    border-bottom: 1px solid #ddd;
}

.editor-modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    transition: color 0.5s ease;
}

.editor-modal-title svg {
    width: 22px;
    height: 22px;
    color: #B7FF69;
}

body.light-theme .editor-modal-title {
    color: #000000;
}

body.light-theme .editor-modal-title svg {
    color: #480096;
}

/* ===== Кнопка "Развернуть во весь экран" ===== */
.editor-modal-fullscreen {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    margin-right: 8px;
}

.editor-modal-fullscreen:hover {
    background-color: rgba(255, 255, 255, 0.18);
    transform: scale(1.1);
}

.editor-modal-fullscreen svg {
    width: 18px;
    height: 18px;
    color: #FFFFFF;
    transition: color 0.5s ease;
}

body.light-theme .editor-modal-fullscreen {
    background-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .editor-modal-fullscreen:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .editor-modal-fullscreen svg {
    color: #000000;
}

/* ===== Кнопка "Открыть в новой вкладке" ===== */
.editor-modal-newtab {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    margin-right: 8px;
}

.editor-modal-newtab:hover {
    background-color: rgba(255, 255, 255, 0.18);
    transform: scale(1.1);
}

.editor-modal-newtab svg {
    width: 18px;
    height: 18px;
    color: #FFFFFF;
    transition: color 0.5s ease;
}

body.light-theme .editor-modal-newtab {
    background-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .editor-modal-newtab:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .editor-modal-newtab svg {
    color: #000000;
}

/* ===== Кнопка закрытия ===== */
.editor-modal-close {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.editor-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.18);
    transform: scale(1.1);
}

.editor-modal-close svg {
    width: 20px;
    height: 20px;
    color: #FFFFFF;
    transition: color 0.5s ease;
}

body.light-theme .editor-modal-close {
    background-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .editor-modal-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .editor-modal-close svg {
    color: #000000;
}

/* ===== ПАНЕЛЬ ИНСТРУМЕНТОВ ===== */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: #111;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
    flex-wrap: nowrap;
    position: relative;
    z-index: 10;
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

body.light-theme .editor-toolbar {
    background-color: #f0f0f0;
    border-bottom: 1px solid #e0e0e0;
}

.editor-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #FFFFFF;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.editor-toolbar-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.editor-toolbar-btn:active {
    transform: scale(0.97);
}

.editor-toolbar-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.editor-toolbar-btn.primary {
    background-color: rgba(183, 255, 105, 0.12);
    border-color: rgba(183, 255, 105, 0.3);
    color: #B7FF69;
}

.editor-toolbar-btn.primary:hover {
    background-color: rgba(183, 255, 105, 0.2);
    border-color: rgba(183, 255, 105, 0.5);
}

.editor-toolbar-btn.danger {
    background-color: rgba(255, 80, 80, 0.1);
    border-color: rgba(255, 80, 80, 0.25);
    color: #ff8080;
}

.editor-toolbar-btn.danger:hover {
    background-color: rgba(255, 80, 80, 0.18);
    border-color: rgba(255, 80, 80, 0.45);
}

/* ===== Кнопка "Запустить" ===== */
.editor-toolbar-btn.run {
    background-color: rgba(0, 200, 100, 0.12);
    border-color: rgba(0, 200, 100, 0.3);
    color: #4ADE80;
}

.editor-toolbar-btn.run:hover {
    background-color: rgba(0, 200, 100, 0.2);
    border-color: rgba(0, 200, 100, 0.5);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.15);
}

body.light-theme .editor-toolbar-btn.run {
    background-color: rgba(0, 150, 70, 0.08);
    border-color: rgba(0, 150, 70, 0.25);
    color: #0A7A3A;
}

body.light-theme .editor-toolbar-btn.run:hover {
    background-color: rgba(0, 150, 70, 0.15);
    border-color: rgba(0, 150, 70, 0.45);
}

/* ===== Кнопка "Отладчик" ===== */
.editor-toolbar-btn.debug {
    background-color: rgba(255, 165, 0, 0.12);
    border-color: rgba(255, 165, 0, 0.3);
    color: #FFA500;
}

.editor-toolbar-btn.debug:hover {
    background-color: rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.5);
    box-shadow: 0 0 12px rgba(255, 165, 0, 0.15);
}

body.light-theme .editor-toolbar-btn.debug {
    background-color: rgba(200, 120, 0, 0.08);
    border-color: rgba(200, 120, 0, 0.25);
    color: #B45F06;
}

body.light-theme .editor-toolbar-btn.debug:hover {
    background-color: rgba(200, 120, 0, 0.15);
    border-color: rgba(200, 120, 0, 0.45);
}

/* ===== Кнопка "Шаг" (Step Into) ===== */
.editor-toolbar-btn.step {
    background-color: rgba(150, 100, 255, 0.12);
    border-color: rgba(150, 100, 255, 0.3);
    color: #B794F6;
}

.editor-toolbar-btn.step:hover {
    background-color: rgba(150, 100, 255, 0.2);
    border-color: rgba(150, 100, 255, 0.5);
    box-shadow: 0 0 12px rgba(183, 148, 246, 0.15);
}

body.light-theme .editor-toolbar-btn.step {
    background-color: rgba(100, 50, 200, 0.08);
    border-color: rgba(100, 50, 200, 0.25);
    color: #6B46C1;
}

body.light-theme .editor-toolbar-btn.step:hover {
    background-color: rgba(100, 50, 200, 0.15);
    border-color: rgba(100, 50, 200, 0.45);
}

/* ===== Кнопка "Шаг с обходом" (Step Over) ===== */
.editor-toolbar-btn.step-over {
    background-color: rgba(100, 180, 255, 0.12);
    border-color: rgba(100, 180, 255, 0.3);
    color: #64B4FF;
}

.editor-toolbar-btn.step-over:hover {
    background-color: rgba(100, 180, 255, 0.2);
    border-color: rgba(100, 180, 255, 0.5);
    box-shadow: 0 0 12px rgba(100, 180, 255, 0.15);
}

body.light-theme .editor-toolbar-btn.step-over {
    background-color: rgba(0, 100, 200, 0.08);
    border-color: rgba(0, 100, 200, 0.25);
    color: #0056B3;
}

body.light-theme .editor-toolbar-btn.step-over:hover {
    background-color: rgba(0, 100, 200, 0.15);
    border-color: rgba(0, 100, 200, 0.45);
}

/* ===== Кнопка "Шаг с выходом" (Step Out) ===== */
.editor-toolbar-btn.step-out {
    background-color: rgba(255, 200, 100, 0.12);
    border-color: rgba(255, 200, 100, 0.3);
    color: #FFC864;
}

.editor-toolbar-btn.step-out:hover {
    background-color: rgba(255, 200, 100, 0.2);
    border-color: rgba(255, 200, 100, 0.5);
    box-shadow: 0 0 12px rgba(255, 200, 100, 0.15);
}

body.light-theme .editor-toolbar-btn.step-out {
    background-color: rgba(200, 130, 0, 0.08);
    border-color: rgba(200, 130, 0, 0.25);
    color: #8B5A00;
}

body.light-theme .editor-toolbar-btn.step-out:hover {
    background-color: rgba(200, 130, 0, 0.15);
    border-color: rgba(200, 130, 0, 0.45);
}

/* ===== Кнопка "Остановить" (Stop) ===== */
.editor-toolbar-btn.stop {
    background-color: rgba(255, 60, 60, 0.15);
    border-color: rgba(255, 60, 60, 0.4);
    color: #FF6060;
}

.editor-toolbar-btn.stop:hover {
    background-color: rgba(255, 60, 60, 0.25);
    border-color: rgba(255, 60, 60, 0.6);
    box-shadow: 0 0 12px rgba(255, 60, 60, 0.2);
}

body.light-theme .editor-toolbar-btn.stop {
    background-color: rgba(200, 0, 0, 0.08);
    border-color: rgba(200, 0, 0, 0.25);
    color: #c00;
}

body.light-theme .editor-toolbar-btn.stop:hover {
    background-color: rgba(200, 0, 0, 0.15);
    border-color: rgba(200, 0, 0, 0.45);
    box-shadow: 0 0 12px rgba(200, 0, 0, 0.15);
}

body.light-theme .editor-toolbar-btn {
    background-color: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #000000;
}

body.light-theme .editor-toolbar-btn:hover {
    background-color: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
}

body.light-theme .editor-toolbar-btn.primary {
    background-color: rgba(72, 0, 150, 0.08);
    border-color: rgba(72, 0, 150, 0.25);
    color: #480096;
}

body.light-theme .editor-toolbar-btn.primary:hover {
    background-color: rgba(72, 0, 150, 0.15);
    border-color: rgba(72, 0, 150, 0.45);
}

body.light-theme .editor-toolbar-btn.danger {
    background-color: rgba(200, 0, 0, 0.06);
    border-color: rgba(200, 0, 0, 0.2);
    color: #c00;
}

body.light-theme .editor-toolbar-btn.danger:hover {
    background-color: rgba(200, 0, 0, 0.12);
    border-color: rgba(200, 0, 0, 0.4);
}

.editor-toolbar-spacer {
    flex: 1 1 auto;
    min-width: 0;
}

/* ===== КНОПКА ПЕРЕКЛЮЧЕНИЯ ЛИНИЙ СВЯЗЕЙ МЕТОК ===== */
.editor-toolbar-btn.lines-toggle {
    background-color: rgba(150, 150, 255, 0.08);
    border-color: rgba(150, 150, 255, 0.25);
    color: #A0A0FF;
}

.editor-toolbar-btn.lines-toggle:hover {
    background-color: rgba(150, 150, 255, 0.18);
    border-color: rgba(150, 150, 255, 0.45);
    box-shadow: 0 0 12px rgba(150, 150, 255, 0.15);
}

.editor-toolbar-btn.lines-toggle.active {
    background-color: rgba(150, 150, 255, 0.22);
    border-color: rgba(150, 150, 255, 0.6);
    color: #C8C8FF;
    box-shadow: 0 0 10px rgba(150, 150, 255, 0.25);
}

body.light-theme .editor-toolbar-btn.lines-toggle {
    background-color: rgba(80, 80, 200, 0.06);
    border-color: rgba(80, 80, 200, 0.2);
    color: #5050A0;
}

body.light-theme .editor-toolbar-btn.lines-toggle:hover {
    background-color: rgba(80, 80, 200, 0.12);
    border-color: rgba(80, 80, 200, 0.4);
}

body.light-theme .editor-toolbar-btn.lines-toggle.active {
    background-color: rgba(80, 80, 200, 0.18);
    border-color: rgba(80, 80, 200, 0.55);
    color: #3838A0;
    box-shadow: 0 0 10px rgba(80, 80, 200, 0.2);
}

/* ===== ВЫБОР ПРОЦЕССОРА ===== */

.editor-processor-select {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.editor-processor-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #FFFFFF;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.editor-processor-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.editor-processor-btn:active {
    transform: scale(0.97);
}

.editor-processor-btn svg.processor-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.editor-processor-btn svg.chevron-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-left: 2px;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.editor-processor-select.open .editor-processor-btn svg.chevron-icon {
    transform: rotate(180deg);
}

body.light-theme .editor-processor-btn {
    background-color: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #000000;
}

body.light-theme .editor-processor-btn:hover {
    background-color: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Выпадающий список */
.editor-processor-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: max-content;
    max-width: 260px;
    background-color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.editor-processor-select.open .editor-processor-dropdown {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

body.light-theme .editor-processor-dropdown {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.editor-processor-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #FFFFFF;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    border: none;
    background: none;
    text-align: left;
    width: 100%;
}

.editor-processor-option:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #B7FF69;
}

.editor-processor-option.active {
    background-color: rgba(183, 255, 105, 0.12);
    color: #B7FF69;
}

.editor-processor-option svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.editor-processor-option.active svg {
    opacity: 1;
}

body.light-theme .editor-processor-option {
    color: #000000;
}

body.light-theme .editor-processor-option:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: #480096;
}

body.light-theme .editor-processor-option.active {
    background-color: rgba(72, 0, 150, 0.1);
    color: #480096;
}

/* ===== 🎯 ПАНЕЛЬ ВКЛАДОК ОТКРЫТЫХ ФАЙЛОВ ===== */

.editor-tabs-panel {
    display: flex;
    align-items: stretch;
    background-color: #111;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

.editor-tabs-panel::-webkit-scrollbar {
    display: none;
    height: 0;
}

body.light-theme .editor-tabs-panel {
    background-color: #f0f0f0;
    border-bottom: 1px solid #e0e0e0;
}

.editor-tabs-list {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px 0 8px;
    min-height: 38px;
}

.editor-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: #b0b0b0;
    font-family: 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    /*cursor: pointer;*/
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    max-width: 200px;
    position: relative;
    top: 1px;
}

.editor-tab:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.editor-tab.active {
    background-color: #0d0d0d;
    border-color: #2a2a2a;
    color: #B7FF69;
    font-weight: 600;
}

body.light-theme .editor-tab {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: #666;
}

body.light-theme .editor-tab:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: #000;
}

body.light-theme .editor-tab.active {
    background-color: #fafafa;
    border-color: #e0e0e0;
    color: #480096;
}

.editor-tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

.editor-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.15s ease, background-color 0.15s ease;
    flex-shrink: 0;
}

.editor-tab-close:hover {
    opacity: 1;
    background-color: rgba(255, 80, 80, 0.2);
    color: #ff8080;
}

/* ===== ОСНОВНАЯ ОБЛАСТЬ РЕДАКТОРА ===== */
.editor-main {
    display: flex;
    flex-direction: row;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.editor-code-area {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: #0d0d0d;
    transition: background-color 0.5s ease;
}

body.light-theme .editor-code-area {
    background-color: #fafafa;
}

/* ===== НОМЕРА СТРОК ===== */
.editor-line-numbers {
    padding-top: 16px;
    padding-bottom: 16px;
    padding-left: 0;
    padding-right: 0;
    text-align: right;
    background-color: #111;
    color: #555;
    user-select: none;
    border-right: 1px solid #2a2a2a;
    font-family: 'Source Code Pro', 'Consolas', 'Monaco', monospace;
    font-size: 18px;
    line-height: 26px;
    overflow: hidden;
    flex-shrink: 0;
    min-width: 50px;
    box-sizing: border-box;
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

body.light-theme .editor-line-numbers {
    background-color: #f0f0f0;
    color: #999;
    border-right: 1px solid #e0e0e0;
}

.editor-line-numbers span.line-number {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 12px 0 8px;
    white-space: nowrap;
    height: 26px;
    line-height: 26px;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.editor-line-numbers span.line-number:hover {
    color: #B7FF69;
    background-color: rgba(183, 255, 105, 0.08);
}

.editor-line-numbers span.line-number.has-breakpoint {
    color: #ff5050;
    font-weight: bold;
}

.editor-line-numbers span.line-number.has-breakpoint::before {
    content: '●';
    position: absolute;
    left: 2px;
    color: #ff5050;
    font-size: 0.7rem;
    animation: bp-pulse 2s ease-in-out infinite;
}

@keyframes bp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

body.light-theme .editor-line-numbers span.line-number:hover {
    color: #480096;
    background-color: rgba(72, 0, 150, 0.06);
}

body.light-theme .editor-line-numbers span.line-number.has-breakpoint {
    color: #c00;
}

body.light-theme .editor-line-numbers span.line-number.has-breakpoint::before {
    color: #c00;
}

/* ===== ТЕКУЩАЯ СТРОКА (отладка) ===== */
.editor-line-numbers span.line-number.current-line {
    background-color: rgba(183, 255, 105, 0.25);
    color: #B7FF69;
    font-weight: bold;
    box-shadow: inset 3px 0 0 #B7FF69;
}

.editor-line-numbers span.line-number.current-line::after {
    content: '▶';
    position: absolute;
    left: 2px;
    color: #B7FF69;
    font-size: 0.65rem;
    animation: current-line-pulse 1.2s ease-in-out infinite;
}

@keyframes current-line-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

body.light-theme .editor-line-numbers span.line-number.current-line {
    background-color: rgba(72, 0, 150, 0.15);
    color: #480096;
    box-shadow: inset 3px 0 0 #480096;
}

body.light-theme .editor-line-numbers span.line-number.current-line::after {
    color: #480096;
}

.editor-line-numbers span.line-number.current-line.has-breakpoint {
    background-color: rgba(255, 80, 80, 0.2);
    color: #ff5050;
    box-shadow: inset 3px 0 0 #ff5050;
}

/* ===== ТЕКСТОВОЕ ПОЛЕ РЕДАКТОРА ===== */
.editor-textarea {
    flex: 1;
    padding: 16px;
    background-color: transparent;
    border: none;
    color: #e0e0e0;
    font-family: 'Source Code Pro', 'Consolas', 'Monaco', monospace;
    font-size: 18px;
    line-height: 26px;
    resize: none;
    outline: none;
    white-space: pre;
    word-wrap: normal;
    overflow-wrap: normal;
    overflow: auto;
    tab-size: 4;
    -moz-tab-size: 4;
    box-sizing: border-box;
    transition: color 0.5s ease;
    caret-color: transparent;      /* 🎯 скрываем нативную каретку */
}

body.light-theme .editor-textarea {
    color: #1a1a1a;
}

.editor-textarea::placeholder {
    color: #555;
}

body.light-theme .editor-textarea::placeholder {
    color: #aaa;
}

.editor-textarea::selection {
    background-color: rgba(183, 255, 105, 0.25);
}

body.light-theme .editor-textarea::selection {
    background-color: rgba(72, 0, 150, 0.2);
}

.editor-textarea::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.editor-textarea::-webkit-scrollbar-track {
    background: #111;
}

.editor-textarea::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 6px;
    border: 3px solid #111;
}

.editor-textarea::-webkit-scrollbar-thumb:hover {
    background: #444;
}

body.light-theme .editor-textarea::-webkit-scrollbar-track {
    background: #f0f0f0;
}

body.light-theme .editor-textarea::-webkit-scrollbar-thumb {
    background: #ccc;
    border: 3px solid #f0f0f0;
}

body.light-theme .editor-textarea::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* ===== ПАНЕЛЬ ВЫВОДА ===== */
.editor-output {
    width: 320px;
    flex-shrink: 0;
    background-color: #0a0a0a;
    border-left: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.5s ease, border-color 0.5s ease, width 0.3s ease;
}

body.light-theme .editor-output {
    background-color: #fafafa;
    border-left: 1px solid #e0e0e0;
}

.editor-output.hidden {
    width: 0;
    border-left: none;
    overflow: hidden;
}

.editor-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #111;
    border-bottom: 1px solid #2a2a2a;
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFFFFF;
    flex-shrink: 0;
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

body.light-theme .editor-output-header {
    background-color: #f0f0f0;
    color: #000000;
    border-bottom: 1px solid #e0e0e0;
}

.editor-output-header .output-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-output-header .output-title svg {
    width: 16px;
    height: 16px;
}

.editor-output-clear {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.editor-output-clear:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.light-theme .editor-output-clear:hover {
    background-color: rgba(0, 0, 0, 0.08);
    color: #000;
}

/* 🎯 НОВОЕ: контейнер для кнопок в заголовке вывода */
.editor-output-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* 🎯 НОВОЕ: кнопка "Копировать" (только warning/error строки) */
.editor-output-copy {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
}

/* Активная кнопка — цветной акцент, чтобы привлечь внимание */
.editor-output-copy:not(:disabled) {
    color: #FFD467;
}

.editor-output-copy:hover:not(:disabled) {
    background-color: rgba(255, 212, 103, 0.12);
    color: #FFD467;
}

body.light-theme .editor-output-copy:not(:disabled) {
    color: #B45F06;
}

body.light-theme .editor-output-copy:hover:not(:disabled) {
    background-color: rgba(180, 95, 6, 0.1);
    color: #B45F06;
}

/* Неактивная кнопка — приглушённая */
.editor-output-copy:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.editor-output-content {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    font-family: 'Source Code Pro', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #ccc;
    white-space: pre-wrap;
    word-break: break-word;
    transition: color 0.5s ease;
}

body.light-theme .editor-output-content {
    color: #333;
}

.editor-output-content::-webkit-scrollbar {
    width: 8px;
}

.editor-output-content::-webkit-scrollbar-track {
    background: #111;
}

.editor-output-content::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.editor-output-content::-webkit-scrollbar-thumb:hover {
    background: #444;
}

body.light-theme .editor-output-content::-webkit-scrollbar-track {
    background: #f0f0f0;
}

body.light-theme .editor-output-content::-webkit-scrollbar-thumb {
    background: #ccc;
}

/* Стили для сообщений вывода */
.editor-output-content .output-line {
    margin-bottom: 4px;
}

.editor-output-content .output-line.info {
    color: #7BD7DD;
}

.editor-output-content .output-line.success {
    color: #B7FF69;
}

.editor-output-content .output-line.error {
    color: #ff8080;
}

.editor-output-content .output-line.warning {
    color: #FFD467;
}

body.light-theme .editor-output-content .output-line.info {
    color: #2F6F7A;
}

body.light-theme .editor-output-content .output-line.success {
    color: #3C8D3C;
}

body.light-theme .editor-output-content .output-line.error {
    color: #c00;
}

body.light-theme .editor-output-content .output-line.warning {
    color: #B8860B;
}

/* ===== СТАТУС-БАР ===== */
.editor-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background-color: #111;
    border-top: 1px solid #2a2a2a;
    font-size: 0.8rem;
    color: #888;
    flex-shrink: 0;
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

body.light-theme .editor-statusbar {
    background-color: #f0f0f0;
    color: #666;
    border-top: 1px solid #e0e0e0;
}

.editor-statusbar-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-statusbar-item svg {
    width: 14px;
    height: 14px;
}

.editor-statusbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ==========================================================================
   ПАНЕЛЬ РЕГИСТРОВ И ФЛАГОВ
   ========================================================================== */

.editor-registers-panel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 6px;
    background-color: #0d0d0d;
    border-right: 1px solid #2a2a2a;
    font-family: 'Source Code Pro', 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    flex-shrink: 0;
    align-items: stretch;

    width: max-content;
    min-width: 0;
    max-width: none;

    overflow-y: auto;
    overflow-x: hidden;
    transition: background-color 0.5s ease, border-color 0.5s ease;

    scrollbar-width: thin;
    scrollbar-color: #333 #0d0d0d;
}

.editor-registers-panel::-webkit-scrollbar {
    width: 6px;
}

.editor-registers-panel::-webkit-scrollbar-track {
    background: #0d0d0d;
}

.editor-registers-panel::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

body.light-theme .editor-registers-panel {
    background-color: #f5f5f5;
    border-right: 1px solid #e0e0e0;
    scrollbar-color: #ccc #f5f5f5;
}

body.light-theme .editor-registers-panel::-webkit-scrollbar-track {
    background: #f5f5f5;
}

body.light-theme .editor-registers-panel::-webkit-scrollbar-thumb {
    background: #ccc;
}

/* ===== 🎯 ПЕРЕКЛЮЧАТЕЛЬ HEX / BIN (только для 8086) ===== */

.editor-registers-format-switch {
    display: flex;
    gap: 4px;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

body.light-theme .editor-registers-format-switch {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.reg-format-btn {
    flex: 1;
    padding: 4px 8px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #888;
    font-family: 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    min-width: auto;
    outline: none;
}

.reg-format-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ccc;
    border-color: rgba(255, 255, 255, 0.2);
}

.reg-format-btn.active {
    background-color: rgba(183, 255, 105, 0.15);
    border-color: rgba(183, 255, 105, 0.45);
    color: #B7FF69;
}

.reg-format-btn:active {
    transform: scale(0.96);
}

body.light-theme .reg-format-btn {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: #999;
}

body.light-theme .reg-format-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: #333;
    border-color: rgba(0, 0, 0, 0.2);
}

body.light-theme .reg-format-btn.active {
    background-color: rgba(72, 0, 150, 0.1);
    border-color: rgba(72, 0, 150, 0.4);
    color: #480096;
}

/* ===== ВНУТРЕННИЕ ЭЛЕМЕНТЫ: reg-item / flag-item ===== */

.editor-registers-panel .reg-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 6px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}

body.light-theme .editor-registers-panel .reg-item {
    background-color: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.editor-registers-panel .reg-name {
    color: #7BD7DD;
    font-weight: 600;
    flex-shrink: 0;
}

body.light-theme .editor-registers-panel .reg-name {
    color: #2F6F7A;
}

.editor-registers-panel .reg-value {
    color: #FFFFFF;
    font-weight: 500;
    /*min-width: 28px;*/
    text-align: left;
    font-variant-numeric: tabular-nums;
    min-width: 0;
}

body.light-theme .editor-registers-panel .reg-value {
    color: #000000;
}

.editor-registers-panel .flag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    width: 100%;
    padding: 3px 6px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    color: #666;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

body.light-theme .editor-registers-panel .flag-item {
    background-color: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #999;
}

/* ==========================================================================
   🎯 ПОДСВЕТКА РЕГИСТРОВ INTEL 8086: ПОЛНЫЙ РЕГИСТР И ЕГО ПОЛОВИНЫ
   ========================================================================== */

.editor-registers-panel .reg-value.reg-value-16 {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 0;
    min-width: 0;
    background: transparent;
    border-radius: 0;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.editor-registers-panel .reg-half {
    display: inline-block;
    padding: 0;
    border-radius: 2px;
    font-variant-numeric: tabular-nums;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.editor-registers-panel .reg-half.changed {
    color: #B7FF69;
}

body.light-theme .editor-registers-panel .reg-half.changed {
    color: #480096;
}

.editor-registers-panel .reg-value.changed {
    color: #B7FF69;
}

body.light-theme .editor-registers-panel .reg-value.changed {
    color: #480096;
}

/* ===== 🎯 ПОДСВЕТКА АКТИВНОГО ФЛАГА ===== */
.editor-registers-panel .flag-item.active {
    background-color: rgba(183, 255, 105, 0.15);
    border-color: rgba(183, 255, 105, 0.4);
    color: #B7FF69;
    box-shadow: 0 0 6px rgba(183, 255, 105, 0.2);
}

body.light-theme .editor-registers-panel .flag-item.active {
    background-color: rgba(72, 0, 150, 0.1);
    border-color: rgba(72, 0, 150, 0.4);
    color: #480096;
}

/* ===== 🎯 BIN-РЕЖИМ: уменьшенный шрифт ===== */

.editor-registers-panel.bin-format .reg-value {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    min-width: 0;
}

.editor-registers-panel.bin-format .reg-half {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

.editor-registers-panel.bin-format .reg-value.reg-value-16 {
    min-width: 0;
}

.editor-registers-panel.bin-format .reg-name {
    font-size: 0.75rem;
}

/* ===== ПОЛНОЭКРАННЫЙ РЕЖИМ РЕДАКТОРА ===== */

.editor-modal-overlay.fullscreen-overlay {
    padding: 0;
}

.editor-modal.fullscreen {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    transform: none;
}

.editor-modal-overlay.active .editor-modal.fullscreen {
    transform: none;
}

body.light-theme .editor-modal.fullscreen {
    border: none;
}

/* ===== ПРОМЕЖУТОЧНЫЕ ЭКРАНЫ (769–1100px) ===== */
@media (max-width: 1100px) and (min-width: 769px) {
    .editor-toolbar {
        gap: 6px;
        padding: 8px 12px;
    }

    .editor-toolbar-btn,
    .editor-processor-btn {
        padding: 7px 10px;
        font-size: 0.8rem;
    }

    .editor-toolbar-btn svg,
    .editor-processor-btn svg.processor-icon {
        width: 14px;
        height: 14px;
    }

    .editor-registers-panel {
        font-size: 0.75rem;
        padding: 10px 8px;
    }

    .editor-registers-panel .reg-value {
        min-width: 30px;
    }

    .editor-registers-panel .reg-value.reg-value-16 {
        min-width: 36px;
    }

    .editor-registers-panel.bin-format .reg-value,
    .editor-registers-panel.bin-format .reg-half {
        font-size: 0.68rem;
    }
}

/* На экранах 769–950px — ещё компактнее */
@media (max-width: 950px) and (min-width: 769px) {
    .editor-toolbar-btn .btn-label {
        display: none;
    }

    .editor-toolbar-btn {
        padding: 8px;
    }

    .editor-processor-btn .processor-label {
        display: none;
    }

    .editor-processor-btn {
        padding: 8px;
    }
}

/* ==========================================================================
   АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ
   ========================================================================== */
@media (max-width: 768px) {
    .editor-modal-overlay {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .editor-modal {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        transform: translateY(100%);
    }

    .editor-modal-overlay.active .editor-modal {
        transform: translateY(0);
    }

    .editor-modal-header {
        padding: 12px 16px;
    }

    .editor-modal-title {
        font-size: 1.1rem;
    }

    .editor-modal-fullscreen {
        display: none !important;
    }

    .editor-modal-newtab {
        display: none !important;
    }

    .editor-toolbar {
        padding: 8px 12px;
        gap: 6px;
    }

    .editor-toolbar-btn {
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    .editor-toolbar-btn svg {
        width: 14px;
        height: 14px;
    }

    .editor-toolbar-btn .btn-label {
        display: none;
    }

    .editor-toolbar-btn {
        padding: 8px;
    }

    .editor-processor-btn {
        padding: 8px;
    }

    .editor-processor-btn .processor-label {
        display: none;
    }

    .editor-processor-btn svg.chevron-icon {
        display: none;
    }

    .editor-processor-dropdown {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.95);
        width: calc(100vw - 40px);
        max-width: 320px;
        max-height: 60vh;
        overflow-y: auto;
        background-color: #1a1a1a;
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 12px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75);
        padding: 8px;
        z-index: 10060;
        display: none;
        flex-direction: column;
        gap: 4px;
        opacity: 0;
        transition: opacity 0.18s ease, transform 0.18s ease;
    }

    .editor-processor-select.open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.6);
        z-index: 10059;
    }

    body.light-theme .editor-processor-select.open::before {
        background-color: rgba(255, 255, 255, 0.6);
    }

    .editor-processor-select.open .editor-processor-dropdown {
        display: flex;
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    body.light-theme .editor-processor-dropdown {
        background-color: #ffffff;
        border-color: rgba(0, 0, 0, 0.15);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    }

    .editor-processor-option {
        padding: 14px 16px;
        font-size: 0.95rem;
        border-radius: 8px;
    }

    .editor-processor-option svg {
        width: 18px;
        height: 18px;
    }

    .editor-main {
        display: contents;
    }

    .editor-modal-header    { order: 0; }
    .editor-toolbar         { order: 1; }
    .editor-registers-panel { order: 2; }
    .editor-tabs-panel      { order: 3; }
    .editor-code-area       { order: 4; }
    .editor-output          { order: 5; }
    .seven-segment-panel    { order: 6; }
    .external-devices-panel { order: 7; }
    .editor-statusbar       { order: 8; }

    .editor-registers-panel {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid #2a2a2a;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 4px;
        gap: 4px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .editor-registers-panel::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    body.light-theme .editor-registers-panel {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .editor-registers-panel .reg-item,
    .editor-registers-panel .flag-item {
        flex-shrink: 0;
        width: auto;
        min-width: 0;
    }

    .editor-registers-format-switch {
        display: none !important;
    }

    .editor-code-area {
        flex: 1;
        min-height: 0;
        width: 100%;
    }

    .editor-output {
        width: 100%;
        height: 180px;
        border-left: none;
        border-top: 1px solid #2a2a2a;
        flex-shrink: 0;
    }

    body.light-theme .editor-output {
        border-top: 1px solid #e0e0e0;
    }

    .editor-output.hidden {
        height: 0;
        width: 100%;
        border-top: none;
    }

    .editor-tabs-panel {
        min-height: 36px;
        align-items: center;
    }

    .editor-tabs-list {
        align-items: center;
        padding: 4px 8px;
        min-height: 36px;
        gap: 6px;
    }

    .editor-tab {
        padding: 5px 8px;
        font-size: 0.75rem;
        max-width: 150px;
    }

    .editor-tab-name {
        max-width: 100px;
    }

    .editor-textarea,
    .editor-line-numbers,
    .editor-addr-column,
    .editor-bytes-column {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .editor-line-numbers {
        min-width: 40px;
        font-size: 0.8rem;
        padding-left: 0;
        padding-right: 0;
    }

    .editor-textarea {
        font-size: 0.85rem;
        padding-left: 12px;
        padding-right: 12px;
    }

    .editor-statusbar {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .editor-modal-title {
        font-size: 1rem;
    }

    .editor-toolbar {
        padding: 6px 8px;
        gap: 4px;
    }

    .editor-toolbar-btn {
        padding: 7px;
    }

    .editor-processor-btn {
        padding: 7px;
    }

    .editor-textarea,
    .editor-line-numbers,
    .editor-addr-column,
    .editor-bytes-column {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .editor-line-numbers {
        min-width: 35px;
        font-size: 0.75rem;
        padding-left: 0;
        padding-right: 0;
    }

    .editor-textarea {
        font-size: 0.8rem;
        padding-left: 10px;
        padding-right: 10px;
    }

    .editor-output {
        height: 150px;
    }

    .editor-tab {
        padding: 4px 7px;
        font-size: 0.72rem;
        max-width: 120px;
    }

    .editor-tab-name {
        max-width: 80px;
    }
}

/* ===== ПОДДЕРЖКА SAFE AREA ===== */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .editor-modal-header {
            padding-top: max(12px, env(safe-area-inset-top));
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
        }

        .editor-statusbar {
            padding-bottom: max(8px, env(safe-area-inset-bottom));
            padding-left: max(12px, env(safe-area-inset-left));
            padding-right: max(12px, env(safe-area-inset-right));
        }
    }
}

/* ==================== МОБИЛЬНАЯ АДАПТАЦИЯ: ГОРИЗОНТАЛЬНАЯ ПРОКРУТКА ==================== */

@media (max-width: 768px) {

    .editor-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding: 8px 4px;
        gap: 6px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .editor-toolbar::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    .editor-toolbar > * {
        flex-shrink: 0;
    }

    .editor-toolbar-btn,
    .editor-processor-btn {
        scroll-snap-align: start;
    }

    .editor-toolbar-spacer {
        display: none;
    }

    .editor-registers-panel {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding: 8px 4px;
        gap: 4px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .editor-registers-panel::-webkit-scrollbar {
        display: none;
        height: 0;
    }

    .editor-registers-panel > * {
        flex-shrink: 0;
    }

    .reg-item,
    .flag-item {
        scroll-snap-align: start;
    }

    .reg-item {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .reg-value {
        min-width: 32px;
    }

    .editor-registers-panel .reg-value.reg-value-16 {
        min-width: 36px;
    }

    .flag-item {
        min-width: 24px;
        padding: 4px 6px;
        font-size: 0.7rem;
    }
}

/* ===== ВИЗУАЛЬНЫЙ ИНДИКАТОР ПРОКРУТКИ ===== */

@media (max-width: 768px) {
    .editor-toolbar,
    .editor-registers-panel {
        position: relative;
    }

    .editor-toolbar::after,
    .editor-registers-panel::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 16px;
        background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.15));
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.2s ease;
        border-radius: 0 6px 6px 0;
        z-index: 1;
    }

    body.light-theme .editor-toolbar::after,
    body.light-theme .editor-registers-panel::after {
        background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.06));
    }

    .editor-toolbar:not(.scroll-at-end)::after,
    .editor-registers-panel:not(.scroll-at-end)::after {
        opacity: 1;
    }

    .editor-toolbar.scroll-at-end::after,
    .editor-registers-panel.scroll-at-end::after {
        opacity: 0;
    }
}

/* ===== КНОПКА АВТОКОММЕНТАРИЕВ ===== */

.editor-toolbar-btn.auto-comment-toggle {
    background-color: rgba(123, 215, 221, 0.08);
    border-color: rgba(123, 215, 221, 0.25);
    color: #7BD7DD;
}

.editor-toolbar-btn.auto-comment-toggle:hover {
    background-color: rgba(123, 215, 221, 0.18);
    border-color: rgba(123, 215, 221, 0.45);
    box-shadow: 0 0 12px rgba(123, 215, 221, 0.15);
}

.editor-toolbar-btn.auto-comment-toggle.active {
    background-color: rgba(123, 215, 221, 0.22);
    border-color: rgba(123, 215, 221, 0.6);
    color: #7BD7DD;
    box-shadow: 0 0 10px rgba(123, 215, 221, 0.25);
}

body.light-theme .editor-toolbar-btn.auto-comment-toggle {
    background-color: rgba(47, 111, 122, 0.06);
    border-color: rgba(47, 111, 122, 0.2);
    color: #2F6F7A;
}

body.light-theme .editor-toolbar-btn.auto-comment-toggle:hover {
    background-color: rgba(47, 111, 122, 0.12);
    border-color: rgba(47, 111, 122, 0.4);
}

body.light-theme .editor-toolbar-btn.auto-comment-toggle.active {
    background-color: rgba(47, 111, 122, 0.18);
    border-color: rgba(47, 111, 122, 0.55);
    color: #2F6F7A;
    box-shadow: 0 0 10px rgba(47, 111, 122, 0.2);
}

.editor-toolbar-btn.continue {
    background-color: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.3);
    color: #4ADE80;
}

.editor-toolbar-btn.continue:hover {
    background-color: rgba(74, 222, 128, 0.2);
    border-color: rgba(74, 222, 128, 0.5);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.15);
}

body.light-theme .editor-toolbar-btn.continue {
    background-color: rgba(0, 150, 70, 0.08);
    border-color: rgba(0, 150, 70, 0.25);
    color: #0A7A3A;
}

/* ===== 🎯 СЕЛЕКТОР РЕЖИМА VIM/EMACS В СТАТУС-БАРЕ ===== */
.editor-mode-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-right: 16px;
}

.editor-mode-hint {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #B7FF69;
    margin-right: 8px;
    min-width: 80px;
    text-align: right;
}

body.light-theme .editor-mode-hint {
    color: #480096;
}

.editor-mode-option {
    padding: 3px 10px;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #888;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.editor-mode-option:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.editor-mode-option.active {
    background-color: rgba(183, 255, 105, 0.15);
    border-color: rgba(183, 255, 105, 0.5);
    color: #B7FF69;
}

body.light-theme .editor-mode-option {
    border-color: rgba(0, 0, 0, 0.15);
    color: #999;
}

body.light-theme .editor-mode-option:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #000;
    border-color: rgba(0, 0, 0, 0.3);
}

body.light-theme .editor-mode-option.active {
    background-color: rgba(72, 0, 150, 0.1);
    border-color: rgba(72, 0, 150, 0.4);
    color: #480096;
}

.editor-textarea.vim-normal-mode {
    caret-color: transparent;
}

.editor-textarea.vim-normal-mode::selection {
    background-color: rgba(183, 255, 105, 0.15);
}

@media (max-width: 768px) {
    .editor-mode-selector {
        display: none !important;
    }
}

/* ============================================================ */
/* ========== МОДАЛЬНОЕ ОКНО СОЗДАНИЯ НОВОГО ФАЙЛА ========== */
/* ============================================================ */

.editor-newfile-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    padding: 20px;
}

.editor-newfile-overlay.active {
    opacity: 1;
    visibility: visible;
}

body.light-theme .editor-newfile-overlay {
    background-color: rgba(255, 255, 255, 0.7);
}

.editor-newfile-modal {
    width: 100%;
    max-width: 460px;
    background-color: #0a0a0a;
    border: 1px solid #333;
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    transform: translateY(20px) scale(0.96);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color 0.5s ease, border-color 0.5s ease;
}

.editor-newfile-overlay.active .editor-newfile-modal {
    transform: translateY(0) scale(1);
}

body.light-theme .editor-newfile-modal {
    background-color: #ffffff;
    border-color: #ddd;
}

.editor-newfile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
}

body.light-theme .editor-newfile-header {
    border-bottom-color: #ddd;
}

.editor-newfile-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

body.light-theme .editor-newfile-title {
    color: #000;
}

.editor-newfile-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.editor-newfile-close:hover {
    background-color: rgba(255, 255, 255, 0.18);
}

body.light-theme .editor-newfile-close {
    background-color: rgba(0, 0, 0, 0.05);
    color: #000;
}

.editor-newfile-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.editor-newfile-label {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 4px;
    display: block;
}

body.light-theme .editor-newfile-label {
    color: #666;
}

.editor-newfile-row-wrap {
    position: relative;
    width: 100%;
}

.editor-newfile-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.editor-newfile-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    background-color: #151515;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.editor-newfile-input:focus {
    border-color: #B7FF69;
    box-shadow: 0 0 0 3px rgba(183, 255, 105, 0.1);
}

body.light-theme .editor-newfile-input {
    background-color: #f5f5f5;
    border-color: #e0e0e0;
    color: #000;
}

body.light-theme .editor-newfile-input:focus {
    border-color: #480096;
    box-shadow: 0 0 0 3px rgba(72, 0, 150, 0.1);
}

.editor-newfile-ext-btn {
    padding: 0 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #B7FF69;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-newfile-ext-btn:hover {
    background-color: rgba(183, 255, 105, 0.12);
    border-color: rgba(183, 255, 105, 0.4);
}

.editor-newfile-ext-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.editor-newfile-ext-btn.open svg {
    transform: rotate(180deg);
}

body.light-theme .editor-newfile-ext-btn {
    background-color: rgba(72, 0, 150, 0.06);
    border-color: rgba(72, 0, 150, 0.2);
    color: #480096;
}

body.light-theme .editor-newfile-ext-btn:hover {
    background-color: rgba(72, 0, 150, 0.12);
}

.editor-newfile-ext-dropdown {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding: 4px;
    background-color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);

    position: absolute;
    top: calc(100% + 4px);
    right: 0;

    min-width: 80px;
    width: max-content;
    z-index: 10;
}

.editor-newfile-ext-dropdown.open {
    display: flex;
}

/* 🎯 Раскрытие вверх, если снизу мало места */
.editor-newfile-ext-dropdown.drop-up {
    top: auto;
    bottom: calc(100% + 4px);
}

body.light-theme .editor-newfile-ext-dropdown {
    background-color: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.editor-newfile-ext-option {
    display: block;
    width: 100%;
    padding: 4px 10px;
    background: none;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.editor-newfile-ext-option:hover {
    background-color: rgba(183, 255, 105, 0.12);
    color: #B7FF69;
}

.editor-newfile-ext-option.active {
    background-color: rgba(183, 255, 105, 0.15);
    color: #B7FF69;
    font-weight: 600;
}

body.light-theme .editor-newfile-ext-option {
    color: #000;
}

body.light-theme .editor-newfile-ext-option:hover {
    background-color: rgba(72, 0, 150, 0.08);
    color: #480096;
}

body.light-theme .editor-newfile-ext-option.active {
    background-color: rgba(72, 0, 150, 0.1);
    color: #480096;
    font-weight: 600;
}

.editor-newfile-error {
    padding: 8px 12px;
    background-color: rgba(255, 80, 80, 0.1);
    border: 1px solid rgba(255, 80, 80, 0.3);
    border-radius: 6px;
    color: #ff8080;
    font-size: 0.8rem;
    display: none;
}

.editor-newfile-error.visible {
    display: block;
}

.editor-newfile-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #333;
}

body.light-theme .editor-newfile-footer {
    border-top-color: #ddd;
}

.editor-newfile-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.editor-newfile-btn.cancel {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.editor-newfile-btn.cancel:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.editor-newfile-btn.create {
    background-color: rgba(183, 255, 105, 0.15);
    border-color: rgba(183, 255, 105, 0.35);
    color: #B7FF69;
}

.editor-newfile-btn.create:hover:not(:disabled) {
    background-color: rgba(183, 255, 105, 0.25);
    border-color: rgba(183, 255, 105, 0.55);
}

.editor-newfile-btn.create:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

body.light-theme .editor-newfile-btn.cancel {
    background-color: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #000;
}

body.light-theme .editor-newfile-btn.create {
    background-color: rgba(72, 0, 150, 0.08);
    border-color: rgba(72, 0, 150, 0.25);
    color: #480096;
}

/* ===== ЗАБЛОКИРОВАННЫЙ РЕДАКТОР (нет открытых файлов) ===== */
.editor-modal.no-file-open .editor-textarea {
    cursor: not-allowed;
    color: #555 !important;
    background-color: rgba(255, 255, 255, 0.01) !important;
}

.editor-modal.no-file-open .editor-textarea::placeholder {
    color: #555 !important;
    font-style: italic;
}

body.light-theme .editor-modal.no-file-open .editor-textarea {
    color: #aaa !important;
    background-color: rgba(0, 0, 0, 0.02) !important;
}

body.light-theme .editor-modal.no-file-open .editor-textarea::placeholder {
    color: #999 !important;
}

.editor-modal.no-file-open .editor-toolbar-btn:not(.new-file):not(.open-file):not(.import-project):not(.projects) {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.editor-modal.no-file-open .editor-code-area::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35));
    pointer-events: none;
    z-index: 5;
}

/* ===== СТРОКА ВВОДА КОМАНД / ПОИСКА В СТАТУС-БАРЕ ===== */
.editor-cmdline {
    display: none;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
    font-family: 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.85rem;
}

.editor-cmdline.active {
    display: flex;
}

.editor-statusbar.cmdline-active .editor-statusbar-item:first-child,
.editor-statusbar.cmdline-active .editor-mode-selector,
.editor-statusbar.cmdline-active .editor-statusbar-right {
    display: none;
}

.editor-cmdline-prefix {
    color: #B7FF69;
    font-weight: 700;
    flex-shrink: 0;
    user-select: none;
}

body.light-theme .editor-cmdline-prefix {
    color: #480096;
}

.editor-cmdline-input {
    flex: 1;
    min-width: 0;
    padding: 2px 6px;
    background-color: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    color: #FFFFFF;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    caret-color: #B7FF69;
}

.editor-cmdline-input:focus {
    border-color: #B7FF69;
    box-shadow: 0 0 0 2px rgba(183, 255, 105, 0.1);
}

body.light-theme .editor-cmdline-input {
    background-color: #ffffff;
    border-color: #e0e0e0;
    color: #000000;
    caret-color: #480096;
}

body.light-theme .editor-cmdline-input:focus {
    border-color: #480096;
    box-shadow: 0 0 0 2px rgba(72, 0, 150, 0.1);
}

.editor-cmdline-hint {
    color: #888;
    font-size: 0.75rem;
    flex-shrink: 0;
    user-select: none;
}

body.light-theme .editor-cmdline-hint {
    color: #666;
}

/* ===== СЛОЙ ПОДСВЕТКИ СОВПАДЕНИЙ ПОИСКА ===== */

.editor-search-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.editor-search-box {
    position: absolute;
    background-color: rgba(255, 212, 103, 0.35);
    border-radius: 2px;
    pointer-events: none;
}

.editor-search-box.current {
    background-color: rgba(255, 165, 0, 0.65);
    box-shadow: 0 0 0 1px rgba(255, 140, 0, 0.8);
}

body.light-theme .editor-search-box {
    background-color: rgba(255, 200, 0, 0.4);
}

body.light-theme .editor-search-box.current {
    background-color: rgba(255, 140, 0, 0.7);
    box-shadow: 0 0 0 1px rgba(200, 100, 0, 0.8);
}

body.processor-dropdown-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   🎯 ЗАБЛОКИРОВАННЫЙ РЕДАКТОР (нет открытых файлов)
   ========================================================================== */

.editor-modal.no-file-open .editor-highlight-layer,
.editor-modal.no-file-open .editor-highlight-layer-8086 {
    display: none !important;
}

.editor-modal.no-file-open .editor-textarea {
    background-color: #0d0d0d;
    color: #555 !important;
    cursor: not-allowed;
}

.editor-modal.no-file-open .editor-textarea::placeholder {
    color: #555 !important;
    font-style: italic;
}

body.light-theme .editor-modal.no-file-open .editor-textarea {
    background-color: #fafafa !important;
    color: #aaa !important;
}

body.light-theme .editor-modal.no-file-open .editor-textarea::placeholder {
    color: #999 !important;
}

/* ==================== 🎯 DROPDOWN ВЫБОРА МЕТКИ ==================== */

.memory-label-picker {
    z-index: 10001;
    min-width: 260px;
    max-width: 380px;
    max-height: 400px;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Source Code Pro', monospace;
}

body.light-theme .memory-label-picker {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.memory-label-picker-search {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-theme .memory-label-picker-search {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.memory-label-picker-input {
    width: 100%;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.memory-label-picker-input:focus {
    border-color: #00FFFF;
}

body.light-theme .memory-label-picker-input {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

body.light-theme .memory-label-picker-input:focus {
    border-color: #FF7F7F;
}

.memory-label-picker-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.memory-label-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.1s;
}

.memory-label-picker-item:hover {
    background: rgba(0, 255, 255, 0.1);
}

body.light-theme .memory-label-picker-item:hover {
    background: rgba(255, 127, 127, 0.1);
}

.memory-label-picker-name {
    flex: 1;
    color: #B5B6E3;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.light-theme .memory-label-picker-name {
    color: #4A491C;
}

/* 🎯 Цветовые маркеры по типу символа */
.memory-label-picker-item.is-proc .memory-label-picker-name {
    color: #EE67C6;
    font-weight: 700;
}

body.light-theme .memory-label-picker-item.is-proc .memory-label-picker-name {
    color: #119839;
}

.memory-label-picker-item.is-struc-var .memory-label-picker-name {
    color: #ED7D31;
}

body.light-theme .memory-label-picker-item.is-struc-var .memory-label-picker-name {
    color: #B45F06;
}

.memory-label-picker-item.is-label .memory-label-picker-name {
    color: #BEBEBE;
}

body.light-theme .memory-label-picker-item.is-label .memory-label-picker-name {
    color: #414141;
}

.memory-label-picker-name.is-scoped {
    font-style: italic;
}

.memory-label-picker-seg {
    color: #888;
    font-size: 11px;
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    flex-shrink: 0;
}

body.light-theme .memory-label-picker-seg {
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

.memory-label-picker-addr {
    color: #FFA07A;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

body.light-theme .memory-label-picker-addr {
    color: #005F85;
}

.memory-label-picker-empty {
    padding: 16px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

/* 🎯 Подсветка целевой ячейки */
.memory-byte.memory-label-target {
    animation: memory-label-target-pulse 0.5s ease-in-out 4;
    outline: 2px solid #FFD700;
    outline-offset: -2px;
    z-index: 10;
    position: relative;
}

@keyframes memory-label-target-pulse {
    0%, 100% { background-color: rgba(255, 215, 0, 0.5); }
    50%      { background-color: rgba(255, 215, 0, 0.1); }
}

/* ===== 🎯 ИКОНКА-БЕЙДЖ РАСШИРЕНИЯ ФАЙЛА ===== */

.editor-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 26px;
    height: 16px;
    padding: 0 4px;

    font-family: 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1;

    border-radius: 3px;
    flex-shrink: 0;

    /* Цвет по умолчанию (для нераспознанных расширений) */
    background-color: rgba(150, 150, 150, 0.18);
    color: #b0b0b0;
    border: 1px solid rgba(150, 150, 150, 0.25);

    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* 🎯 ASM / A — зелёный (основной цвет редактора) */
.editor-tab-icon-asm {
    background-color: rgba(183, 255, 105, 0.15);
    color: #B7FF69;
    border-color: rgba(183, 255, 105, 0.35);
}

/* 🎯 INC — голубой (как подключения/директивы) */
.editor-tab-icon-inc {
    background-color: rgba(123, 215, 221, 0.15);
    color: #7BD7DD;
    border-color: rgba(123, 215, 221, 0.35);
}

/* 🎯 TXT — жёлто-оранжевый (как комментарии/текстовые данные) */
.editor-tab-icon-txt {
    background-color: rgba(255, 212, 103, 0.15);
    color: #FFD467;
    border-color: rgba(255, 212, 103, 0.35);
}

/* При наведении на вкладку — чуть ярче */
.editor-tab:hover .editor-tab-icon-asm {
    background-color: rgba(183, 255, 105, 0.22);
    border-color: rgba(183, 255, 105, 0.5);
}

.editor-tab:hover .editor-tab-icon-inc {
    background-color: rgba(123, 215, 221, 0.22);
    border-color: rgba(123, 215, 221, 0.5);
}

.editor-tab:hover .editor-tab-icon-txt {
    background-color: rgba(255, 212, 103, 0.22);
    border-color: rgba(255, 212, 103, 0.5);
}

/* Активная вкладка — бейдж ярче */
.editor-tab.active .editor-tab-icon-asm {
    background-color: rgba(183, 255, 105, 0.25);
    color: #B7FF69;
    border-color: rgba(183, 255, 105, 0.55);
}

.editor-tab.active .editor-tab-icon-inc {
    background-color: rgba(123, 215, 221, 0.25);
    color: #7BD7DD;
    border-color: rgba(123, 215, 221, 0.55);
}

.editor-tab.active .editor-tab-icon-txt {
    background-color: rgba(255, 212, 103, 0.25);
    color: #FFD467;
    border-color: rgba(255, 212, 103, 0.55);
}

/* ===== СВЕТЛАЯ ТЕМА ===== */

body.light-theme .editor-tab-icon {
    background-color: rgba(0, 0, 0, 0.05);
    color: #666;
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .editor-tab-icon-asm {
    background-color: rgba(72, 0, 150, 0.08);
    color: #480096;
    border-color: rgba(72, 0, 150, 0.25);
}

body.light-theme .editor-tab-icon-inc {
    background-color: rgba(47, 111, 122, 0.08);
    color: #2F6F7A;
    border-color: rgba(47, 111, 122, 0.25);
}

body.light-theme .editor-tab-icon-txt {
    background-color: rgba(180, 95, 6, 0.08);
    color: #B45F06;
    border-color: rgba(180, 95, 6, 0.25);
}

body.light-theme .editor-tab.active .editor-tab-icon-asm {
    background-color: rgba(72, 0, 150, 0.14);
    color: #480096;
    border-color: rgba(72, 0, 150, 0.4);
}

body.light-theme .editor-tab.active .editor-tab-icon-inc {
    background-color: rgba(47, 111, 122, 0.14);
    color: #2F6F7A;
    border-color: rgba(47, 111, 122, 0.4);
}

body.light-theme .editor-tab.active .editor-tab-icon-txt {
    background-color: rgba(180, 95, 6, 0.14);
    color: #B45F06;
    border-color: rgba(180, 95, 6, 0.4);
}

/* На мобильных — уменьшаем бейдж */
@media (max-width: 768px) {
    .editor-tab-icon {
        min-width: 22px;
        height: 14px;
        padding: 0 3px;
        font-size: 0.55rem;
    }
}

/* ==========================================================================
   ВИЗУАЛИЗАТОР ЛИНКЕРА 8086 (linker-visualizer-8086.js)
   ==========================================================================
   Модальное окно, вызываемое через Ctrl+Alt+L.
   Показывает объединённые сегменты, карту памяти, символы и релокации.

   🎯 Содержание:
     1. Overlay и модальное окно
     2. Заголовок
     3. Тело (скроллируемая область)
     4. Секции (заголовок + содержимое)
     5. Таблицы (общая разметка)
     6. Сегменты (бейджи Combine)
     7. Карта памяти (grid-раскладка: [para] [name] [bar] [size])
     8. Символы (с ×N badge для COMMON)
     9. Релокации
    10. Прочее (ошибки, пустые секции, note, бейджи)
    11. Светлая тема
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. OVERLAY И МОДАЛЬНОЕ ОКНО
   -------------------------------------------------------------------------- */

.linker-viz-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.linker-viz-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.linker-viz-modal {
    /* 🎯 Тот же фон и рамка, что у модального окна редактора */
    background: #0a0a0a;
    color: #e0e0e0;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    width: 90vw;
    max-width: 1100px;
    height: 85vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
}


/* --------------------------------------------------------------------------
   2. ЗАГОЛОВОК
   -------------------------------------------------------------------------- */

.linker-viz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.linker-viz-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.linker-viz-title svg {
    width: 22px;
    height: 22px;
    color: #B7FF69;
}

.linker-viz-close {
    background: transparent;
    border: none;
    color: inherit;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}

.linker-viz-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.linker-viz-close svg {
    width: 18px;
    height: 18px;
}


/* --------------------------------------------------------------------------
   3. ТЕЛО (СКРОЛЛИРУЕМАЯ ОБЛАСТЬ)
   -------------------------------------------------------------------------- */

.linker-viz-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
    scrollbar-width: thin;
}

.linker-viz-body::-webkit-scrollbar {
    width: 8px;
}

.linker-viz-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.linker-viz-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}


/* --------------------------------------------------------------------------
   4. СЕКЦИИ
   -------------------------------------------------------------------------- */

.linker-viz-section {
    margin-bottom: 24px;
}

.linker-viz-section:last-child {
    margin-bottom: 0;
}

.linker-viz-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0 10px;
    /* 🎯 Нейтральная линия как в редакторе; акцент — только текст */
    border-bottom: 1px solid #333;
    margin-bottom: 12px;
}

.linker-viz-section-icon {
    font-size: 16px;
}

.linker-viz-section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #B7FF69;
}


/* --------------------------------------------------------------------------
   5. ТАБЛИЦЫ (ОБЩАЯ РАЗМЕТКА)
   -------------------------------------------------------------------------- */

.linker-viz-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    overflow: hidden;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
}

.linker-viz-table th {
    text-align: left;
    padding: 8px 12px;
    /* 🎯 Нейтральная подложка: зелёная давала «оливковый» оттенок */
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: #B7FF69;
    border-bottom: 1px solid #333;
}

.linker-viz-table td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.linker-viz-table tr:last-child td {
    border-bottom: none;
}

.linker-viz-table tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}


/* --------------------------------------------------------------------------
   6. СЕГМЕНТЫ (таблица объединённых сегментов)
   -------------------------------------------------------------------------- */

.seg-color-bar {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: middle;
}

.seg-name {
    font-weight: 600;
}

.seg-tag {
    display: inline-block;
    padding: 1px 6px;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-left: 6px;
}

.seg-combine {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.combine-common  { background: rgba(255, 165, 0, 0.2);   color: #FFA500; }
.combine-public  { background: rgba(183, 255, 105, 0.2); color: #B7FF69; }
.combine-stack   { background: rgba(178, 115, 249, 0.2); color: #B273F9; }
.combine-private { background: rgba(200, 200, 200, 0.15); color: #CCCCCC; }

.seg-relative {
    font-weight: 700;
    color: #FFA07A;
}


/* --------------------------------------------------------------------------
   7. КАРТА ПАМЯТИ
   --------------------------------------------------------------------------
   🎯 Grid-раскладка: [para 60px] [name 160px] [bar 1fr] [size auto]
   Имя сегмента вынесено в отдельную колонку фиксированной ширины,
   чтобы длинные имена (например, SHARED_DATA) не перекрывали
   правые данные.
   -------------------------------------------------------------------------- */

.linker-viz-memory-map {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.linker-viz-mem-row {
    display: grid;
    grid-template-columns: 60px 160px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

.linker-viz-mem-row.mem-stack {
    background: rgba(178, 115, 249, 0.08);
}

.linker-viz-mem-row.mem-common {
    background: rgba(255, 165, 0, 0.08);
}

/* 🎯 MEMORY — размещён последним */
.linker-viz-mem-row.mem-memory {
    background: rgba(100, 180, 255, 0.08);
}

/* 🎯 AT — абсолютный адрес, в файле не размещается */
.linker-viz-mem-row.mem-at {
    background: rgba(255, 100, 100, 0.08);
    border-left: 3px solid rgba(255, 100, 100, 0.5);
}

.mem-para {
    font-family: monospace;
    font-weight: 600;
    color: #FFA07A;
    text-align: right;
}

/* 🎯 Колонка с именем сегмента — фиксированная ширина */
.mem-name-col {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
}

.mem-name-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    color: #fff;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 🎯 Колонка с баром — принимает оставшееся место */
.mem-bar-col {
    display: block;
    min-width: 0;
    overflow: hidden;
    width: 100%;
}

/* 🎯 Бар — цветная полоска фиксированной высоты.
      Ширина задаётся inline и строго пропорциональна размеру сегмента
      (самый большой = 100 %).

      Полоса-контейнер (.mem-bar-col) нужна, чтобы минимальная ширина
      маленьких сегментов не искажала пропорции больших: она не даёт
      полосе «схлопнуться» в 0px, но общая шкала остаётся линейной. */
.mem-bar {
    height: 22px;
    border-radius: 4px;
    transition: width 0.3s ease;
    /* Крошечные сегменты (единицы байт от десятков КБ) иначе были бы
       меньше пикселя. Это минимальная ВИДИМАЯ толщина, а не шкала. */
    min-width: 2px;
}

/* 🎯 Доля от самого большого сегмента (размеры в байтах — в таблице
      «Объединённые сегменты», здесь дублировать не нужно) */
.mem-percent {
    display: inline-block;
    min-width: 42px;
    margin-right: 8px;
    text-align: right;
    color: #B7FF69;
    opacity: 0.85;
}

body.light-theme .mem-percent {
    color: #2E7D32;
    opacity: 0.9;
}

.mem-size {
    font-family: monospace;
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
    text-align: right;
}

.mem-phys {
    color: #888;
    margin-left: 8px;
}

.linker-viz-mem-total {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-left: 3px solid #B7FF69;
    border-radius: 4px;
    font-size: 12px;
}


/* --------------------------------------------------------------------------
   8. СИМВОЛЫ
   -------------------------------------------------------------------------- */

.sym-color-bar {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: middle;
}

.sym-offset,
.sym-addr {
    font-family: monospace;
    color: #FFA07A;
}

.sym-module {
    font-size: 11px;
    color: #aaa;
}

/* 🎯 Бейдж «×N» — символ определён в нескольких модулях */
.dup-badge {
    display: inline-block;
    padding: 1px 6px;
    background: rgba(255, 165, 0, 0.25);
    color: #FFA500;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
    cursor: help;
}


/* --------------------------------------------------------------------------
   9. РЕЛОКАЦИИ
   -------------------------------------------------------------------------- */

.reloc-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 255, 255, 0.15);
    color: #00FFFF;
}

.reloc-offset    { background: rgba(255, 160, 122, 0.2); color: #FFA07A; }
.reloc-seg       { background: rgba(255, 165, 0, 0.2);   color: #FFA500; }
.reloc-seg_alias { background: rgba(255, 165, 0, 0.2);   color: #FFA500; }
.reloc-rel16     { background: rgba(183, 255, 105, 0.2); color: #B7FF69; }
.reloc-rel8      { background: rgba(183, 255, 105, 0.2); color: #B7FF69; }
.reloc-fixup8    { background: rgba(178, 115, 249, 0.2); color: #B273F9; }
.reloc-fixup16   { background: rgba(178, 115, 249, 0.2); color: #B273F9; }

.linker-viz-reloc-summary {
    padding: 6px 12px;
    background: rgba(0, 255, 255, 0.08);
    border-left: 3px solid #00FFFF;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 12px;
}


/* --------------------------------------------------------------------------
   10. ПРОЧЕЕ
   -------------------------------------------------------------------------- */

.linker-viz-note {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 165, 0, 0.08);
    border-left: 3px solid #FFA500;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
}

.linker-viz-empty {
    padding: 20px;
    text-align: center;
    color: #888;
    font-style: italic;
}

.linker-viz-error {
    padding: 20px;
    background: rgba(255, 80, 80, 0.1);
    border-left: 3px solid #ff5050;
    border-radius: 4px;
    color: #ff8080;
    white-space: pre-wrap;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
}

.linker-viz-no-linker {
    text-align: center;
    padding: 40px 20px;
}

.linker-viz-no-linker-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.linker-viz-no-linker-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #FFA500;
}

.linker-viz-no-linker-text {
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
    color: #aaa;
}

.linker-viz-no-linker-text code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.linker-viz-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.linker-viz-module-card {
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border-left: 3px solid #B7FF69;
}

.linker-viz-module-name {
    font-weight: 700;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-bottom: 6px;
    color: #B7FF69;
}

.linker-viz-module-info {
    font-size: 11px;
    color: #aaa;
}


/* --------------------------------------------------------------------------
   11. СВЕТЛАЯ ТЕМА
   -------------------------------------------------------------------------- */

body.light-theme .linker-viz-modal {
    background: #ffffff;
    color: #1a1a1a;
    border-color: #ddd;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

body.light-theme .linker-viz-header {
    border-bottom-color: #ddd;
}

body.light-theme .linker-viz-title svg {
    color: #480096;
}

body.light-theme .linker-viz-close:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.light-theme .linker-viz-section-header {
    border-bottom-color: #ddd;
}

body.light-theme .linker-viz-section-title {
    color: #480096;
}

body.light-theme .linker-viz-table {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .linker-viz-table th {
    /* 🎯 Нейтральная подложка вместо фиолетовой */
    background: rgba(0, 0, 0, 0.04);
    color: #480096;
    border-bottom-color: #ddd;
}

body.light-theme .linker-viz-table td {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .linker-viz-table tr:hover td {
    background: rgba(0, 0, 0, 0.03);
}

body.light-theme .combine-common  { background: rgba(255, 165, 0, 0.15);  color: #B26000; }
body.light-theme .combine-memory  { background: rgba(0, 100, 200, 0.12);  color: #1F7896; }
body.light-theme .combine-at      { background: rgba(180, 40, 40, 0.12);  color: #B42828; }

body.light-theme .seg-inimage.yes { color: #2E7D32; background: rgba(46, 125, 50, 0.12); }
body.light-theme .seg-inimage.no  { color: #666666; background: rgba(0, 0, 0, 0.05); }
body.light-theme .seg-inimage.hdr { color: #6A1B9A; background: rgba(106, 27, 154, 0.12); }
body.light-theme .combine-public  { background: rgba(72, 0, 150, 0.12);   color: #480096; }
body.light-theme .combine-stack   { background: rgba(178, 115, 249, 0.15); color: #6A2FA8; }
body.light-theme .combine-private { background: rgba(0, 0, 0, 0.08);       color: #555555; }

body.light-theme .linker-viz-mem-row {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .linker-viz-mem-row.mem-stack {
    background: rgba(178, 115, 249, 0.08);
}

body.light-theme .linker-viz-mem-row.mem-common {
    background: rgba(255, 165, 0, 0.08);
}

body.light-theme .linker-viz-mem-total {
    background: rgba(0, 0, 0, 0.03);
    border-left-color: #480096;
}

body.light-theme .sym-module {
    color: #666;
}

body.light-theme .dup-badge {
    background: rgba(255, 165, 0, 0.2);
    color: #B26000;
}

body.light-theme .linker-viz-reloc-summary {
    background: rgba(0, 100, 100, 0.06);
    border-left-color: #008080;
}

body.light-theme .linker-viz-note {
    background: rgba(255, 165, 0, 0.06);
    border-left-color: #B26000;
}

body.light-theme .linker-viz-empty {
    color: #888;
}

body.light-theme .linker-viz-error {
    background: rgba(255, 80, 80, 0.08);
    border-left-color: #cc0000;
    color: #990000;
}

body.light-theme .linker-viz-no-linker-title {
    color: #B26000;
}

body.light-theme .linker-viz-no-linker-text {
    color: #555;
}

body.light-theme .linker-viz-no-linker-text code {
    background: rgba(0, 0, 0, 0.06);
}

body.light-theme .linker-viz-module-card {
    background: rgba(0, 0, 0, 0.02);
    border-left-color: #480096;
}

body.light-theme .linker-viz-module-name {
    color: #480096;
}

body.light-theme .linker-viz-module-info {
    color: #666;
}

/* ==========================================================================
   🎯 МОДАЛЬНОЕ ОКНО ПОДТВЕРЖДЕНИЯ ЗАМЕНЫ (Vim :s/.../.../c)
   ========================================================================== */

.vim-confirm-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    padding: 20px;
}

.vim-confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

body.light-theme .vim-confirm-overlay {
    background-color: rgba(255, 255, 255, 0.75);
}

.vim-confirm-modal {
    width: 100%;
    max-width: 560px;
    background-color: #0a0a0a;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color 0.5s ease, border-color 0.5s ease;
}

.vim-confirm-overlay.active .vim-confirm-modal {
    transform: translateY(0) scale(1);
}

body.light-theme .vim-confirm-modal {
    background-color: #ffffff;
    border-color: #ddd;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* ===== Заголовок ===== */
.vim-confirm-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
}

body.light-theme .vim-confirm-header {
    border-bottom-color: #e0e0e0;
}

.vim-confirm-title {
    font-size: 1rem;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.vim-confirm-title svg {
    width: 18px;
    height: 18px;
    color: #B7FF69;
    flex-shrink: 0;
}

body.light-theme .vim-confirm-title {
    color: #000000;
}

body.light-theme .vim-confirm-title svg {
    color: #480096;
}

.vim-confirm-counter {
    font-family: 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

body.light-theme .vim-confirm-counter {
    background-color: rgba(0, 0, 0, 0.05);
    color: #666;
}

/* ===== Тело ===== */
.vim-confirm-body {
    padding: 16px 20px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
}

.vim-confirm-question {
    font-size: 0.9rem;
    color: #ccc;
    line-height: 1.4;
}

body.light-theme .vim-confirm-question {
    color: #333;
}

.vim-confirm-question code {
    font-family: 'Source Code Pro', 'Consolas', monospace;
    background-color: rgba(255, 212, 103, 0.12);
    color: #FFD467;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

body.light-theme .vim-confirm-question code {
    background-color: rgba(180, 95, 6, 0.1);
    color: #B45F06;
}

.vim-confirm-arrow {
    color: #888;
    margin: 0 4px;
}

/* ===== Предпросмотр ===== */
.vim-confirm-preview {
    font-family: 'Source Code Pro', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    background-color: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 12px 14px;
    overflow-x: auto;
    white-space: pre;
    color: #e0e0e0;
    scrollbar-width: thin;
}

body.light-theme .vim-confirm-preview {
    background-color: #fafafa;
    border-color: #e0e0e0;
    color: #1a1a1a;
}

.vim-confirm-preview::-webkit-scrollbar {
    height: 8px;
}

.vim-confirm-preview::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

body.light-theme .vim-confirm-preview::-webkit-scrollbar-thumb {
    background: #ccc;
}

.vim-confirm-preview-line {
    display: block;
    white-space: pre;
}

.vim-confirm-preview-line.marker {
    user-select: none;
}

/* 🎯 Совпадение — жёлтый (как подсветка поиска) */
.vim-confirm-match {
    background-color: rgba(255, 165, 0, 0.55);
    color: #FFFFFF;
    border-radius: 2px;
    padding: 0 1px;
    box-shadow: 0 0 0 1px rgba(255, 140, 0, 0.9);
}

body.light-theme .vim-confirm-match {
    background-color: rgba(255, 140, 0, 0.6);
    color: #FFFFFF;
    box-shadow: 0 0 0 1px rgba(200, 100, 0, 0.9);
}

.vim-confirm-marker {
    color: #FFA500;
    font-weight: 700;
}

body.light-theme .vim-confirm-marker {
    color: #B45F06;
}

/* ===== Подсказки по клавишам ===== */
.vim-confirm-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 20px;
    background-color: #111;
    border-top: 1px solid #2a2a2a;
    flex-shrink: 0;
}

body.light-theme .vim-confirm-hints {
    background-color: #f0f0f0;
    border-top-color: #e0e0e0;
}

.vim-confirm-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    font-size: 0.75rem;
    color: #ccc;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.vim-confirm-hint:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

body.light-theme .vim-confirm-hint {
    background-color: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

body.light-theme .vim-confirm-hint:hover {
    background-color: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
    color: #000;
}

.vim-confirm-key {
    display: inline-block;
    min-width: 18px;
    padding: 1px 5px;
    background-color: rgba(183, 255, 105, 0.15);
    border: 1px solid rgba(183, 255, 105, 0.35);
    border-radius: 3px;
    font-family: 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: #B7FF69;
    text-align: center;
}

body.light-theme .vim-confirm-key {
    background-color: rgba(72, 0, 150, 0.1);
    border-color: rgba(72, 0, 150, 0.3);
    color: #480096;
}

/* 🎯 Особые кнопки: y, l — зелёные */
.vim-confirm-hint[data-action="yes"] .vim-confirm-key,
.vim-confirm-hint[data-action="last"] .vim-confirm-key {
    background-color: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.4);
    color: #4ADE80;
}

body.light-theme .vim-confirm-hint[data-action="yes"] .vim-confirm-key,
body.light-theme .vim-confirm-hint[data-action="last"] .vim-confirm-key {
    background-color: rgba(0, 150, 70, 0.12);
    border-color: rgba(0, 150, 70, 0.35);
    color: #0A7A3A;
}

/* 🎯 Кнопки q, Esc — красные */
.vim-confirm-hint[data-action="quit"] .vim-confirm-key,
.vim-confirm-hint[data-action="cancel"] .vim-confirm-key {
    background-color: rgba(255, 80, 80, 0.15);
    border-color: rgba(255, 80, 80, 0.4);
    color: #ff8080;
}

body.light-theme .vim-confirm-hint[data-action="quit"] .vim-confirm-key,
body.light-theme .vim-confirm-hint[data-action="cancel"] .vim-confirm-key {
    background-color: rgba(200, 0, 0, 0.1);
    border-color: rgba(200, 0, 0, 0.3);
    color: #c00;
}

/* 🎯 Кнопка a — жёлтая (как предупреждение) */
.vim-confirm-hint[data-action="all"] .vim-confirm-key {
    background-color: rgba(255, 212, 103, 0.15);
    border-color: rgba(255, 212, 103, 0.4);
    color: #FFD467;
}

body.light-theme .vim-confirm-hint[data-action="all"] .vim-confirm-key {
    background-color: rgba(180, 95, 6, 0.1);
    border-color: rgba(180, 95, 6, 0.3);
    color: #B45F06;
}

/* 🎯 Кнопка n — нейтральная */
.vim-confirm-hint[data-action="no"] .vim-confirm-key {
    background-color: rgba(200, 200, 200, 0.1);
    border-color: rgba(200, 200, 200, 0.3);
    color: #ccc;
}

body.light-theme .vim-confirm-hint[data-action="no"] .vim-confirm-key {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
    color: #666;
}

/* ===== Мобильная адаптация ===== */
@media (max-width: 768px) {
    .vim-confirm-modal {
        max-width: 100%;
        max-height: 90vh;
    }

    .vim-confirm-header {
        padding: 12px 16px;
    }

    .vim-confirm-title {
        font-size: 0.9rem;
    }

    .vim-confirm-body {
        padding: 14px 16px 6px;
    }

    .vim-confirm-preview {
        font-size: 0.78rem;
        padding: 10px 12px;
    }

    .vim-confirm-hints {
        padding: 10px 16px;
        gap: 4px;
    }

    .vim-confirm-hint {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

/* ===== 🎯 INLINE-РЕДАКТИРОВАНИЕ ИМЕНИ ВКЛАДКИ ===== */

.editor-tab-name-input {
    flex: 1;
    min-width: 60px;
    max-width: 150px;
    padding: 1px 4px;
    margin: -2px 0;
    background-color: #0a0a0a;
    border: 1px solid #B7FF69;
    border-radius: 3px;
    color: #B7FF69;
    font-family: 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    box-sizing: border-box;
    caret-color: #B7FF69;
}

body.light-theme .editor-tab-name-input {
    background-color: #ffffff;
    border-color: #480096;
    color: #480096;
    caret-color: #480096;
}

/* 🎯 Вкладка в режиме переименования — курсор-текст */
.editor-tab.renaming {
    cursor: text;
}

.editor-tab.renaming .editor-tab-close {
    opacity: 0.3;
    pointer-events: none;
}

/* 🎯 Ошибка в имени (недопустимые символы / дубликат) */
.editor-tab-name-input.invalid {
    border-color: #ff5050;
    color: #ff8080;
    background-color: rgba(255, 80, 80, 0.08);
}

body.light-theme .editor-tab-name-input.invalid {
    border-color: #c00;
    color: #c00;
    background-color: rgba(200, 0, 0, 0.06);
}

/* 🎯 Системные .inc-файлы — нельзя переименовать */
.editor-tab.system-file .editor-tab-name {
    cursor: default;
}

/* ===== 🎯 DRAG & DROP ПЕРЕСТАНОВКА ВКЛАДОК ===== */

.editor-tab {
    transition: background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

/* 🎯 Перетаскиваемая вкладка — «призрак» следует за курсором */
.editor-tab.dragging {
    opacity: 0.4;
    transform: scale(0.96);
}

/* 🎯 Панель во время drag */
.editor-tabs-panel.dragging-active {
    user-select: none;
    -webkit-user-select: none;
}

.editor-tabs-panel.dragging-active .editor-textarea {
    pointer-events: none;
}

/* ===== 🎯 УБИРАЕМ СТАНДАРТНЫЙ OUTLINE ПРИ DRAG ===== */

/* Браузер рисует пунктирный квадрат на элементе, ставшем drop-target.
   Отключаем его — визуальную обратную связь даёт живое раздвигание. */
.editor-tabs-panel,
.editor-tabs-list,
.editor-tab {
    outline: none !important;
}

/* ============================================================
   JSDoc RENDERED VIEW (Ctrl+Alt+Q) — overlay на wrapper
   ============================================================ */

.jsdoc-render-overlay {
    background-color: #0d0d0d;
    border-left: 3px solid #B7FF69;
    padding: 8px 12px;
    box-sizing: border-box;
    font-family: 'Source Code Pro', 'Consolas', monospace;
    color: #e0e0e0;
    overflow: auto;
    pointer-events: none;
}

.jsdoc-render-desc {
    color: #e0e0e0;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 8px;
}

.jsdoc-render-section {
    margin-top: 8px;
}

.jsdoc-render-title {
    color: #B7FF69;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    opacity: 0.85;
}

.jsdoc-render-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 2px 0;
    font-size: 0.85rem;
    line-height: 1.4;
}

.jsdoc-render-type {
    color: #7BD7DD;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 40px;
}

.jsdoc-render-name {
    color: #FFD467;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 60px;
}

.jsdoc-render-row .jsdoc-render-desc {
    color: #b0b0b0;
    font-size: 0.85rem;
    margin: 0;
}

/* ---- Светлая тема ---- */

body.light-theme .jsdoc-render-overlay {
    background-color: #fafafa;
    border-left-color: #480096;
    color: #1a1a1a;
}

body.light-theme .jsdoc-render-desc {
    color: #1a1a1a;
}

body.light-theme .jsdoc-render-title {
    color: #480096;
}

body.light-theme .jsdoc-render-type {
    color: #2F6F7A;
}

body.light-theme .jsdoc-render-name {
    color: #B45F06;
}

body.light-theme .jsdoc-render-row .jsdoc-render-desc {
    color: #555;
}


















/* ============================================================
   🎯 КНОПКА "ФАЙЛЫ" В ПАНЕЛИ ВКЛАДОК
   ============================================================ */

.editor-files-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin: 6px 4px 0 8px;
    background-color: rgba(183, 255, 105, 0.10);
    border: 1px solid rgba(183, 255, 105, 0.30);
    border-radius: 6px;
    color: #B7FF69;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
    align-self: center;
}

.editor-files-btn:hover {
    background-color: rgba(183, 255, 105, 0.18);
    border-color: rgba(183, 255, 105, 0.5);
}

.editor-files-btn:active {
    transform: scale(0.97);
}

.editor-files-btn.active {
    background-color: rgba(183, 255, 105, 0.25);
    border-color: rgba(183, 255, 105, 0.65);
    box-shadow: 0 0 10px rgba(183, 255, 105, 0.25);
}

.editor-files-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

body.light-theme .editor-files-btn {
    background-color: rgba(72, 0, 150, 0.06);
    border-color: rgba(72, 0, 150, 0.25);
    color: #480096;
}

body.light-theme .editor-files-btn:hover {
    background-color: rgba(72, 0, 150, 0.12);
    border-color: rgba(72, 0, 150, 0.45);
}

body.light-theme .editor-files-btn.active {
    background-color: rgba(72, 0, 150, 0.18);
    border-color: rgba(72, 0, 150, 0.6);
}

/* ============================================================
   🎯 ПОДМЕНЮ "ФАЙЛЫ" — ПОВЕРХ ВСЕХ ЭЛЕМЕНТОВ
   ============================================================ */

.editor-files-menu {
    position: fixed;
    z-index: 10050;               /* 🎯 выше вкладок и тулбара */
    background-color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    max-height: 70vh;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.editor-files-menu.open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

body.light-theme .editor-files-menu {
    background-color: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

/* ---- Заголовок меню ---- */
.editor-files-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    flex-shrink: 0;
}

body.light-theme .editor-files-menu-header {
    color: #666;
}

.editor-files-count {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    background-color: rgba(183, 255, 105, 0.15);
    border: 1px solid rgba(183, 255, 105, 0.3);
    border-radius: 8px;
    color: #B7FF69;
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    font-family: 'Source Code Pro', monospace;
}

body.light-theme .editor-files-count {
    background-color: rgba(72, 0, 150, 0.1);
    border-color: rgba(72, 0, 150, 0.3);
    color: #480096;
}

/* ---- Кнопки-действия (только иконки, в ряд) ---- */
.editor-files-menu-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 4px;
    flex-shrink: 0;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
}

body.light-theme .editor-files-menu-actions {
    background-color: rgba(0, 0, 0, 0.02);
}

.editor-files-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 6px;
    color: #b0b0b0;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    flex-shrink: 0;
    position: relative;
}

.editor-files-action:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #B7FF69;
}

.editor-files-action:active {
    transform: scale(0.92);
}

.editor-files-action svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.8;
    pointer-events: none;
}

.editor-files-action:hover svg {
    opacity: 1;
}

body.light-theme .editor-files-action {
    color: #666;
}

body.light-theme .editor-files-action:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: #480096;
}

/* 🎯 Особый стиль для "Закрыть все" */
.editor-files-action[data-action="close-all"]:hover {
    background-color: rgba(255, 80, 80, 0.15);
    color: #ff8080;
}

body.light-theme .editor-files-action[data-action="close-all"]:hover {
    background-color: rgba(200, 0, 0, 0.1);
    color: #c00;
}

/* 🎯 Раскрыть/Свернуть — нейтральный цвет */
.editor-files-action[data-action="expand-all"]:hover,
.editor-files-action[data-action="collapse-all"]:hover {
    background-color: rgba(123, 215, 221, 0.15);
    color: #7BD7DD;
}

body.light-theme .editor-files-action[data-action="expand-all"]:hover,
body.light-theme .editor-files-action[data-action="collapse-all"]:hover {
    background-color: rgba(47, 111, 122, 0.1);
    color: #2F6F7A;
}

/* ---- Разделитель ---- */
.editor-files-menu-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
    flex-shrink: 0;
}

body.light-theme .editor-files-menu-divider {
    background-color: rgba(0, 0, 0, 0.08);
}

/* ---- Список файлов ---- */
.editor-files-menu-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-height: 0;
    padding: 2px 0;
    scrollbar-width: thin;
}

.editor-files-menu-list::-webkit-scrollbar {
    width: 6px;
}

.editor-files-menu-list::-webkit-scrollbar-track {
    background: transparent;
}

.editor-files-menu-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

body.light-theme .editor-files-menu-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

/* ---- Элемент файла ---- */
.editor-files-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.12s ease;
    min-width: 0;
}

.editor-files-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.editor-files-item.active {
    background-color: rgba(183, 255, 105, 0.12);
}

body.light-theme .editor-files-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

body.light-theme .editor-files-item.active {
    background-color: rgba(72, 0, 150, 0.08);
}

/* ---- Иконка-бейдж расширения ---- */
.editor-files-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 16px;
    padding: 0 4px;
    font-family: 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: 3px;
    flex-shrink: 0;
    background-color: rgba(150, 150, 150, 0.18);
    color: #b0b0b0;
    border: 1px solid rgba(150, 150, 150, 0.25);
}

.editor-files-item-icon-asm {
    background-color: rgba(183, 255, 105, 0.15);
    color: #B7FF69;
    border-color: rgba(183, 255, 105, 0.35);
}

.editor-files-item-icon-inc {
    background-color: rgba(123, 215, 221, 0.15);
    color: #7BD7DD;
    border-color: rgba(123, 215, 221, 0.35);
}

.editor-files-item-icon-txt {
    background-color: rgba(255, 212, 103, 0.15);
    color: #FFD467;
    border-color: rgba(255, 212, 103, 0.35);
}

body.light-theme .editor-files-item-icon-asm {
    background-color: rgba(72, 0, 150, 0.08);
    color: #480096;
    border-color: rgba(72, 0, 150, 0.25);
}

body.light-theme .editor-files-item-icon-inc {
    background-color: rgba(47, 111, 122, 0.08);
    color: #2F6F7A;
    border-color: rgba(47, 111, 122, 0.25);
}

body.light-theme .editor-files-item-icon-txt {
    background-color: rgba(180, 95, 6, 0.08);
    color: #B45F06;
    border-color: rgba(180, 95, 6, 0.25);
}

/* ---- Имя файла ---- */
.editor-files-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Source Code Pro', 'Consolas', monospace;
    font-size: 0.78rem;
    color: #d0d0d0;
}

.editor-files-item.active .editor-files-item-name {
    color: #B7FF69;
    font-weight: 600;
}

body.light-theme .editor-files-item-name {
    color: #333;
}

body.light-theme .editor-files-item.active .editor-files-item-name {
    color: #480096;
}

/* ---- Кнопка × у элемента ---- */
.editor-files-item-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.12s ease, background-color 0.12s ease, color 0.12s ease;
    padding: 0;
}

.editor-files-item:hover .editor-files-item-close {
    opacity: 0.7;
}

.editor-files-item-close:hover {
    opacity: 1;
    background-color: rgba(255, 80, 80, 0.2);
    color: #ff8080;
}

body.light-theme .editor-files-item-close {
    color: #999;
}

body.light-theme .editor-files-item-close:hover {
    background-color: rgba(200, 0, 0, 0.1);
    color: #c00;
}

/* ---- Пустое состояние ---- */
.editor-files-empty {
    padding: 20px 12px;
    text-align: center;
    color: #888;
    font-size: 0.8rem;
    font-style: italic;
}

body.light-theme .editor-files-empty {
    color: #999;
}

/* ---- Мобильная адаптация ---- */
@media (max-width: 768px) {
    .editor-files-btn {
        padding: 6px 8px;
        margin: 6px 4px 0 6px;
    }

    .editor-files-btn-label {
        display: none;
    }

    .editor-files-menu {
        max-height: 60vh;
    }

    .editor-files-action {
        padding: 10px 12px;
        font-size: 0.88rem;
    }
}

/* ============================================================
   🎯 ДЕРЕВО ФАЙЛОВ И ПАПОК В МЕНЮ "ФАЙЛЫ"
   ============================================================ */

.editor-files-tree {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-height: 0;
    padding: 2px 0;
    scrollbar-width: thin;
}

.editor-files-tree::-webkit-scrollbar {
    width: 6px;
}

.editor-files-tree::-webkit-scrollbar-track {
    background: transparent;
}

.editor-files-tree::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

body.light-theme .editor-files-tree::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

/* ---- Папка ---- */
.editor-files-folder {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px 5px 0;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.12s ease;
    min-width: 0;
    user-select: none;
}

.editor-files-folder:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

body.light-theme .editor-files-folder:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.editor-files-folder.dragging,
.editor-files-folder.folder-dragging {
    opacity: 0.4;
}

.editor-files-folder.drop-target {
    background-color: rgba(183, 255, 105, 0.18);
    box-shadow: inset 0 0 0 1px rgba(183, 255, 105, 0.5);
}

body.light-theme .editor-files-folder.drop-target {
    background-color: rgba(72, 0, 150, 0.12);
    box-shadow: inset 0 0 0 1px rgba(72, 0, 150, 0.4);
}

/* ---- Стрелка сворачивания ---- */
.editor-files-folder-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #888;
    transition: transform 0.15s ease;
}

body.light-theme .editor-files-folder-toggle {
    color: #666;
}

.editor-files-tree-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.15s ease;
}

.editor-files-tree-arrow.open {
    transform: rotate(90deg);
}

/* ---- Иконка папки ---- */
.editor-files-folder-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #B7FF69;
}

.editor-files-folder.collapsed .editor-files-folder-icon {
    color: #FFD467;
}

body.light-theme .editor-files-folder-icon {
    color: #480096;
}

.editor-files-folder-icon svg {
    width: 15px;
    height: 15px;
}

/* ---- Имя папки ---- */
.editor-files-folder-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #d0d0d0;
}

body.light-theme .editor-files-folder-name {
    color: #333;
}

/* ---- Кнопка ⋯ у папки ---- */
.editor-files-folder-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.12s ease, background-color 0.12s ease;
    padding: 0;
}

.editor-files-folder:hover .editor-files-folder-menu {
    opacity: 0.7;
}

.editor-files-folder-menu:hover {
    opacity: 1 !important;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.light-theme .editor-files-folder-menu {
    color: #999;
}

body.light-theme .editor-files-folder-menu:hover {
    background-color: rgba(0, 0, 0, 0.08);
    color: #000;
}

/* ---- Пустая папка ---- */
.editor-files-folder-empty {
    padding: 4px 8px;
    font-size: 0.72rem;
    color: #666;
    font-style: italic;
    user-select: none;
}

body.light-theme .editor-files-folder-empty {
    color: #aaa;
}

/* ---- Файл внутри папки — уменьшенный отступ ---- */
.editor-files-item.dragging {
    opacity: 0.4;
}

/* ============================================================
   🎯 КОНТЕКСТНОЕ МЕНЮ ПАПКИ (⋯)
   ============================================================ */

.editor-files-folder-context {
    position: fixed;
    z-index: 10100;
    background-color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: folder-context-appear 0.12s ease;
}

@keyframes folder-context-appear {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

body.light-theme .editor-files-folder-context {
    background-color: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
}

.editor-files-folder-context button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 5px;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
    white-space: nowrap;
    width: 100%;
}

.editor-files-folder-context button:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #B7FF69;
}

.editor-files-folder-context button.danger:hover {
    background-color: rgba(255, 80, 80, 0.12);
    color: #ff8080;
}

.editor-files-folder-context button svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.75;
}

.editor-files-folder-context button:hover svg {
    opacity: 1;
}

body.light-theme .editor-files-folder-context button {
    color: #1a1a1a;
}

body.light-theme .editor-files-folder-context button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #480096;
}

body.light-theme .editor-files-folder-context button.danger:hover {
    background-color: rgba(200, 0, 0, 0.08);
    color: #c00;
}

.editor-files-folder-context-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.08);
    margin: 3px 0;
}

body.light-theme .editor-files-folder-context-divider {
    background-color: rgba(0, 0, 0, 0.08);
}

/* ============================================================
   🎯 СТАТУС "ВКЛАДКА ЗАКРЫТА" И КНОПКА УДАЛЕНИЯ ФАЙЛА
   ============================================================ */

/* 🎯 Файл с закрытой вкладкой — приглушённый вид */
.editor-files-item.tab-closed .editor-files-item-name {
    color: #888;
    font-style: italic;
}

.editor-files-item.tab-closed .editor-files-item-icon {
    opacity: 0.5;
}

.editor-files-item.tab-closed:hover .editor-files-item-name {
    color: #b0b0b0;
}

body.light-theme .editor-files-item.tab-closed .editor-files-item-name {
    color: #999;
}

body.light-theme .editor-files-item.tab-closed:hover .editor-files-item-name {
    color: #666;
}

/* 🎯 Метка "◦" — вкладка закрыта */
.editor-files-item-closed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    flex-shrink: 0;
    color: #888;
    font-size: 0.9rem;
    line-height: 1;
    user-select: none;
}

body.light-theme .editor-files-item-closed {
    color: #aaa;
}

/* 🎯 Кнопка 🗑 — удалить файл */
.editor-files-item-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.12s ease, background-color 0.12s ease, color 0.12s ease;
    padding: 0;
    font-family: inherit;
}

.editor-files-item:hover .editor-files-item-delete {
    opacity: 0.6;
}

.editor-files-item-delete:hover {
    opacity: 1 !important;
    background-color: rgba(255, 80, 80, 0.2);
    color: #ff8080;
}

body.light-theme .editor-files-item-delete {
    color: #999;
}

body.light-theme .editor-files-item-delete:hover {
    background-color: rgba(200, 0, 0, 0.1);
    color: #c00;
}

/* 🎯 Кнопка × остаётся как была, но с подсказкой "закрыть вкладку" */
.editor-files-item-close {
    /* без изменений — стиль уже есть */
}

/* 🎯 Если вкладка закрыта — × не показывается (уже реализовано в JS),
      а 🗑 всегда доступна */




/* 🎯 Пометка «создан DOS-программой» в дереве «Файлы» */
.editor-files-item-dos,
.editor-files-folder-dos {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.12);
    padding: 1px 4px;
    border-radius: 2px;
    margin-left: 4px;
    flex-shrink: 0;
    pointer-events: none;
}

/* 🎯 Пометка «создан DOS-программой» в дереве «Файлы» */
.editor-files-item-dos,
.editor-files-folder-dos {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.12);
    padding: 1px 4px;
    border-radius: 2px;
    margin-left: 4px;
    flex-shrink: 0;
    pointer-events: none;
}

/* 🎯 Пометка «данные ещё не зафиксированы» (идёт AH=40h) */
.editor-files-item-pending {
    font-size: 11px;
    color: #FFA500;
    background: rgba(255, 165, 0, 0.12);
    padding: 1px 4px;
    border-radius: 2px;
    margin-left: 4px;
    flex-shrink: 0;
    pointer-events: none;
    animation: editor-pending-pulse 1.2s ease-in-out infinite;
}

@keyframes editor-pending-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* 🎯 Бейдж «DOS» в дереве папок (уже есть) */
.editor-files-folder-dos {
    /* (стиль уже определён выше, дублирование не нужно) */
}

/* 🎯 Выделенная строка в дереве «Файлы» (клавиатурная навигация) */
.editor-files-item.tree-selected,
.editor-files-folder.tree-selected {
    background: rgba(80, 150, 255, 0.18);
    box-shadow: inset 2px 0 0 #5096ff;
    outline: none;
}

/*.editor-files-item.tree-selected .editor-files-item-name,*/
/*.editor-files-folder.tree-selected .editor-files-folder-name {*/
/*    color: #d0e6ff;*/
}

.editor-textarea.vim-visual-mode::selection {
    background-color: transparent !important;
}