/* Umbra Effector — тёмная тема в палитре проекта */
:root {
    --bg0: #060d1f;
    --bg1: #0a1226;
    --bg2: #0c1730;
    --bg3: #111f3f;
    --line: #1b2a4a;
    --line2: #24365f;
    --text: #d7e1f5;
    --text-dim: #8394b8;
    --text-faint: #5b6a8f;
    --accent: #2e8bff;
    --accent-dim: #1e4d8f;
    --accent-soft: #7db4ff;
    --gold: #7ec8ff;
    --orange: #ff9d5c;
    --red: #ff4444;
    --key: #7ec8ff;
    --key-sel: #5fd4ff;
    --lw: 292px;
    --rw: 312px;
    --tlh: 252px;
    --left-top: 55%;
    --right-top: 38%;
    --radius: 6px;
    font-size: 13px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    background: var(--bg0);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, sans-serif;
    user-select: none;
}
input, select, button, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #16223f; border-radius: 5px; border: 2px solid var(--bg1); }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }

/* --app-h ставит UFX.Dom.applyScale: при zoom на <html> 100vh считается в увеличенных пикселях и не совпадает с окном */
#app { display: flex; flex-direction: column; height: var(--app-h, 100vh); }

/* ---------- верхняя панель ---------- */
#topbar {
    display: flex; align-items: center; gap: 10px;
    height: 40px; padding: 0 12px;
    background: var(--bg1); border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
}
.logo { font-weight: 700; letter-spacing: 2px; color: var(--text); font-size: 13px; white-space: nowrap; }
.logo span { color: var(--accent); }
.app-ver { margin-left: -5px; color: var(--text-faint); font-size: 11px; white-space: nowrap; }
.fx-name {
    background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 4px 10px; width: 240px; outline: none; flex: 0 1 240px; min-width: 90px;
}
.fx-name:focus { border-color: var(--accent-dim); }
.topbar-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.tb {
    background: var(--bg3); border: 1px solid var(--line2); border-radius: var(--radius);
    padding: 4px 12px; cursor: pointer; color: var(--text); white-space: nowrap;
}
.tb:hover { background: #16223f; }
.tb:disabled { opacity: 0.4; cursor: default; }
.tb.accent { border-color: var(--accent-dim); color: var(--accent); }
.tb.accent:hover { background: #12294a; }
.tb-sep { width: 1px; height: 20px; background: var(--line2); margin: 0 3px; flex: 0 0 auto; }
.save-status { margin-left: auto; color: var(--text-faint); font-size: 12px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* узкое окно (класс ставит UFX.Dom.applyScale по ширине в CSS-пикселях, с учётом масштаба интерфейса) */
html.ufx-narrow #topbar { gap: 8px; padding: 0 8px; }
html.ufx-narrow .app-ver { display: none; }
html.ufx-narrow .topbar-btns { gap: 4px; }
html.ufx-narrow #topbar .tb { padding: 4px 8px; }
html.ufx-xnarrow .logo { letter-spacing: 1px; font-size: 12px; }
html.ufx-xnarrow .fx-name { flex-basis: 150px; }
html.ufx-xnarrow .tb-sep { display: none; }

/* ---------- каркас ---------- */
#main { display: flex; flex: 1 1 auto; min-height: 0; }
.col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#left-col { width: var(--lw); flex: 0 0 auto; }
#right-col { width: var(--rw); flex: 0 0 auto; }
#center-col { flex: 1 1 auto; background: var(--bg0); }
#timeline { height: var(--tlh); flex: 0 0 auto; background: var(--bg1); border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 120px; position: relative; }

#panel-globals { flex: 0 0 var(--left-top); }
#panel-catalog { flex: 1 1 0; }
#panel-layers { flex: 0 0 var(--right-top); }
#panel-inspector { flex: 1 1 0; }

.v-split { width: 5px; flex: 0 0 auto; cursor: col-resize; background: transparent; position: relative; z-index: 5; }
.v-split:hover, .v-split.active { background: var(--accent-dim); }
.h-split { height: 5px; flex: 0 0 auto; cursor: row-resize; background: transparent; position: relative; z-index: 5; }
.h-split:hover, .h-split.active { background: var(--accent-dim); }

.panel { display: flex; flex-direction: column; background: var(--bg1); min-height: 0; overflow: hidden; }
.panel-title {
    flex: 0 0 auto; padding: 6px 10px;
    font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
    color: var(--accent-soft); background: var(--bg2); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    flex-wrap: wrap; row-gap: 4px;
}
/* кнопки заголовка не обрезаются: если не помещаются рядом с названием, переносятся строкой ниже, вправо */
.panel-title-btns { display: flex; gap: 4px; flex: 0 0 auto; margin-left: auto; }
.panel-title > span:first-child { white-space: nowrap; }
.panel-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; min-height: 0; }

/* ---------- мелкие кнопки ---------- */
.mini-btn {
    background: var(--bg3); border: 1px solid var(--line2); border-radius: 4px;
    min-width: 22px; height: 20px; padding: 0 6px; cursor: pointer;
    color: var(--text-dim); font-size: 11px; line-height: 18px;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.mini-btn:hover { color: var(--text); background: #16223f; }
.mini-btn.on { color: var(--accent); border-color: var(--accent-dim); }
.mini-btn svg { width: 12px; height: 12px; fill: currentColor; }

/* ---------- инспектор / виджеты ---------- */
.insp-section { border-bottom: 1px solid var(--line); }
.insp-sec-head {
    padding: 5px 10px; cursor: pointer; font-weight: 600; font-size: 12px;
    color: var(--gold); display: flex; align-items: center; gap: 6px;
}
.insp-sec-head:hover { background: var(--bg2); }
.insp-sec-head .arrow { transition: transform 0.12s; font-size: 9px; color: var(--text-faint); }
.insp-section.closed .arrow { transform: rotate(-90deg); }
.insp-section.closed .insp-sec-body { display: none; }
.insp-sec-body { padding: 4px 0 8px; }

.w-row {
    display: flex; align-items: center; gap: 6px;
    padding: 2px 10px; min-height: 24px;
}
.w-row:hover { background: rgba(255,255,255,0.02); }
.w-label { flex: 0 0 108px; color: var(--text-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-body { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; }

.stopwatch {
    flex: 0 0 16px; width: 16px; height: 16px; cursor: pointer; border-radius: 3px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-faint); border: 1px solid transparent;
}
.stopwatch:hover { color: var(--text); border-color: var(--line2); }
.stopwatch.anim { color: var(--accent); }
.stopwatch svg { width: 12px; height: 12px; fill: currentColor; }
.keybtn {
    flex: 0 0 14px; width: 14px; height: 14px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; color: var(--text-faint);
}
.keybtn:hover { color: var(--text); }
.keybtn.haskey { color: var(--key); }
.keybtn svg { width: 9px; height: 9px; fill: currentColor; transform: rotate(45deg); }

.num-field {
    background: var(--bg2); border: 1px solid var(--line); border-radius: 4px;
    padding: 2px 7px; min-width: 52px; max-width: 90px; flex: 1 1 auto;
    cursor: ew-resize; text-align: right; font-size: 12px; color: var(--text);
    white-space: nowrap; overflow: hidden;
}
.num-field:hover { border-color: var(--line2); }
.num-field.anim { color: var(--accent); }
.num-field.editing { cursor: text; }
.num-field input {
    width: 100%; background: transparent; border: none; outline: none;
    text-align: right; color: var(--key-sel); font-size: 12px; padding: 0;
}
.num-unit { color: var(--text-faint); font-size: 11px; flex: 0 0 auto; }

.w-select {
    background: var(--bg2); border: 1px solid var(--line); border-radius: 4px;
    padding: 2px 6px; flex: 1 1 auto; min-width: 0; outline: none; font-size: 12px; cursor: pointer;
}
.w-select option { background: var(--bg2); }
.w-check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.w-check input { accent-color: var(--accent); cursor: pointer; }
.w-color { width: 34px; height: 20px; padding: 0; border: 1px solid var(--line2); border-radius: 4px; background: none; cursor: pointer; }
.w-color::-webkit-color-swatch-wrapper { padding: 1px; }
.w-color::-webkit-color-swatch { border: none; border-radius: 3px; }

.curve-wrap, .grad-wrap { padding: 3px 10px 5px; }
.curve-canvas { background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; display: block; cursor: crosshair; }
.grad-canvas { border: 1px solid var(--line); border-radius: 4px; display: block; cursor: copy; }
.grad-stops { position: relative; height: 12px; margin-top: 1px; }
.grad-stop {
    position: absolute; top: 0; width: 10px; height: 10px; margin-left: -5px;
    background: #ccc; border: 1px solid #000; border-radius: 2px; cursor: ew-resize;
}
.grad-stop.sel { border-color: var(--key-sel); box-shadow: 0 0 4px var(--key-sel); }
.widget-foot { display: flex; gap: 6px; align-items: center; margin-top: 3px; }

.sprite-btn {
    flex: 1 1 auto; display: flex; align-items: center; gap: 8px;
    background: var(--bg2); border: 1px solid var(--line); border-radius: 4px;
    padding: 3px 8px; cursor: pointer; min-width: 0;
}
.sprite-btn:hover { border-color: var(--accent-dim); }
.sprite-btn canvas { width: 26px; height: 26px; background: #000; border-radius: 3px; flex: 0 0 auto; }
.sprite-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

/* всплывающий выбор спрайта */
.popover {
    position: fixed; z-index: 200; background: var(--bg2);
    border: 1px solid var(--line2); border-radius: 8px; padding: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6); max-width: 360px;
}
.popover h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-soft); margin: 4px 0 6px; }
.sprite-grid { display: grid; grid-template-columns: repeat(6, 46px); gap: 6px; }
.sprite-cell {
    width: 46px; height: 46px; background: #000; border: 1px solid var(--line); border-radius: 5px;
    cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative;
}
.sprite-cell:hover { border-color: var(--accent-soft); }
.sprite-cell.sel { border-color: var(--accent); box-shadow: 0 0 6px rgba(46,139,255,0.4); }
.sprite-cell canvas { width: 40px; height: 40px; }
.sprite-cell .cap {
    position: absolute; bottom: -1px; left: 0; right: 0; font-size: 9px; text-align: center;
    color: var(--text-dim); background: rgba(0,0,0,0.55); border-radius: 0 0 4px 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
}

/* таблица вспышек (bursts) */
.bursts-table { width: 100%; padding: 0 10px; }
.bursts-row { display: flex; gap: 6px; align-items: center; margin: 2px 0; }
.bursts-row .num-field { max-width: none; }
.bursts-head { color: var(--text-faint); font-size: 11px; display: flex; gap: 6px; padding: 0 10px; }
.bursts-head span { flex: 1; }

/* ---------- слои ---------- */
.layer-row {
    display: flex; align-items: center; gap: 6px; padding: 4px 8px;
    border-bottom: 1px solid var(--line); cursor: pointer; position: relative;
}
.layer-row:hover { background: var(--bg2); }
.layer-row.sel { background: #132a4a; }
.layer-row.dragover-top::before, .layer-row.dragover-bot::after {
    content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--accent);
}
.layer-row.dragover-top::before { top: -1px; }
.layer-row.dragover-bot::after { bottom: -1px; }
.layer-row .type-badge {
    flex: 0 0 18px; height: 18px; border-radius: 4px; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.type-badge.emitter { background: #4a3520; color: var(--gold); }
.type-badge.sprite { background: #0d2a4a; color: var(--accent); }
.type-badge.atlas { background: #43301e; color: var(--orange); }
.type-badge.postfx { background: #322043; color: #c78bff; }
.layer-row .lname { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.layer-row .lname input { width: 100%; background: var(--bg3); border: 1px solid var(--accent-dim); border-radius: 3px; outline: none; padding: 1px 4px; }
.layer-row.off .lname { color: var(--text-faint); }
.eye-btn, .solo-btn {
    flex: 0 0 18px; width: 18px; height: 18px; cursor: pointer; border-radius: 3px;
    display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 10px;
}
.eye-btn:hover, .solo-btn:hover { color: var(--text); }
.eye-btn.on { color: var(--accent-soft); }
.solo-btn.on { color: var(--gold); }
.eye-btn svg { width: 13px; height: 13px; fill: currentColor; }
.layers-empty, .catalog-empty { padding: 14px; color: var(--text-faint); font-size: 12px; text-align: center; }

/* ---------- каталог ---------- */
.cat-group { padding: 4px 8px 2px; color: var(--text-faint); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.cat-row {
    display: flex; align-items: center; gap: 8px; padding: 4px 8px;
    cursor: pointer; border-bottom: 1px solid var(--line);
}
.cat-row:hover { background: var(--bg2); }
.cat-row.current { background: #132a4a; }
.cat-row canvas, .cat-row img { width: 42px; height: 42px; background: #000; border-radius: 5px; border: 1px solid var(--line); flex: 0 0 auto; }
.cat-row .cname { flex: 1 1 auto; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row .csub { display: block; color: var(--text-faint); font-size: 10px; }
.cat-row .del { flex: 0 0 auto; opacity: 0; }
.cat-row:hover .del { opacity: 1; }

/* ---------- превью ---------- */
#preview-toolbar {
    display: flex; align-items: center; gap: 8px; padding: 4px 10px;
    background: var(--bg1); border-bottom: 1px solid var(--line); flex: 0 0 30px;
    min-width: 0; overflow: hidden;
}
/* кнопки не сжимаются и не наезжают друг на друга; уступает место только счётчик частиц/FPS справа */
#preview-toolbar > * { flex-shrink: 0; white-space: nowrap; }
#preview-toolbar > .pt-info { flex-shrink: 1; min-width: 0; overflow: hidden; }
html.ufx-xnarrow #preview-toolbar { gap: 5px; padding: 4px 6px; }
html.ufx-xnarrow #preview-toolbar .tab-btn { padding: 4px 6px; }
.tab-btn {
    background: none; border: none; border-bottom: 2px solid transparent;
    padding: 4px 10px; cursor: pointer; color: var(--text-dim); font-size: 12px; letter-spacing: 0.5px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.on { color: var(--accent); border-bottom-color: var(--accent); }
.pt-sep { width: 1px; height: 18px; background: var(--line2); }
.pt-info { margin-left: auto; color: var(--text-faint); font-size: 11px; white-space: nowrap; display: flex; gap: 12px; }
#preview-area { flex: 1 1 auto; position: relative; overflow: hidden; min-height: 0; }
#view-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#preview-hud {
    position: absolute; left: 10px; bottom: 8px; color: var(--text-faint);
    font-size: 11px; pointer-events: none; text-shadow: 0 1px 2px #000;
}

/* ---------- таймлайн ---------- */
#tl-head {
    display: flex; align-items: center; gap: 4px; padding: 3px 10px;
    border-bottom: 1px solid var(--line); flex: 0 0 30px; background: var(--bg2);
}
.tr-btn {
    background: var(--bg3); border: 1px solid var(--line2); border-radius: 4px;
    width: 26px; height: 22px; cursor: pointer; color: var(--text-dim);
    display: inline-flex; align-items: center; justify-content: center;
}
.tr-btn:hover { color: var(--text); background: #16223f; }
.tr-btn.on { color: var(--accent); border-color: var(--accent-dim); }
.tr-btn svg { width: 12px; height: 12px; fill: currentColor; }
.tl-time {
    font-family: Consolas, monospace; font-size: 12px; color: var(--accent);
    background: var(--bg0); border: 1px solid var(--line); border-radius: 4px;
    padding: 2px 8px; margin: 0 6px; white-space: nowrap;
}
.tl-time span { color: var(--text-faint); }
.tl-mode-btns { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.tl-hint { color: var(--text-faint); font-size: 11px; margin-right: 8px; }

/* шпаргалка по хоткеям: не перехватывает мышь, оживает при наведении на таймлайн */
#tl-hints {
    position: absolute; right: 13px; bottom: 12px; z-index: 30;
    display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px 9px;
    max-width: 60%; padding: 3px 8px; border-radius: 6px;
    background: rgba(6,13,31,0.7); border: 1px solid rgba(120,160,255,0.25);
    opacity: 0.3; transition: opacity 0.15s; pointer-events: none;
}
#timeline:hover #tl-hints { opacity: 0.7; }
#timeline.panning #tl-hints { opacity: 0.12; }
/* узкое окно: шпаргалка в две строки ложится на дорожки слоёв; те же клавиши есть в справке «?» */
html.ufx-narrow #tl-hints { display: none; }
#tl-hints .hk { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; line-height: 14px; white-space: nowrap; }
#tl-hints .hk b {
    font-family: Consolas, monospace; font-weight: 600; color: var(--text-dim);
    background: rgba(215,225,245,0.08); border: 1px solid rgba(215,225,245,0.12);
    border-radius: 3px; padding: 0 4px;
}
#tl-hints .hk i { font-style: normal; color: var(--text-faint); }
#timeline.panning, #timeline.panning * { cursor: grabbing !important; }

#tl-scroll { flex: 1 1 auto; overflow: auto; position: relative; min-height: 0; }
#tl-content { position: relative; min-width: 100%; }
.tl-grid { display: grid; grid-template-columns: 210px 1fr; }

#tl-ruler-row { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 210px 1fr; background: var(--bg1); }
#tl-corner { position: sticky; left: 0; z-index: 21; background: var(--bg2); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
    display: flex; align-items: center; padding: 0 8px; color: var(--text-faint); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
#tl-ruler { position: relative; height: 24px; border-bottom: 1px solid var(--line); cursor: pointer; }
#tl-ruler canvas { position: absolute; left: 0; top: 0; }

.tl-row { display: grid; grid-template-columns: 210px 1fr; height: 24px; }
.tl-row .tl-name {
    position: sticky; left: 0; z-index: 10; background: var(--bg1); border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 5px;
    padding: 0 6px 0 4px; font-size: 12px; overflow: hidden; white-space: nowrap; cursor: pointer;
}
.tl-row.sel .tl-name { background: #132a4a; }
.tl-row .tl-name .exp { flex: 0 0 14px; text-align: center; color: var(--text-faint); cursor: pointer; font-size: 9px; }
.tl-row .tl-name .exp:hover { color: var(--text); }
.tl-row .tl-name .nm { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tl-row.prop-row { height: 20px; }
.tl-row.prop-row .tl-name { padding-left: 30px; color: var(--text-dim); font-size: 11px; background: var(--bg1); }
.tl-row.prop-row .tl-name:hover { color: var(--accent); }
.tl-row.prop-row .tl-name.graphed { color: var(--accent); }
.tl-track { position: relative; border-bottom: 1px solid rgba(27,42,74,0.6); overflow: visible; }

.tl-bar {
    position: absolute; top: 4px; height: 15px; border-radius: 4px;
    background: linear-gradient(180deg, #2c4a68, #1a2f47); border: 1px solid #3a5f8f;
    cursor: grab; min-width: 6px;
}
.tl-bar.emitter { background: linear-gradient(180deg, #5a4527, #43331d); border-color: #77592f; }
.tl-bar.atlas { background: linear-gradient(180deg, #64432b, #4a3120); border-color: #8a5a34; }
.tl-bar.postfx { background: linear-gradient(180deg, #4a3563, #35254a); border-color: #6b4d92; }
.tl-bar:hover { filter: brightness(1.2); }
.tl-bar .bh { position: absolute; top: 0; bottom: 0; width: 6px; cursor: ew-resize; }
.tl-bar .bh.l { left: -2px; } .tl-bar .bh.r { right: -2px; }

.tl-key {
    position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
    background: var(--key); border: 1px solid #2a5a8f; transform: rotate(45deg);
    cursor: pointer; z-index: 3;
}
.tl-key:hover { background: #bfe2ff; }
.tl-key.sel { background: var(--key-sel); border-color: #2a8fc4; box-shadow: 0 0 5px rgba(95,212,255,0.7); }
.tl-key.hold { border-radius: 0 0 60% 0; }

#tl-playhead {
    position: absolute; top: 0; bottom: 0; width: 1px; background: var(--red);
    z-index: 15; pointer-events: none;
}
#tl-playhead::before {
    content: ""; position: absolute; top: 0; left: -5px; border: 5px solid transparent;
    border-top: 7px solid var(--red);
}

#graph-wrap { position: relative; }
#graph-canvas { display: block; }

/* контекстное меню */
.ctx-menu {
    position: fixed; z-index: 300; background: var(--bg2); border: 1px solid var(--line2);
    border-radius: 6px; padding: 4px; box-shadow: 0 8px 30px rgba(0,0,0,0.6); min-width: 170px;
}
.ctx-item { padding: 5px 12px; cursor: pointer; border-radius: 4px; font-size: 12px; display: flex; justify-content: space-between; gap: 12px; }
.ctx-item:hover { background: var(--accent-dim); color: #fff; }
.ctx-item .mark { color: var(--accent); }
.ctx-item.danger:hover { background: #5c2020; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* глобальные настройки: строки покомпактнее */
.g-section { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.g-title { padding: 6px 10px 3px; font-size: 11px; font-weight: 600; color: var(--gold); }
.tex-row { display: flex; align-items: center; gap: 6px; padding: 3px 10px; }
.tex-row img { width: 30px; height: 30px; object-fit: contain; background: #000; border-radius: 4px; border: 1px solid var(--line); flex: 0 0 auto; }
.tex-row .tname { flex: 1 1 auto; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tex-sheet { display: flex; gap: 4px; align-items: center; padding: 0 10px 4px 46px; color: var(--text-dim); font-size: 11px; }
.tex-sheet .num-field { min-width: 34px; max-width: 46px; }

.btn-row { display: flex; gap: 6px; padding: 4px 10px; flex-wrap: wrap; }
.btn-row .tb { padding: 3px 10px; font-size: 12px; }

.drop-overlay {
    position: fixed; inset: 0; z-index: 400; background: rgba(6,13,31,0.88);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 20px; letter-spacing: 1px;
    border: 3px dashed var(--accent-dim); pointer-events: none;
}
.hidden { display: none !important; }

/* модальный диалог */
.modal-overlay {
    position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
}
.modal-box {
    background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px;
    padding: 18px 20px; min-width: 320px; max-width: 440px;
    max-height: calc(var(--app-h, 100vh) * 0.92); overflow-y: auto;
    box-shadow: 0 12px 50px rgba(0,0,0,0.7);
}
.modal-title { font-weight: 700; color: var(--gold); margin-bottom: 8px; letter-spacing: 0.5px; }
.modal-text { color: var(--text); font-size: 13px; margin-bottom: 14px; line-height: 1.4; }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; }

/* модалка экспорта секвенции */
.seq-dlg { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.seq-fields { display: flex; flex-direction: column; gap: 8px; }
.seq-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.seq-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.seq-inp {
    width: 64px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px;
    padding: 3px 7px; text-align: right; outline: none; font-size: 12px; color: var(--key-sel);
}
.seq-inp.wide { width: 180px; text-align: left; color: var(--text); }
.seq-inp:focus { border-color: var(--accent-dim); }
.seq-info { font-size: 11px; color: var(--text-dim); }
.seq-info.warn { color: var(--orange); }
.seq-prog { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.seq-bar { height: 6px; background: var(--bg1); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seq-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }

/* окно справки / о программе */
.about { margin-bottom: 14px; user-select: text; }
.about-head {
    display: flex; align-items: baseline; gap: 8px;
    padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--line);
}
.about-logo { font-weight: 700; letter-spacing: 2px; font-size: 14px; color: var(--text); }
.about-logo span { color: var(--accent); }
.about-ver { color: var(--text-faint); font-size: 11px; }
.about-p { font-size: 13px; line-height: 1.5; color: var(--text-dim); margin-bottom: 10px; }
.about-howto-t { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin: 2px 0 6px; }
.about-howto { margin: 0 0 14px; padding-left: 20px; font-size: 13px; line-height: 1.5; color: var(--text); }
.about-howto li { margin-bottom: 5px; }
.about-author { font-size: 13px; color: var(--text); margin-top: 12px; }
.about-links { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.about-links a { color: var(--accent); text-decoration: none; font-size: 12px; width: fit-content; }
.about-links a:hover { color: var(--accent-soft); text-decoration: underline; }

/* модалка сетки спрайт-атласа */
.modal-box.wide { max-width: 640px; }
.sheet-dlg { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.sheet-file { font-size: 12px; color: var(--text-dim); }
.sheet-file b { color: var(--text); font-weight: 600; }
.sheet-prev {
    display: flex; justify-content: center; padding: 8px;
    background: var(--bg1); border: 1px solid var(--line); border-radius: 6px;
}
.sheet-canvas { display: block; border-radius: 3px; }
.sheet-info { font-size: 11px; color: var(--text-dim); text-align: center; }
.sheet-info.warn { color: var(--orange); }
.sheet-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.sheet-hint { font-size: 11px; color: var(--text-faint); }
.sheet-fields { display: flex; gap: 14px; align-items: center; }
.sheet-fields label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.sheet-inp {
    width: 58px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px;
    padding: 3px 7px; text-align: right; outline: none; font-size: 12px; color: var(--key-sel);
}
.sheet-inp:focus { border-color: var(--accent-dim); }
/* модалка атласа: выбор источника */
.atlas-drop {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border: 2px dashed var(--line2); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px;
    background: var(--bg1);
}
.atlas-drop.over { border-color: var(--accent); background: #0f2547; }
.atlas-drop-label { color: var(--text-dim); font-size: 12px; }
.atlas-strip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.atlas-cell {
    width: 54px; padding: 3px; border: 1px solid var(--line); border-radius: 5px;
    background: var(--bg2); cursor: pointer; text-align: center;
}
.atlas-cell:hover { border-color: var(--line2); }
.atlas-cell.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim) inset; }
.atlas-cell img { display: block; width: 46px; height: 34px; object-fit: contain; background: #000; border-radius: 3px; }
.atlas-cell .cap { font-size: 9px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atlas-empty { padding: 26px 10px; text-align: center; color: var(--text-faint); font-size: 12px; }
.atlas-info { padding: 2px 10px 4px; font-size: 11px; color: var(--text-dim); }
.atlas-info.warn { color: var(--orange); }

/* таймлайн: управление слоями в колонке имён */
.tl-name .eye-btn, .tl-name .solo-btn {
    flex: 0 0 16px; width: 16px; height: 16px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-faint); border-radius: 3px;
}
.tl-name .eye-btn:hover, .tl-name .solo-btn:hover { color: var(--text); }
.tl-name .eye-btn.on { color: var(--accent-soft); }
.tl-name .solo-btn.on { color: var(--gold); }
.tl-name .eye-btn svg { width: 12px; height: 12px; fill: currentColor; }
.tl-name .solo-btn svg { width: 10px; height: 10px; fill: currentColor; }
.tl-name .del-btn {
    flex: 0 0 14px; width: 14px; height: 14px; cursor: pointer; opacity: 0;
    display: inline-flex; align-items: center; justify-content: center; color: var(--text-faint);
}
.tl-name:hover .del-btn { opacity: 1; }
.tl-name .del-btn:hover { color: var(--red); }
.tl-name .del-btn svg { width: 9px; height: 9px; fill: currentColor; }
.tl-name .nm input { width: 100%; background: var(--bg3); border: 1px solid var(--accent-dim); border-radius: 3px; outline: none; padding: 0 4px; font-size: 11px; }
.tl-row.off .tl-name .nm { color: var(--text-faint); }
.tl-row.dragover-top .tl-name::before, .tl-row.dragover-bot .tl-name::after {
    content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 5;
}
.tl-row.dragover-top .tl-name::before { top: -1px; }
.tl-row.dragover-bot .tl-name::after { bottom: -1px; }
.tl-row .tl-name { position: relative; }

.type-badge.sm { flex: 0 0 15px; width: 15px; height: 15px; font-size: 9px; border-radius: 3px;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

/* строки кривых и градиента в dope sheet */
.tl-row.ol-row { height: 26px; }
.tl-row.ol-row .tl-name { padding-left: 30px; color: var(--text-dim); font-size: 11px; cursor: pointer; }
.tl-row.ol-row .tl-name:hover { color: var(--accent); }
.tl-row.ol-row .tl-name.graphed { color: var(--accent); }
.ol-strip { position: absolute; top: 2px; height: 21px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg0); }
.ol-strip canvas { position: absolute; inset: 0; border-radius: 3px; }
.grad-strip-stop {
    position: absolute; top: -2px; width: 9px; height: 9px; margin-left: -4.5px;
    border: 1px solid #000; border-radius: 2px; cursor: ew-resize; z-index: 4;
}
.grad-strip-stop.sel { border-color: var(--key-sel); box-shadow: 0 0 4px var(--key-sel); }

/* отрицательная зона времени (пре-ролл) */
.tl-preroll { position: absolute; top: 0; bottom: 0; background: rgba(255,68,68,0.05); border-right: 1px solid rgba(255,68,68,0.25); pointer-events: none; }

/* панель текстур */
.tex-row.draggable { cursor: grab; border-bottom: 1px solid var(--line); padding: 5px 8px; }
.tex-row.draggable:hover { background: var(--bg2); }
.tex-row.draggable img { width: 34px; height: 34px; }

/* несохранённые правки */
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex: 0 0 auto; }
#btn-save.attn {
    border-color: var(--orange); color: var(--gold);
    box-shadow: 0 0 7px rgba(255,157,92,0.35);
}
