/* ============================================
   GBCU — стили в духе Stable Diffusion WebUI Forge
   v3.0: палитра и шрифты по UX-исследованию (база знаний 23_UI_DESIGN_RESEARCH)
   ============================================ */

/* шрифты: Inter (UI/текст) + Unbounded (лого/заголовки), переменные, кириллица */
@font-face {
    font-family: "Inter";
    src: url("../assets/fonts/Inter.ttf") format("truetype");
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: "Unbounded";
    src: url("../assets/fonts/Unbounded.ttf") format("truetype");
    font-weight: 200 900;
    font-display: swap;
}

:root {
    --bg:           #0b0f19;
    --bg-panel:     #141c31;
    --bg-block:     #1c2743;
    --bg-hover:     #26345a;
    --border:       #2f3c60;
    --text:         #e8ecf4;
    --text-dim:     #9aa5bd;
    --accent:       #8b5cf6;
    --accent-hover: #a78bfa;
    --accent-deep:  #7c3aed;   /* CTA-фон: белый текст на нём 5.7:1 (WCAG AA) */
    --accent-2:     #f472b6;   /* розовый — аниме-акцент */
    --accent-cyber: #22d3ee;   /* циан — прогресс/фокус */
    --gold:         #fbbf24;   /* кредиты/избранное/звёзды */
    --success:      #4ade80;
    --danger:       #f87171;
    --radius:       8px;
    --font: "Inter", system-ui, sans-serif;
    --font-display: "Unbounded", "Inter", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
}

.btn {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-block);
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary {
    background: var(--accent-deep);
    border-color: var(--accent-deep);
    color: #fff;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-block { width: 100%; }
.btn-small { padding: 5px 10px; font-size: 12px; }

/* ============================================
   РАСКЛАДКА
   ============================================ */
.app { display: flex; height: 100vh; }

.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 12px;
}

/* 10.10.2026 (приказ владельца): стили бейджа «Персонаж не выбран» удалены
   вместе с самим бейджем — элемент убран из разметки сайдбара. */

.queue-box {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: var(--bg-block);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-dim);
}
.queue-box .queue-icon { font-size: 14px; }
.queue-box.busy { border-color: var(--accent); color: var(--text); }

.history-wrap { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.history-title {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.hist-clear-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: var(--radius);
    padding: 3px 8px;
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: all 0.2s;
}
.hist-clear-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}
.btn-clear-all {
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: var(--danger) !important;
}
.btn-clear-all:hover {
    border-color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}
.history-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    overflow-y: auto;
    padding-right: 4px;
}
.history-thumb {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-block);
    transition: 0.15s;
}
.history-thumb:hover { border-color: var(--accent); }
.history-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.history-empty { color: var(--text-dim); font-size: 12px; grid-column: 1/-1; }

.sidebar-bottom {
    display: flex; flex-direction: column; gap: 2px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.version-line {
    margin-top: 10px;
    padding: 6px 10px;
    border-top: 1px dashed var(--border);
    color: var(--text-dim);
    font-size: 11px;
    display: flex; flex-direction: column; gap: 1px;
    user-select: none;
}
.version-line #version-name { color: var(--accent); font-weight: 600; }
.menu-item {
    display: flex; align-items: center; gap: 10px;
    background: transparent; border: none;
    color: var(--text); padding: 8px 10px;
    border-radius: 6px; cursor: pointer;
    font-size: 13px; text-align: left;
    transition: 0.15s;
}
.menu-item:hover { background: var(--bg-block); }
.menu-item.logout { color: var(--danger); }

/* ============================================
   ГЛАВНОЕ ПОЛЕ
   ============================================ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 36px 24px 24px;
}
.main-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 28px;
    width: 100%;
    overflow-y: auto;
}
/* центрирование по вертикали без обрезки: спейсеры делят свободное место,
   при переполнении (высокая картинка) прокрутка идёт от начала */
.main-center::before,
.main-center::after {
    content: "";
    margin-top: auto;
    margin-bottom: auto;
    flex-shrink: 0;
}

.logo {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 800;
    letter-spacing: 6px;
    background: linear-gradient(90deg, #a78bfa, #f472b6, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    user-select: none;
}

.logo.loading {
    background: linear-gradient(90deg,
        #a78bfa 0%, #f472b6 25%,
        #e8ecf4 50%, #f472b6 75%, #a78bfa 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    animation: logoWave 1.2s linear infinite;
}
@keyframes logoWave { to { background-position: 200% center; } }

.result-card {
    max-width: 560px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}
.result-card img {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-block);
}
.result-caption { color: var(--text-dim); font-size: 12px; text-align: center; }
.ai-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(139, 92, 246, .12);
    border: 1px solid rgba(139, 92, 246, .3);
    color: var(--accent-hover);
    letter-spacing: .3px;
}
.result-actions { display: flex; gap: 8px; }
.error-msg { color: var(--danger); }

.prompt-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    max-width: 760px;
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}
.prompt-bar:focus-within { border-color: var(--accent); }
#prompt-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    max-height: 160px;
    min-height: 22px;
    line-height: 1.5;
    overflow-y: auto;
}
#prompt-input::placeholder { color: var(--text-dim); }

/* подсказка ①②③ теперь висит над панелью ввода (низ экрана) */
.main > .onboard {
    width: 100%;
    max-width: 760px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.btn-send {
    background: var(--accent-deep);
    border: 1px solid var(--accent-deep);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.btn-send:hover { background: var(--accent); border-color: var(--accent); }
.btn-send:disabled { opacity: 0.6; }

/* ============================================
   МОДАЛКИ
   ============================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close {
    background: none; border: none;
    color: var(--text-dim); font-size: 16px; cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; min-height: 0; }

.profile-card { display: flex; gap: 16px; align-items: center; }
.profile-avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: bold; color: #fff;
}
.profile-name { font-size: 17px; font-weight: 600; }
.profile-email, .profile-date { color: var(--text-dim); font-size: 12px; }

.settings-block { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.settings-block label { font-size: 12px; color: var(--text-dim); }

.settings-block select,
.settings-block input[type="text"],
.settings-block input[type="password"],
.settings-block input[type="email"],
.settings-block input[type="number"],
.char-form input,
.char-form textarea,
.auth-form input {
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
.settings-block select:focus,
.settings-block input[type="text"]:focus,
.settings-block input[type="password"]:focus,
.settings-block input[type="email"]:focus,
.settings-block input[type="number"]:focus,
.char-form input:focus,
.char-form textarea:focus,
.auth-form input:focus { border-color: var(--accent); }

.char-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.char-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px;
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.15s;
}
.char-item:hover { border-color: var(--text-dim); }
.char-item.selected { border-color: var(--accent); }
.char-avatar { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; }
.char-avatar-placeholder {
    background: var(--bg-hover);
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
}
.char-info { flex: 1; overflow: hidden; }
.char-name { font-weight: 600; font-size: 13px; }
.char-desc {
    font-size: 12px; color: var(--text-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.char-del {
    background: none; border: none;
    color: var(--danger); cursor: pointer; font-size: 13px;
}
/* 🧠 Голова: описание волос/бороды/бровей с фото (ПРО). ReActor это не
   переносит — описание идёт в промпт. Кликабельно: клик открывает правку. */
.char-feat {
    font-size: 11px; color: var(--text-dim); margin-top: 2px;
    cursor: pointer; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 100%;
}
.char-feat:hover { color: var(--accent); }
.char-feat span { color: var(--text); }
.char-features-input {
    width: 100%; margin: 6px 0 2px; padding: 6px 8px; font-size: 12px;
    background: var(--bg-input, rgba(255,255,255,.05)); color: var(--text);
    border: 1px solid var(--border, rgba(255,255,255,.12)); border-radius: 8px;
}
.char-train {
    background: none; border: none;
    cursor: pointer; font-size: 14px; opacity: .8;
}
.char-train:disabled { opacity: .35; cursor: wait; }
.char-empty { color: var(--text-dim); text-align: center; padding: 10px; font-size: 13px; }
.char-form { display: flex; flex-direction: column; gap: 10px; }
.char-form textarea { min-height: 70px; resize: vertical; }

/* ============================================
   АВТОРИЗАЦИЯ
   ============================================ */
.auth-body { display: flex; align-items: center; justify-content: center; }
.auth-card {
    width: 90%;
    max-width: 380px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    text-align: center;
}
.auth-logo { font-size: 40px; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-dim); font-size: 12px; margin-bottom: 22px; }
.auth-version {
    margin-top: 18px;
    color: var(--text-dim);
    font-size: 11px;
    text-align: center;
    opacity: .8;
}
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}
.auth-tab {
    flex: 1;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: var(--text-dim);
    padding: 8px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: -1px;
    transition: 0.15s;
}
.auth-tab.active {
    background: var(--bg-panel);
    border-color: var(--border);
    color: var(--accent);
    font-weight: 600;
}
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-error { color: var(--danger); font-size: 12px; margin-top: 12px; min-height: 16px; }
.hidden { display: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============================================
   ДОП: глазки, капча, выход в настройках
   ============================================ */
.pass-wrap { position: relative; }
.pass-wrap input { width: 100%; padding-right: 38px; }
.eye-btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    font-size: 15px; opacity: 0.45; padding: 4px; line-height: 1;
}
.eye-btn:hover, .eye-btn.on { opacity: 1; }

/* 10.10.2026: стили пазл-капчи (.captcha-row) убраны — пазл убран из регистрации
   приказом владельца («у меня подтверждение личное есть»). */

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.settings-divider { border-top: 1px solid var(--border); margin: 16px 0; }

/* ============================================
   ЭТАП 2: панель параметров, вариации, история
   ============================================ */
.settings-panel {
    width: 660px; min-width: 660px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    padding: 14px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px;
}
.sp-title {
    font-size: 12px; text-transform: uppercase;
    color: var(--text-dim); letter-spacing: .5px;
}
.settings-panel .settings-block { margin-bottom: 0; }
.settings-panel select,
.settings-panel textarea,
.seed-row input {
    width: 100%;
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
.settings-panel textarea { resize: vertical; }
.settings-panel select:focus,
.settings-panel textarea:focus,
.seed-row input:focus { border-color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.seed-row { display: flex; gap: 6px; }

.result-grid { display: grid; grid-template-columns: 1fr; gap: 8px; width: 100%; }
.result-grid.multi { grid-template-columns: 1fr 1fr; }
.result-grid img {
    width: 100%; display: block;
    border-radius: 8px; border: 1px solid var(--border);
}

.history-thumb { position: relative; }
.thumb-del {
    position: absolute; top: 4px; right: 4px;
    width: 20px; height: 20px;
    border: none; border-radius: 4px;
    background: rgba(0,0,0,.75); color: var(--danger);
    cursor: pointer; font-size: 11px;
    display: none; align-items: center; justify-content: center;
}
.history-thumb:hover .thumb-del { display: flex; }
.thumb-star {
    position: absolute; top: 4px; left: 6px;
    color: #fbbf24; font-size: 12px; text-shadow: 0 0 4px #000;
}
.history-thumb.fav { border-color: #fbbf24; }


/* ============================================
   ЭТАП 3: комикс, галерея, мета-строка
   ============================================ */
.modal.wide { max-width: min(96vw, 1440px); }

.gallery-filters { display: flex; gap: 8px; margin-bottom: 12px; }
.gallery-filters select {
    flex: 1;
    background: var(--bg-block);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    outline: none;
}
.gallery-filters select:focus { border-color: var(--accent); }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 58vh;
    overflow-y: auto;
    padding-right: 4px;
}
.gallery-item {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    background: var(--bg-block);
}
.gallery-item:hover { border-color: var(--accent); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item span {
    position: absolute; bottom: 0; left: 0; right: 0;
    font-size: 9px; padding: 2px 5px;
    background: rgba(0,0,0,.75); color: var(--text-dim);
    white-space: nowrap; overflow: hidden;
}

.comic-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}
.comic-panel {
    position: relative;
    border: 3px solid #fff;
    border-radius: 4px;
    background: #000;
    overflow: hidden;
}
.comic-panel img { width: 100%; display: block; }
.bubble {
    position: absolute; top: 8px; left: 8px;
    max-width: 70%;
    background: #fff; color: #111;
    font-size: 11px; font-weight: 600;
    padding: 6px 10px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.bubble::after {
    content: "";
    position: absolute; bottom: -8px; left: 14px;
    border: 8px solid transparent;
    border-top-color: #fff; border-bottom: 0;
}

.result-meta { color: var(--text-dim); font-size: 11px; }
.admin-warn {
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
    margin-bottom: 10px;
}


/* ============================================
   ГАЛЕРЕЯ-FIX: квадратные плитки (без aspect-ratio)
   ============================================ */
.gallery-item {
    position: relative;
    height: 0;
    padding-bottom: 100%;   /* квадрат: высота = ширине */
    overflow: hidden;
}
.gallery-item img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-item span { z-index: 2; }


/* ============================================
   ЭТАП 5: галерея v2, лайтбокс, оценки, Comic Studio
   ============================================ */

/* слайдер размера в галерее */
.gallery-filters input[type="range"] {
    width: 110px;
    accent-color: var(--accent);
    align-self: center;
}

/* оценка на плитке */
.tile-rate {
    position: absolute; top: 4px; left: 6px;
    color: #fbbf24; font-size: 11px; font-weight: 700;
    text-shadow: 0 0 4px #000;
    z-index: 2;
}

/* лайтбокс */
.lightbox { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.lightbox img {
    max-width: 100%; max-height: 55vh;
    border-radius: 8px; border: 1px solid var(--border);
}
.lb-name { color: var(--text-dim); font-size: 11px; font-family: Consolas, monospace; }
.stars { display: flex; gap: 4px; align-items: center; }
.stars .star {
    background: none; border: none; cursor: pointer;
    font-size: 22px; color: var(--border);
    transition: 0.1s;
}
.stars .star.on { color: #fbbf24; }
.stars .star:hover { transform: scale(1.2); }
.lb-hint { color: var(--text-dim); font-size: 11px; margin-left: 8px; }

/* toast */
.toast {
    position: fixed; top: 20px; left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--accent); color: #fff;
    padding: 10px 18px; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    opacity: 0; transition: 0.25s;
    z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Comic Studio ---------- */
#comic-studio {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: 10px 0;
}
.comic-studio {
    width: 100%;
    max-width: 860px;
    display: flex; flex-direction: column; gap: 14px;
}

.page-canvas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.cs-empty {
    grid-column: 1/-1;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    padding: 40px;
    text-align: center;
    font-size: 13px;
}
.cs-panel {
    position: relative;
    border: 3px solid #fff;
    border-radius: 4px;
    background: #000;
    overflow: hidden;
}
.cs-panel img { width: 100%; display: block; }
.cs-bubble {
    position: absolute; top: 8px; left: 8px;
    max-width: 70%;
    background: #fff; color: #111;
    font-size: 11px; font-weight: 600;
    padding: 6px 10px;
    border-radius: 12px;
    outline: none;
    cursor: text;
}
.cs-bubble:focus { box-shadow: 0 0 0 2px var(--accent); }
.cs-caption {
    background: var(--bg-block);
    border-top: 2px solid #fff;
    padding: 6px 8px;
    font-size: 11px;
    color: var(--text-dim);
    outline: none;
    min-height: 30px;
    cursor: text;
}
.cs-caption:focus { color: var(--text); }
.cs-tools {
    position: absolute; top: 4px; right: 4px;
    display: none; gap: 4px;
}
.cs-panel:hover .cs-tools { display: flex; }
.cs-tools button {
    width: 26px; height: 26px;
    border: none; border-radius: 5px;
    background: rgba(0,0,0,.75);
    color: #fff; cursor: pointer;
    font-size: 13px;
}
.cs-tools button:hover { background: var(--accent); }


/* ============================================
   ЭТАП 6: фикс наслоения, сворачивание параметров,
   история комиксов
   ============================================ */

/* ID-селектор перебивал .hidden — теперь студия честно прячется */
#comic-studio.hidden { display: none; }

/* сворачивание правой панели */
.settings-panel { position: relative; transition: width .2s, min-width .2s; }
.sp-collapse {
    position: absolute; top: 10px; right: 10px;
    width: 22px; height: 22px;
    border: 1px solid var(--border); border-radius: 5px;
    background: var(--bg-block); color: var(--text-dim);
    cursor: pointer; font-size: 12px; line-height: 1;
    z-index: 2;
}
.sp-collapse:hover { color: var(--text); border-color: var(--accent); }
.settings-panel.collapsed { width: 42px; min-width: 42px; padding: 10px 8px; }
.settings-panel.collapsed > *:not(.sp-collapse) { display: none; }
.settings-panel.collapsed .sp-collapse {
    position: static;
    display: block;
    margin: 0 auto;
    transform: rotate(180deg);
}

/* бейдж комикса в истории */
.comic-flag {
    position: absolute; bottom: 2px; left: 5px;
    font-size: 10px; color: #fff;
    text-shadow: 0 0 3px #000;
    z-index: 2;
}


/* ============================================
   ЭТАП 7: мама-френдли интерфейс
   ============================================ */

/* экспертный режим выкл -> правая панель скрыта */
body:not(.expert) .settings-panel { display: none; }

/* дружелюбный старт */
.quick-start {
    display: flex; flex-direction: column;
    gap: 16px; align-items: center;
    max-width: 680px;
}
#quick-start.hidden { display: none; }

.onboard {
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    display: flex; gap: 12px; align-items: center;
}
.onboard button { margin-left: auto; flex-shrink: 0; }

.style-cards { display: flex; gap: 14px; }
.style-card {
    width: 160px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    cursor: pointer;
    position: relative;
    transition: 0.15s;
    background: var(--bg-block);
}
.style-card:hover { transform: translateY(-2px); border-color: var(--text-dim); }
.style-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.style-card img { width: 100%; height: 110px; object-fit: cover; display: block; }
.style-card span {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,.72);
    padding: 6px; text-align: center;
    font-size: 13px; font-weight: 600;
}

.example-chips {
    display: flex; flex-wrap: wrap;
    gap: 8px; justify-content: center;
}
.chip {
    border: 1px solid var(--border);
    background: var(--bg-block);
    color: var(--text-dim);
    border-radius: 16px;
    padding: 7px 13px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }

.gen-hint { color: var(--text-dim); font-size: 13px; min-height: 18px; }

.btn-dice { font-size: 16px; padding: 10px 14px; flex-shrink: 0; }


/* ============================================
   ЭТАП 8: онбординг в стиле логотипа + карточки режимов
   ============================================ */

/* подсказка под логотипом — тем же градиентом, мелко и со вкусом */
.onboard {
    background: none;
    border: none;
    padding: 0;
    display: flex; align-items: center; gap: 10px;
}
.onboard span {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .4px;
}
#onboard-close {
    margin: 0;
    background: none; border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 12px;
    opacity: .55;
    transition: .15s;
}
#onboard-close:hover { opacity: 1; color: var(--text); }

/* карточки режимов на старте */
.mode-cards {
    display: flex; gap: 14px;
    flex-wrap: wrap; justify-content: center;
}
.mode-card {
    width: 220px;
    padding: 18px 14px 14px;
    background: var(--bg-block);
    border: 2px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    text-align: center;
    transition: .15s;
    display: flex; flex-direction: column;
    gap: 4px; align-items: center;
    font-size: 26px;
}
.mode-card b { font-size: 15px; color: var(--text); }
.mode-card span { font-size: 11px; color: var(--text-dim); }
.mode-card:hover { transform: translateY(-2px); border-color: var(--text-dim); }
.mode-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}


/* ============================================
   ЭТАП 9: «в папке», права владельца, журнал всех
   ============================================ */
.thumb-btns {
    position: absolute; top: 4px; right: 4px;
    display: none; gap: 3px; z-index: 3;
}
.history-thumb:hover .thumb-btns { display: flex; }
.thumb-btns .thumb-del { position: static; }
.thumb-folder {
    width: 20px; height: 20px;
    border: none; border-radius: 4px;
    background: rgba(0,0,0,.75); color: #fff;
    cursor: pointer; font-size: 11px;
}
.thumb-folder:hover { background: var(--accent); }


/* ============================================
   ЭТАП 10: ✕ крупнее и выше, поле комикса внизу,
   свои фото
   ============================================ */

/* онбординг: крест в конце строки подсказки, не парит отдельно */
.onboard { position: relative; padding-right: 34px; }
#onboard-close {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: .8;
}

/* комикс: премиса прижата вниз, как промпт-бар */
.comic-studio { min-height: 100%; }
.studio-bottom { margin-top: auto; padding-top: 12px; }
.story-row { display: flex; gap: 6px; }
.ref-on { border-color: var(--accent); color: var(--text); }

/* мои фото */
.photos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.photo-slot {
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
}
.photo-title { font-weight: 700; font-size: 14px; }
.photo-desc { color: var(--text-dim); font-size: 11px; min-height: 30px; }
.photo-preview {
    height: 150px;
    border-radius: 8px;
    border: 1px dashed var(--border);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    color: var(--text-dim); font-size: 12px;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-btns { display: flex; gap: 8px; }
.photo-note {
    margin-top: 12px;
    color: var(--text-dim); font-size: 12px;
    border-left: 3px solid var(--accent);
    padding-left: 10px;
}
.char-avatar-row { display: flex; gap: 8px; align-items: center; }


/* ============================================
   ЭТАП 11: единый стиль подсказок-направлений
   ============================================ */
.hint-line {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .4px;
    text-align: center;
}
.cs-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 34px 20px;
}
.cs-edithint { text-align: center; margin-top: -4px; }
/* Пустое состояние панели «Кадры»: аккуратная карточка с подсказкой и кнопкой
   (раньше была одна серая строка «Кадров на странице нет») */
.cs-empty-frames {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; gap: 2px;
    padding: 16px 12px;
    border: 1px dashed var(--border, rgba(255,255,255,.14));
    border-radius: 12px;
    background: rgba(255,255,255,.03);
}


/* ============================================
   ЭТАП 12: СОЧНОСТЬ — анимации, пружины, свет
   ============================================ */

/* въезд панелей при загрузке */
.sidebar { animation: slideRight .5s ease both; }
.settings-panel { animation: slideLeft .5s ease both; }
.main { animation: fadeUp .6s ease both; position: relative; }
@keyframes slideRight { from { transform: translateX(-16px); opacity: 0; } }
@keyframes slideLeft  { from { transform: translateX(16px);  opacity: 0; } }
@keyframes fadeUp     { from { transform: translateY(10px);  opacity: 0; } }

/* амбиент-свечение за логотипом */
.main::before {
    content: "";
    position: absolute; inset: 0;
    background:
        radial-gradient(620px 300px at 50% 18%, rgba(249,115,22,.07), transparent 70%),
        radial-gradient(520px 260px at 82% 82%, rgba(0,212,255,.05), transparent 70%);
    pointer-events: none;
    animation: ambient 9s ease-in-out infinite alternate;
}
@keyframes ambient { to { transform: translateY(14px) scale(1.05); opacity: .75; } }

/* логотип дышит */
.logo { animation: logoIdle 4s ease-in-out infinite; }
@keyframes logoIdle {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(249,115,22,.25)); }
    50%      { filter: drop-shadow(0 0 18px rgba(249,115,22,.55)); }
}
.logo.loading {
    animation: logoWave 1.2s linear infinite,
               logoIdle 1.2s ease-in-out infinite;
}

/* кнопки: подъём и нажатие */
.btn { transition: transform .12s ease, box-shadow .2s ease,
                 background .15s, border-color .15s; }
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn-primary:hover { box-shadow: 0 4px 18px rgba(249,115,22,.35); }

/* Generate: бегущий блик */
.btn-send { position: relative; overflow: hidden; }
.btn-send::after {
    content: "";
    position: absolute; top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(105deg, transparent,
                rgba(255,255,255,.45), transparent);
    transform: skewX(-20deg);
    animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine {
    0%, 60% { left: -60%; }
    100%    { left: 130%; }
}

/* промпт-бар: пульс при фокусе */
.prompt-bar:focus-within {
    box-shadow: 0 0 0 3px rgba(249,115,22,.15),
                0 0 24px rgba(249,115,22,.12);
}

/* каскад и зум миниатюр */
.history-thumb { animation: popIn .35s ease both; }
.history-thumb img { transition: transform .25s ease; }
.history-thumb:hover img { transform: scale(1.12); }
@keyframes popIn { from { transform: scale(.85); opacity: 0; } }

.gallery-item { animation: popIn .3s ease both; }
.gallery-item img { transition: transform .3s ease, filter .3s ease; }
.gallery-item:hover img { transform: scale(1.08); filter: saturate(1.15); }

/* чипсы */
.chip { animation: popIn .3s ease both; transition: transform .12s ease,
        box-shadow .2s ease, border-color .15s, color .15s; }
.chip:hover { transform: translateY(-1px);
              box-shadow: 0 2px 10px rgba(249,115,22,.2); }

/* карточки режимов: подъём и пульс активной */
.mode-card { transition: transform .18s ease, box-shadow .25s ease,
             border-color .2s; }
.mode-card:hover { transform: translateY(-3px);
                   box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.mode-card.active { animation: cardPulse 2.4s ease-in-out infinite; }
@keyframes cardPulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--accent),
               0 0 12px rgba(249,115,22,.25); }
    50%      { box-shadow: 0 0 0 2px var(--accent),
               0 0 26px rgba(249,115,22,.5); }
}

/* результат: масштаб + расфокус */
.result-card.appear {
    animation: resultIn .5s cubic-bezier(.2,.9,.3,1.2) both;
}
@keyframes resultIn {
    from { transform: scale(.92) translateY(14px);
           opacity: 0; filter: blur(6px); }
    to   { transform: none; opacity: 1; filter: blur(0); }
}

/* комикс: панели и облачка с пружиной */
.cs-panel { animation: popIn .4s ease both;
            transition: transform .15s ease, box-shadow .2s ease; }
.cs-panel:hover { transform: translateY(-2px);
                  box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.cs-bubble { animation: bubbleIn .35s cubic-bezier(.2,.9,.3,1.4) both; }
@keyframes bubbleIn { from { transform: scale(.5); opacity: 0; } }

/* модалки: пружина + blur-подложка */
.modal-overlay { backdrop-filter: blur(3px); }
.modal { animation: modalIn .28s cubic-bezier(.2,.9,.3,1.25) both; }
@keyframes modalIn {
    from { transform: scale(.92) translateY(10px); opacity: 0; }
}

/* иконки меню подёргиваются при ховере */
.menu-item span:first-child { transition: transform .15s ease; }
.menu-item:hover span:first-child { transform: translateX(2px) scale(1.15); }

/* уважение к prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}


/* ============================================
   ЭТАП 13: конфетти, ачивки, справка
   ============================================ */
.confetti {
    position: fixed; top: -14px;
    width: 8px; height: 13px;
    border-radius: 2px;
    z-index: 150;
    pointer-events: none;
    animation: confettiFall linear forwards;
}
@keyframes confettiFall {
    to { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

.ach-title { margin: 16px 0 8px; font-weight: 700; font-size: 13px; }
.ach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}
.ach-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 6px;
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: 10px;
    opacity: .4; filter: grayscale(1);
    transition: .2s;
}
.ach-item.on {
    opacity: 1; filter: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(249,115,22,.25);
}
.ach-icon { font-size: 22px; }
.ach-name { font-size: 10px; text-align: center; color: var(--text-dim); }

/* 10.10.2026: личные достижения (их выдаёт владелец) — золотая рамка, чтобы
   отличались от автоматических. Не выданные висят приглушёнными как цель. */
.ach-item.manual.on {
    border-color: #fbbf24;
    box-shadow: 0 0 12px rgba(251,191,36,.35);
}
.ach-item.manual.on .ach-name { color: #fbbf24; }
.ach-item.manual:not(.on) { opacity: .3; }

.check-row {
    display: flex; gap: 8px; align-items: center;
    font-size: 13px; color: var(--text);
}
.check-row input { accent-color: var(--accent); }

.help-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.help-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.help-table td:first-child {
    font-family: Consolas, monospace;
    color: var(--accent);
    white-space: nowrap;
}


/* ============================================
   ЭТАП 14: тематические блоки, мультивыбор
   ============================================ */
.menu-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-dim);
    margin: 10px 6px 2px;
}
.char-hint { display: block; margin-bottom: 12px; }
.char-check {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    color: var(--success);
    border: 1px solid var(--success);
    border-radius: 10px;
    padding: 1px 7px;
    vertical-align: middle;
}
.char-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.char-form-grid input,
.char-form-grid select {
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 12px;
    outline: none;
}
.char-form-grid input:focus,
.char-form-grid select:focus { border-color: var(--accent); }
.char-note {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-dim);
    border-left: 3px solid var(--accent);
    padding-left: 8px;
}


/* ============================================
   ЭТАП 15: ховер-подсветка, рамки разделов,
   библиотеки фото, лицо на персонажа
   ============================================ */

/* пункты меню: подсветка и акцент при наведении */
.menu-item:hover {
    background: var(--bg-hover);
    box-shadow: inset 3px 0 0 var(--accent);
}

/* разделы — не просто текст, а тематические чипы */
.menu-section {
    margin: 12px 4px 4px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-block);
}

/* библиотеки фото */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.photo-card {
    position: relative;
    border: 2px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-block);
    cursor: pointer;
}
.photo-card img { width: 100%; height: 110px; object-fit: cover; display: block; }
.photo-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.photo-card-btns {
    position: absolute; left: 4px; right: 4px; bottom: 4px;
    display: flex; gap: 4px;
    opacity: 0; transition: .15s;
}
.photo-card:hover .photo-card-btns { opacity: 1; }
.photo-add {
    display: flex; align-items: center; justify-content: center;
    min-height: 112px;
    border-style: dashed;
    color: var(--text-dim); font-size: 13px;
}
.photo-add:hover { color: var(--text); border-color: var(--accent); }

/* хаб «Мои фото» */
.hub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hub-btn {
    display: flex; flex-direction: column; gap: 4px; align-items: center;
    padding: 18px 10px;
    background: var(--bg-block);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    font-size: 26px;
    transition: .15s;
}
.hub-btn b { font-size: 14px; }
.hub-btn span { font-size: 11px; color: var(--text-dim); }
.hub-btn:hover { transform: translateY(-2px); border-color: var(--text-dim); }

/* кнопка лица на карточке персонажа */
.char-face {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-block);
    cursor: pointer;
    overflow: hidden;
    font-size: 13px; color: var(--text-dim);
    flex-shrink: 0; padding: 0;
}
.char-face img { width: 100%; height: 100%; object-fit: cover; }
.char-face:hover { border-color: var(--accent); }


/* ============================================
   ЭТАП 16: ПРО-блок + нодовый конструктор
   ============================================ */

/* про-блок только в экспертном режиме */
body:not(.expert) .pro-block { display: none; }
.pro-block { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px;
             align-items: start; gap: 12px;
             border-top: 1px solid var(--border); padding-top: 12px; }
/* в широкой панели заголовки, железо и предупреждения — на всю ширину */
.pro-block .sp-title, .pro-block .sp-hw, .pro-block #sp-warnings,
.pro-block .sp-tips { grid-column: 1 / -1; }
.pro-block .sp-warn { margin-top: 0; }

/* ---------- выбор позы ---------- */
.pose-pick { display: flex; align-items: center; gap: 8px; }
.pose-pick .btn { flex-shrink: 0; }
.sp-pose-sel { font-size: 12px; color: var(--text-dim); overflow: hidden;
               text-overflow: ellipsis; white-space: nowrap; }
.sp-pose-sel b { color: var(--text); }
.sp-pose-clear { cursor: pointer; color: var(--text-dim); margin-left: 6px; }
.sp-pose-clear:hover { color: #f87171; }
.pose-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.pose-bar select, .pose-bar input {
    background: var(--bg-block); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); padding: 8px 10px; font-size: 13px;
}
.pose-bar select { max-width: 55%; }
.pose-bar input { flex: 1; }
.pose-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 8px; max-height: 62vh; overflow-y: auto; padding: 2px;
}
.pose-item { cursor: pointer; border: 2px solid transparent; border-radius: 8px;
             padding: 4px; background: var(--bg-block); text-align: center; }
.pose-item:hover { border-color: var(--accent); }
.pose-item.selected { border-color: var(--accent); background: var(--accent)22; }
.pose-item img { width: 100%; aspect-ratio: 3/4; object-fit: contain;
                 background: #0d0d0f; border-radius: 5px; display: block; }
.pose-item span { display: block; font-size: 10px; color: var(--text-dim);
                  margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pose-more { text-align: center; margin-top: 10px; }
.sp-warn {
    color: #f59e0b; font-size: 11px;
    border: 1px solid #f59e0b55; border-radius: 6px;
    padding: 6px 8px; margin-top: 6px;
    background: #f59e0b11;
}

/* ---------- конструктор ---------- */
#node-editor { flex: 1; width: 100%; overflow: hidden; display: flex; }
#node-editor.hidden { display: none; }
.nodes-wrap { display: flex; gap: 12px; width: 100%; height: 100%; }
.nodes-palette {
    /* 09.10.2026 (приказ владельца): панель чуть шире + место под ползунок,
       иначе вертикальный скроллбар налезал на карточки модулей */
    width: 200px; min-width: 200px;
    padding-right: 6px;
    scrollbar-gutter: stable;
    display: flex; flex-direction: column; gap: 6px;
    overflow-y: auto;
    /* 09.10.2026: последняя карточка упиралась в нижний край и выглядела
       обрезанной — добавляем зазор под списком */
    padding-bottom: 10px;
}
/* тонкий аккуратный ползунок, чтобы не перекрывал содержимое */
.nodes-palette::-webkit-scrollbar { width: 8px; }
.nodes-palette::-webkit-scrollbar-track { background: transparent; }
.nodes-palette::-webkit-scrollbar-thumb {
    background: var(--border); border-radius: 6px;
}
.nodes-palette::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.pal-item {
    text-align: left;
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: .15s;
}
.pal-item:hover { border-color: var(--accent); transform: translateX(2px); }
.nodes-hint { margin-top: 8px; }

.nodes-canvas {
    flex: 1;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background:
        radial-gradient(circle, #1c2431 1px, transparent 1px) 0 0 / 22px 22px,
        var(--bg);
}
#nodes-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#nodes-svg path {
    pointer-events: stroke;
    stroke: var(--accent); stroke-width: 2; fill: none;
    cursor: pointer;
}
#nodes-svg path:hover { stroke: #fbbf24; stroke-width: 3; }
#nodes-svg path.temp { stroke-dasharray: 6 4; opacity: .7; pointer-events: none; }

.node {
    position: absolute;
    width: 175px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
    animation: popIn .25s ease both;
}
.node-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    cursor: grab;
    font-size: 12px; font-weight: 600;
}
.node-head:active { cursor: grabbing; }
.node-del { background: none; border: none; color: var(--danger); cursor: pointer; }
.node-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
/* 09.10.2026 (приказ владельца): наполнение модуля меняется ПРЯМО в узле —
   у каждого поля появился ярлык, чтобы было видно, что именно правишь. */
.node-body .nd-l {
    display: block; font-size: 9.5px; line-height: 1.3;
    color: var(--text-dim); text-transform: uppercase;
    letter-spacing: .4px; margin-bottom: 2px;
}
.node-body .nd-note { font-size: 10.5px; color: var(--text-dim); line-height: 1.35; }
.node-body select, .node-body input {
    width: 100%;
    background: var(--bg-block);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 5px;
    font-size: 11px;
    outline: none;
}
.port {
    position: absolute;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #ffffff33;
    top: 50%; transform: translateY(-50%);
    cursor: crosshair;
    transition: .15s;
}
.port:hover { transform: translateY(-50%) scale(1.4); background: #fbbf24; }
.port.in  { left: -7px; }
.port.out { right: -7px; }

/* схемы в истории */
.scheme-thumb { display: flex; flex-direction: column;
                align-items: center; justify-content: center; gap: 4px; }
.scheme-icon { font-size: 26px; }
.scheme-name { font-size: 10px; color: var(--text-dim); }


/* ============================================
   ЭТАП 17: адаптивные панели, иконки, ПРО-комикс
   ============================================ */

/* ширины: база шире, комикс чуть уже, доска — значки */
.sidebar { width: 280px; min-width: 280px;
           transition: width .25s ease, min-width .25s ease; }
.settings-panel { width: 300px; min-width: 300px;
                  transition: width .25s ease, min-width .25s ease; }

/* единый тумблер сворачивания (работает во всех режимах) */
.sidebar.collapsed { width: 64px; min-width: 64px; padding: 12px 6px; }
.sidebar.collapsed .bt,
.sidebar.collapsed .history-wrap,
.sidebar.collapsed .menu-section { display: none; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed #btn-new-action { font-size: 16px; padding: 10px 0; }
.sidebar.collapsed #btn-new-action .bt { display: none; }

/* 09.10.2026 (приказ владельца): в свёрнутом рейле было ДВЕ рамки —
   рамка плитки (.menu-item) и рамка иконки внутри (span:first-child).
   Оставляем одну: иконка внутри плитки больше своей рамки не рисует. */
.sidebar.collapsed .menu-item > span:first-child {
    border: none; background: transparent;
    width: auto; height: auto; border-radius: 0;
}
/* 09.10.2026: в свёрнутом рейле текст очереди и подпись правообладателя
   вылезали вправо, поверх панели модулей. Оставляем только иконку очереди. */
.sidebar.collapsed .queue-box {
    width: 44px; height: 44px; padding: 0;
    margin: 0 auto; justify-content: center; overflow: hidden;
}
.sidebar.collapsed .queue-box .queue-text { display: none; }
.sidebar.collapsed #owner-mark { display: none; }

/* мобилки — только значки */
@media (max-width: 900px) {
    .sidebar { width: 64px !important; min-width: 64px !important; }
    .sidebar .bt, .sidebar .history-wrap,
    .sidebar .menu-section { display: none; }
    .sidebar .menu-item { justify-content: center; }
    .settings-panel { display: none; }
}

/* разделения в палитре конструктора */
.pal-sep {
    font-size: 10px; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: .5px;
    margin: 8px 0 2px;
    border-top: 1px solid var(--border);
    padding-top: 6px;
}

/* ПРО-комикс */
.pro-comic select {
    background: var(--bg-block);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    outline: none;
}
.page-canvas.lay-strip { grid-template-columns: 1fr; }
.page-canvas.lay-3x3 { grid-template-columns: repeat(3, 1fr); }
.page-canvas.lay-4x4 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.page-canvas.lay-4x4 .cs-bubble { font-size: 10px; padding: 2px 5px; }
.page-canvas.lay-wide .cs-panel:first-child { grid-column: 1 / -1; }
.bs-thought .bubble, .bs-thought .cs-bubble { font-style: italic; border: 2px dashed #111; background: #ffffffee; }
.bs-shout .bubble, .bs-shout .cs-bubble { text-transform: uppercase; font-weight: 800; letter-spacing: .5px; }
.cs-cam {
    position: absolute; bottom: 40px; right: 6px;
    background: rgba(0,0,0,.7); color: #fff;
    font-size: 10px; border-radius: 8px; padding: 2px 6px;
    z-index: 2;
}

/* баннер просмотра авторизации */
.preview-banner {
    position: fixed; top: 0; left: 0; right: 0;
    background: var(--accent); color: #fff;
    text-align: center; padding: 6px;
    font-size: 12px; z-index: 99;
}


/* ============================================
   ЭТАП 19: конструктор v2
   ============================================ */

/* иконки сайдбара — крупные, в рамках-кнопках */
.sidebar.collapsed #btn-new-action {
    width: 44px; height: 44px;
    margin: 0 auto; padding: 0;
    border-radius: 12px; font-size: 18px;
}
.sidebar.collapsed .menu-item {
    width: 44px; height: 44px;
    margin: 0 auto 8px; padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-block);
    justify-content: center;
}
.sidebar.collapsed .menu-item span:first-child { font-size: 20px; }
.sidebar.collapsed .menu-item:hover {
    border-color: var(--accent);
    box-shadow: none;
}

/* палитра: крупнее, иконки в отдельные ячейки */
.pal-item {
    display: flex; align-items: center; gap: 9px;
    font-size: 13px; padding: 10px 12px;
}
.pal-item .pi { font-size: 16px; width: 20px; text-align: center; }
.pal-sep { color: var(--accent); font-weight: 700; }
.nodes-palette .btn { font-size: 12px; padding: 8px 10px; align-self: center; width: calc(100% - 20px); }
.nodes-hint .hint-line { font-size: 12px; }

/* подсказка на пустом холсте */
.nodes-empty {
    position: absolute; inset: 0; z-index: 3;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; text-align: center; pointer-events: none;
    color: var(--text-dim); font-size: 13px; line-height: 1.7;
}
.nodes-empty .ne-title { font-size: 18px; font-weight: 700; color: var(--text); }
.nodes-empty.hidden { display: none; }

/* линии ПОД блоками, мир поверх svg */
#nodes-svg { z-index: 1; }
#nodes-world {
    position: absolute; inset: 0;
    z-index: 2;
    transform-origin: 0 0;
}

/* зум-бар как в ComfyUI */
.zoom-bar {
    position: absolute; right: 12px; bottom: 12px; z-index: 5;
    display: flex; gap: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
}
.zoom-bar button {
    width: 30px; height: 30px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-block); color: var(--text);
    cursor: pointer; font-size: 14px;
}
.zoom-bar button:hover { border-color: var(--accent); }
#zoom-reset { width: auto; padding: 0 10px; font-size: 11px; }

/* плавающий переключатель режимов */
#node-editor { position: relative; }
.mode-float {
    position: absolute; top: 10px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 4px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    z-index: 6;
}
.mf-btn {
    border: none; background: transparent;
    color: var(--text-dim);
    padding: 8px 16px; border-radius: 9px;
    cursor: pointer;
    font-size: 13px; font-weight: 600;
}
.mf-btn:hover { color: var(--text); }
.mf-btn.active { background: var(--accent); color: #fff; }
/* ПРО-режим: состояние видно на самой кнопке (раньше вкл/выкл ничем не
   отличались — особенно на мобиле, где панель видна в обоих режимах). */
#btn-expert.on {
    background: var(--accent); color: #fff;
    box-shadow: 0 0 0 1px var(--accent) inset;
}


/* ============================================
   ЭТАП 20: темы, иконки-рамки, карточки студии,
   миникарта, стрелки, радио, профиль
   ============================================ */

/* ---------- темы ---------- */
body[data-theme="light"] {
    --bg:#f2f2f3; --bg-panel:#ffffff; --bg-block:#ececee; --bg-hover:#e0e0e4;
    --border:#d0d0d6; --text:#17171a; --text-dim:#6b6b74;
    --accent:#10a37f; --accent-hover:#0c8567;
}
body[data-theme="qwen"] {
    --bg:#14101d; --bg-panel:#1b1626; --bg-block:#241d33; --bg-hover:#2e2540;
    --border:#3a2f52; --text:#ece9f4; --text-dim:#9a93ab;
    --accent:#7c5cff; --accent-hover:#9075ff;
}
body[data-theme="deepseek"] {
    --bg:#0b1220; --bg-panel:#101a2c; --bg-block:#16233a; --bg-hover:#1c2c47;
    --border:#24344f; --text:#e6edf7; --text-dim:#8fa2bd;
    --accent:#4d6bfe; --accent-hover:#6b84ff;
}
body[data-theme="grok"] {
    --bg:#0c0c0e; --bg-panel:#141417; --bg-block:#1d1d22; --bg-hover:#26262c;
    --border:#333339; --text:#f2f2f4; --text-dim:#9d9da6;
    --accent:#e11d48; --accent-hover:#f43f5e;
}
body[data-theme="beige"] {
    --bg:#efe9df; --bg-panel:#faf6ee; --bg-block:#e7dfd2; --bg-hover:#ddd3c2;
    --border:#cfc4b0; --text:#37322a; --text-dim:#7d7466;
    --accent:#b45309; --accent-hover:#92400e;
}

/* ---------- иконки-рамки в сайдбаре (все режимы) ---------- */
.menu-item > span:first-child {
    width: 34px; height: 34px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-block);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: .15s;
}
.menu-item:hover > span:first-child { border-color: var(--accent); }

/* ---------- карточки студии комикса ---------- */
.studio-top { display: flex; flex-wrap: wrap; gap: 10px; }
.st-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex; flex-direction: column; gap: 8px;
}
.st-card.st-ideas { flex: 1; min-width: 260px; }
.st-label {
    font-size: 10px; text-transform: uppercase;
    letter-spacing: .6px; color: var(--text-dim);
    display: flex; align-items: center; gap: 6px;
}
.st-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.st-row input[type="text"] {
    background: var(--bg-block); border: 1px solid var(--border);
    color: var(--text); border-radius: 8px; padding: 8px 10px;
    font-size: 13px; font-weight: 600; outline: none; min-width: 150px;
}
.st-row select {
    background: var(--bg-block); border: 1px solid var(--border);
    color: var(--text); border-radius: 8px; padding: 8px; font-size: 12px; outline: none;
}
.story-row { display: flex; gap: 6px; }
.story-row .btn { flex: 1; }

/* ---------- PRO ---------- */
.pro-chip {
    background: var(--accent); color: #fff;
    font-size: 9px; font-weight: 800;
    border-radius: 6px; padding: 2px 6px;
    letter-spacing: .5px;
}
.pro-hint { font-size: 10px; color: var(--text-dim); }
.pal-top { display: flex; justify-content: space-between; align-items: center; }

/* ---------- drag ghost ---------- */
.drag-ghost {
    position: fixed; z-index: 400;
    pointer-events: none;
    background: var(--bg-panel);
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px; color: var(--text);
    opacity: .92;
    box-shadow: 0 6px 18px rgba(0,0,0,.4);
}

/* ---------- стрелки на дугах ---------- */
#nodes-svg .arr-head { fill: var(--accent); }

/* ---------- миникарта и статус ---------- */
.minimap {
    position: absolute; left: 12px; bottom: 12px; z-index: 5;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
}
.minimap canvas { display: block; border-radius: 6px; cursor: pointer; }
.nodes-status {
    position: absolute; bottom: 14px; left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 10px; color: var(--text-dim);
}

/* ---------- радио ---------- */
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 10px 12px;
    cursor: pointer; font-size: 13px;
    transition: .15s;
}
.radio-item:hover { border-color: var(--accent); }
.radio-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.radio-ctrl { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.radio-ctrl input[type="range"] { flex: 1; accent-color: var(--accent); }

/* ---------- профиль ---------- */
/* 10.10.2026 (просьба владельца: «профиль сделать меньше»): уменьшены отступы,
   аватар, блоки пополнения и Telegram встали в две колонки, поля пароля — в ряд */
.profile-hero { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.profile-avatar-big {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 800; color: #fff;
    box-shadow: 0 0 0 3px var(--bg-panel), 0 0 0 4px var(--accent);
    flex: none;
}
/* две колонки: поддержка проекта слева, Telegram справа */
.pf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 720px) { .pf-cols { grid-template-columns: 1fr; } }
/* три поля пароля в один ряд вместо трёх этажей */
.pf-pass-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pf-pass-row .settings-block { margin-bottom: 0; }
@media (max-width: 720px) { .pf-pass-row { grid-template-columns: 1fr; } }
.pf-support { font-size: .78em; opacity: .8; margin-top: 6px; line-height: 1.45; }
.stats-grid {
    display: grid;
    /* 10.10.2026: карточек стало 4 (комиксы убраны) — auto-fit растягивает их
       ровно по ширине, без пустой дырки от пятой колонки */
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 6px; margin-bottom: 10px;
}
.stat-card {
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 4px;
    text-align: center;
    display: flex; flex-direction: column; gap: 1px;
}
.stat-card b { font-size: 15px; color: var(--accent); }
.stat-card span { font-size: 9.5px; color: var(--text-dim); }
.profile-actions { margin-top: 12px; display: flex; gap: 8px; }
.profile-version {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    color: var(--text-dim);
    font-size: 11px;
    text-align: center;
}


/* ============================================
   ЭТАП 21: глобальный переключатель, цвета групп,
   тултипы иконок
   ============================================ */

/* переключатель: fixed, над всем, таскается за ⠿ */
.mode-float {
    position: fixed;
    top: 12px; left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex; gap: 4px; align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 6px 24px rgba(0,0,0,.45);
}
.mf-grip {
    cursor: move;
    color: var(--text-dim);
    padding: 0 6px;
    user-select: none;
    font-size: 14px;
}
.mf-grip:hover { color: var(--accent); }

/* тултипы у иконок, когда текст скрыт */
.menu-item { position: relative; }

/* 09.10.2026 (приказ владельца): свёрнутое поле слева — НАД рабочей зоной.
   Раньше подсказки иконок («Настройки», «Музыка»…) обрезались панелью модулей
   конструктора: сайдбар и .main были в одном слое, и панель рисовалась поверх.
   z-index > 0 создаёт свой слой у сайдбара, и его подсказки видны целиком. */
@media (min-width: 901px) {
    .sidebar { z-index: 300; }
}
body[data-mode="nodes"] .menu-item::after {
    content: attr(data-tip);
    position: absolute;
    left: 54px; top: 50%;
    transform: translateY(-50%) translateX(-6px);
    background: var(--bg-panel);
    border: 1px solid var(--accent);
    color: var(--text);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: .15s;
    /* 09.10.2026: подсказка должна быть выше панели модулей конструктора */
    z-index: 1000;
}
body[data-mode="nodes"] .menu-item:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
@media (max-width: 900px) {
    .menu-item::after {
        content: attr(data-tip);
        position: absolute;
        left: 54px; top: 50%;
        transform: translateY(-50%) translateX(-6px);
        background: var(--bg-panel);
        border: 1px solid var(--accent);
        color: var(--text);
        border-radius: 8px;
        padding: 6px 10px;
        font-size: 12px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: .15s;
        /* 09.10.2026: та же причина — подсказка выше панели модулей */
        z-index: 1000;
    }
    .menu-item:hover::after {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}


/* ============================================
   ЭТАП 22: просторные модалки, сценарии, баннер
   ============================================ */

/* персонажи: сетка карточек */
.char-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.char-item {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 8px;
}
.char-item .char-avatar {
    /* ПРАВКА 10.09.2026 («у персонажа нет имени»): было width:100% — аватар
       занимал всю строку, из-за чего .char-info (flex:1 + overflow:hidden)
       получал НУЛЕВУЮ ширину и имя с описанием физически пропадали из вида.
       Теперь аватар 72×72, а блоку с именем гарантирован минимум ширины. */
    width: 72px; height: 72px;
    flex: 0 0 72px;
    border-radius: 8px;
    font-size: 24px;
}
.char-item .char-info {
    flex: 1 1 150px;
    min-width: 130px;
}
/* Описание в карточке персонажа — в две строки, а не одной обрезанной:
   раньше строка резалась многоточием («мужчина, 30, ро…») */
.char-item .char-desc {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.3;
}
/* Карточка — колонка; блок портретов идёт строкой НИЖЕ и не вылезает за рамку.
   Раньше на .char-item висел inline flex-wrap:wrap, и при flex-direction:column
   портреты «уезжали» во вторую колонку, перекрывая правый бордер карточки. */
.char-item { overflow: hidden; }
.char-item .char-portraits { flex-basis: 100%; min-width: 0; }
.char-actions {
    display: flex; gap: 6px;
    justify-content: flex-end;
    align-items: center;
}
.char-form-card {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: var(--bg-block);
    display: flex; flex-direction: column; gap: 10px;
}

/* мои фото: две колонки */
.photos-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.photo-col {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--bg-block);
    display: flex; flex-direction: column; gap: 10px;
}
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}
.photo-cell {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
    cursor: pointer;
}
.photo-cell img { width: 100%; height: 80px; object-fit: cover; display: block; }
.photo-cell.active { border-color: var(--accent); }
.photo-cell .pc-del {
    position: absolute; top: 2px; right: 2px;
    width: 18px; height: 18px;
    border: none; border-radius: 4px;
    background: rgba(0,0,0,.75); color: var(--danger);
    cursor: pointer; font-size: 10px;
    display: none;
}
.photo-cell:hover .pc-del { display: block; }
.photo-add {
    display: flex; align-items: center; justify-content: center;
    min-height: 80px;
    border-style: dashed;
    color: var(--text-dim); font-size: 18px;
}
.photo-add:hover { color: var(--text); border-color: var(--accent); }

/* сценарии */
.scen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.scen-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-block);
    padding: 12px;
    cursor: pointer;
    display: flex; flex-direction: column; gap: 6px;
    transition: .15s;
}
.scen-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.scen-icon { font-size: 26px; }
.scen-title { font-weight: 700; font-size: 13px; }
.scen-desc { font-size: 11px; color: var(--text-dim); }
.scen-type { font-size: 10px; color: var(--accent); }

/* баннер имперсонации */
.imp-banner {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 950;
    background: var(--accent); color: #fff;
    display: flex; gap: 10px;
    align-items: center; justify-content: center;
    padding: 6px; font-size: 12px;
}
.imp-banner button {
    background: #fff; color: #111;
    border: none; border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer; font-size: 12px;
}


/* ============================================
   ЭТАП 24: параметры модулей в палитре
   ============================================ */
.pal-wrap { display: flex; flex-direction: column; gap: 4px; }
.pal-item { display: flex; align-items: center; gap: 8px; }
.pal-item .pal-name { flex: 1; }
.pal-cfg { cursor: pointer; opacity: .55; font-size: 13px; }
.pal-cfg:hover { opacity: 1; }
.pal-form {
    display: flex; flex-direction: column; gap: 6px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 8px;
    background: var(--bg-block);
}
.pal-form.hidden { display: none; }
.pal-l {
    display: flex; flex-direction: column; gap: 3px;
    font-size: 10px; color: var(--text-dim);
}
.pal-l select, .pal-l input {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 11px;
    outline: none;
}
.sec-add-row { display: flex; gap: 8px; margin: 8px 0; }
.sec-add-row input { flex: 1; background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; padding: 6px 10px; color: var(--text); font-size: 13px; }
.word-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px;
    border-bottom: 1px solid var(--border); font-size: 13px; }
.word-row:hover { background: var(--bg-hover); }
.word-w { font-family: Consolas, monospace; flex: 1; word-break: break-all; }
.word-c { font-size: 11px; color: var(--text-dim); padding: 1px 8px;
    border-radius: 10px; background: rgba(249,115,22,.15); white-space: nowrap; }
.word-row .pc-del { color: var(--danger); cursor: pointer; font-weight: bold; }

/* ============ Админка: расширенная «Защита» ============ */
.sec-add-row select { background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); padding: 6px 8px; font-size: 13px; }
.category-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.sec-note { font-size: 12px; color: var(--text-dim); margin-top: 8px; line-height: 1.5; }
.result-box { padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-top: 10px; line-height: 1.6; }
.result-box.blocked { background: rgba(248,81,73,.12); border: 1px solid var(--danger); }
.result-box.allowed { background: rgba(63,185,80,.12); border: 1px solid #3fb950; }

/* ============ Админка: статистика защиты + широкая сетка ============ */
.sec-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.sec-stat { background: var(--bg-block); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px; text-align: center; }
.sec-stat .value { font-size: 26px; font-weight: 700; color: var(--accent); }
.sec-stat.danger .value { color: var(--danger); }
.sec-stat.success .value { color: #3fb950; }
.sec-stat.warning .value { color: #fbbf24; }
.sec-stat .label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
@media (max-width: 1100px) { .sec-cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .sec-cols, .sec-stats { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { #sec-control { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { #sec-control { grid-template-columns: 1fr; } }
.ctl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.ctl-name { font-size: 12px; color: var(--text); line-height: 1.35; }
.ctl-btn { border: none; border-radius: 10px; padding: 2px 10px; font-size: 11px;
    font-weight: 700; cursor: pointer; white-space: nowrap; }
.ctl-btn.on { background: rgba(63,185,80,.2); color: #3fb950; }
.ctl-btn.off { background: rgba(248,81,73,.2); color: var(--danger); }
.ctl-state { font-size: 12px; font-weight: 700; white-space: nowrap; }
.ctl-state.on { color: #3fb950; }
.ctl-state.off { color: var(--danger); }

/* ============ Админка: назначение ролей ============ */
.role-sel { background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text); padding: 5px 8px; font-size: 12px; }
.badge { font-size: 12px; padding: 2px 10px; border-radius: 10px;
    background: rgba(249,115,22,.15); color: var(--accent); white-space: nowrap; }

/* ============ Админка: субагенты ============ */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
#agents-log { max-height: 260px; overflow-y: auto; }

/* ============ Админка: флот LLM ============ */
#fleet-box { margin-top: 8px; max-height: 300px; overflow-y: auto; }
#fleet-agent, #fleet-node { flex: 1; min-width: 0; background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px; color: var(--text);
    padding: 6px 8px; font-size: 13px; }
.nodes-empty .ne-sub { font-size: 13px; color: var(--text-dim); }
#st-token-box { margin: 10px 0; }
#st-list { max-height: none; }
#st-name { flex: 1; min-width: 160px; }


/* ============ Тумблер сворачивания левого сайдбара ============ */
.sidebar-toggle {
    position: absolute; top: 10px; right: -14px; z-index: 30;
    width: 28px; height: 28px;
    border: 1px solid var(--border); border-radius: 50%;
    background: var(--bg-panel); color: var(--text-dim);
    cursor: pointer; font-size: 14px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: .15s;
}
.sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); }
.sidebar { position: relative; }
.sidebar.collapsed .sidebar-toggle { right: -14px; }

/* ─── Подсказки ПРО-панели: железо и советы по движкам ─── */
.sp-hw {
    background: rgba(0, 212, 255, .06);
    border: 1px solid rgba(0, 212, 255, .18);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    font-size: 12px;
}
.sp-hw-line { color: var(--text); margin-bottom: 4px; }
.sp-hw-note { color: #93c5fd; margin-top: 3px; line-height: 1.4; }
.sp-tips {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    font-size: 11.5px;
    line-height: 1.45;
}
.sp-tip { color: #fbbf24; }
.sp-tip-dim { color: #7dd3fc; opacity: .85; }

/* ─── Значки «?» (обучение) в панели параметров ─── */
.sp-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; height: 16px;
    margin-left: 6px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-block);
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    padding: 0;
    vertical-align: middle;
    transition: .15s;
}
.sp-help:hover { color: #fbbf24; border-color: #fbbf24; background: rgba(251,191,36,.08); }
.help-body { font-size: 13px; line-height: 1.55; color: var(--text); }
.help-body p { margin: 0 0 12px; }
.help-opt {
    display: flex; gap: 10px;
    padding: 7px 9px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: var(--bg-block);
    border: 1px solid var(--border);
    font-size: 12.5px; line-height: 1.45;
}
.help-opt b {
    flex: 0 0 120px;
    color: #fbbf24;
    font-weight: 600;
}
.help-opt span { color: #cbd5e1; }
.help-opt.cur { border-color: var(--accent); }

/* ── кредиты: чип баланса в сайдбаре и строка в профиле ── */
#user-credits { margin-left: auto; opacity: .8; font-size: .82em; white-space: nowrap; }
.profile-credits { margin-top: 6px; font-size: .9em; opacity: .85; }

/* ── пополнение баланса: рамка «для своих» (Т-Банк) ── */
.topup-box {
    margin: 4px 0 10px;
    padding: 10px 12px;
    border: 1.5px solid var(--accent, #4f8cff);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(79,140,255,.10), rgba(79,140,255,.03));
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
/* 10.10.2026: класс переименован из .telegram-box — блок Telegram в профиле убран
   по приказу владельца, а рамка осталась для «Смены пароля». */
.pf-box {
    margin: 4px 0 10px;
    padding: 10px 12px;
    border: 1.5px solid var(--tg, #2AABEE);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(42,171,238,.10), rgba(42,171,238,.03));
    text-align: center;
}
.tg-line { font-size: .9em; margin: 3px 0; line-height: 1.4; }
.topup-label { font-size: .74em; text-transform: uppercase; letter-spacing: .08em; opacity: .75; margin-bottom: 4px; }
.topup-line { font-size: .95em; }
.topup-phone {
    font-size: 1.15em;
    font-weight: 700;
    letter-spacing: .03em;
    margin: 2px 0 4px;
    color: var(--accent, #4f8cff);
}
.topup-note { font-size: .74em; opacity: .7; }

/* ============================================
   РЕДАКТИРОВАНИЕ КАРТИНКИ (img2img / inpainting)
   ============================================ */
.edit-wrap {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 8px 16px;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 14px;
    overflow-y: auto;
    align-items: start;
}
/* студия занимает поле целиком и скроллится внутри — ничего не уезжает за экран */
#edit-studio {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}
#edit-studio.hidden { display: none; }
.ed-pick-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
}
.ed-pick-item {
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    width: 120px;
    height: 120px;
    flex: 0 0 auto;
}
.ed-pick-item:hover { border-color: var(--accent); }
.ed-pick-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.edit-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.edit-right {
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 200px;
    overflow-y: auto;
}
.edit-canvas-box {
    background: var(--bg-block);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    justify-content: center;
    min-height: 120px;
}
.edit-stack { position: relative; max-width: 100%; }
#ed-img { display: block; max-width: 100%; max-height: 42vh; border-radius: 8px; }
#ed-mask {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: .55;
    border-radius: 8px;
    touch-action: none;
}
.edit-tools, .edit-denoise, .st-card.edit-load {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.edit-tools input[type=range] { flex: 0 0 140px; }
.edit-denoise input[type=range] { flex: 1; max-width: 260px; }
.edit-hint { color: var(--text-dim); font-size: 12px; flex-basis: 100%; }
.edit-tools .btn-small.active { border-color: var(--accent); color: var(--accent); }
.edit-right .result-item { margin-bottom: 10px; }
.edit-right .result-item img { max-width: 100%; border-radius: 8px; }
.edit-right .result-actions { margin-top: 6px; }
@media (max-width: 900px) {
    .edit-wrap { grid-template-columns: 1fr; }
    .edit-right { min-height: 120px; }
}

.gallery-item { position: relative; }

