.photo-processor {
    width: 95%;
    background: var(--color-white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    overflow: clip; /* Не hidden: с ним не липнет кнопка запуска */
    max-width: 1200px;
    margin: 0 auto;
    margin-bottom: 3em;
}

.container {
    padding: 15px;
}

/* Единый контейнер загрузки */
.upload-container {
    transition: var(--transition);
    border: 1px solid #ffdfb6;
    border-radius: var(--radius-lg);
    padding: 30px;
    background: var(--color-bg);
    min-height: 300px;
}
/* Форма до запуска скрипта: нажимать нельзя, по центру — крутилка */
.upload-container.pc-wait { position: relative; pointer-events: none; cursor: progress; }
.upload-container.pc-wait .upload-area { opacity: .45; transition: none; }
@media (min-width: 900px) { .upload-container.pc-wait { min-height: var(--pc-fh, 300px); } } /* --pc-fh — высота готовой формы: ниже ничего не прыгает */

.upload-container.drag-over {
    border-color: #ff9a1f;
    background: #fffaf2;
    transform: scale(1.01);
    box-shadow: 0 10px 30px rgba(228, 129, 0, 0.18);
}

/* Область загрузки (двухколоночная) */
.upload-area {
    display: flex;
    gap: 30px;
    align-items: stretch;
    min-height: 250px;
    width: 100%;
}

/* Левая колонка: превью */
.preview-section {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.preview-area {
    flex: 1;
    border: 1px solid #d7d7d7;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    overflow: hidden;
    position: relative;
    min-height: 200px;
}

/* Правая колонка: управление */
.control-section {
    flex: 1;
    min-width: 300px;
    max-width: 500px; /* Шире ~510px сетка настроек — в две колонки */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Пустое состояние: ровный пунктир (.es-fr rect; шаг под периметр — целое число штрихов, ставит скрипт, --per — период);
   наведение — синий и медленно бежит, файл над формой — оранжевый и быстрее */
.preview-area.is-empty { border: 0; }
.empty-state {
    --es-c: #c7d2fe; --es-f: var(--color-white);
    position: relative;
    flex: 1;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 280px;
    padding: 40px 28px;
    text-align: center;
    color: var(--color-text);
    cursor: pointer;
}
.empty-state > :not(.es-fr) { position: relative; } /* над заливкой рамки */
.es-fr { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.es-fr rect { fill: var(--es-f); stroke: var(--es-c); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 8 7; transition: stroke .25s, fill .25s; }
.empty-state:hover .es-fr rect { animation: esRun 1.2s linear infinite; }
.drag-over .empty-state .es-fr rect { animation: esRun .6s linear infinite; }
@keyframes esRun { to { stroke-dashoffset: calc(-1 * var(--per, 15px)); } }
.es-ics { display: flex; align-items: center; }
.es-ic { width: 76px; height: 76px; border-radius: 22px; background: #eef0ff; color: var(--color-primary); display: grid; place-items: center; transition: transform .3s, background .25s, color .25s; }
.es-ic svg { width: 38px; height: 38px; }
.es-ics .es-ic { width: 64px; height: 64px; border-radius: 19px; border: 3px solid var(--color-white); }
.es-ics .es-ic svg { width: 31px; height: 31px; }
.es-ics .es-ic:nth-child(1) { transform: rotate(-8deg) translateX(6px); }
.es-ics .es-ic:nth-child(2) { transform: rotate(8deg) translateX(-6px); }
.es-t { font-size: 18px; font-weight: 700; text-wrap: balance; }
.es-s { font-size: 14px; color: var(--color-text-light); margin-top: -8px; }
.es-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px; border-radius: 12px; background: var(--color-primary); color: #fff; font-size: 15px; font-weight: 500; transition: background .2s; }
.es-btn svg { width: 18px; height: 18px; }

.empty-state:hover { --es-c: var(--color-primary); --es-f: #eef0ff; }
.empty-state:hover .es-ic { transform: translateY(-4px); }
.empty-state:hover .es-ics .es-ic:nth-child(1) { transform: rotate(-14deg) translate(0, -2px); }
.empty-state:hover .es-ics .es-ic:nth-child(2) { transform: rotate(14deg) translate(0, -2px); }
.empty-state:hover .es-btn { background: var(--color-primary-dark); }
/* Три значка (монтаж): веер — средний впереди и выше, крайние наклонены и заходят под него */
.es-ics3 .es-ic { position: relative; }
.es-ics3 .es-ic:nth-child(1) { transform: rotate(-12deg) translate(14px, 4px); }
.es-ics3 .es-ic:nth-child(2) { transform: translateY(-4px); z-index: 1; }
.es-ics3 .es-ic:nth-child(3) { transform: rotate(12deg) translate(-14px, 4px); }
.empty-state:hover .es-ics3 .es-ic:nth-child(1) { transform: rotate(-18deg) translate(6px, 4px); }
.empty-state:hover .es-ics3 .es-ic:nth-child(2) { transform: translateY(-8px); }
.empty-state:hover .es-ics3 .es-ic:nth-child(3) { transform: rotate(18deg) translate(-6px, 4px); }
.drag-over .empty-state { --es-c: #ff9a1f; --es-f: #fff4e6; }
.drag-over .empty-state .es-ic { background: #ff9a1f; color: #fff; }
.drag-over .empty-state .es-btn { background: #e48100; }

/* Образец (генерация - можно и без фото): узкий блок, синий только круг «+» */
.empty-state.empty-ref { min-height: 150px; padding: 22px 14px; gap: 10px; }
.es-pl { width: 48px; height: 48px; border-radius: 50%; background: var(--color-primary); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(79, 70, 229, .25); transition: transform .2s, background .2s; }
.es-pl svg { width: 24px; height: 24px; }
.empty-ref:hover .es-pl { transform: scale(1.06); }
.drag-over .empty-ref .es-pl { background: #ff9a1f; box-shadow: 0 6px 16px rgba(228, 129, 0, .3); }
.empty-ref .es-t { font-size: 15px; }
.empty-ref .es-s { font-size: 13px; margin-top: -8px; }
@media (max-width: 768px) {
    .empty-state { min-height: 240px; padding: 32px 18px; }
    .empty-state.empty-ref { min-height: 150px; padding: 22px 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .empty-state, .empty-state * { transition: none !important; animation: none !important; }
}

/* Single режим (одно изображение) */
.single-preview-container {
    position: static; /* Не relative: кнопки (ретушь, удалить) и подпись привязаны к рамке .preview-area (она по размеру кадра) */
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 60vh;
}

.single-preview-image {
    max-width: 100%;
    max-height: 60vh; /* Не 100%: на телефоне у родителей нет заданной высоты, процент не работал, высокое фото вылезало за рамку, а кнопки на нём уезжали вверх */
    object-fit: contain;
    box-shadow: var(--shadow-md);
    position: relative;
}
/* Кадр видео, которое браузер не проигрывает (videoStill в scripts_frm.js): значок ▶ и длительность поверх */
/* Киноплёнка: тёмные полосы с перфорацией по длинным краям кадра (горизонтальный и квадратный - сверху и снизу, .pv-v - по бокам) */
.pv-still { --film: 18px; position: relative; display: inline-flex; max-width: 100%; line-height: 0; pointer-events: none; padding: var(--film) 0; background: #111827; border-radius: 8px; box-shadow: var(--shadow-md); }
.pv-still.pv-v { padding: 0 var(--film); }
.pv-still .single-preview-image { box-shadow: none; max-height: calc(60vh - 2 * var(--film)); }
.pv-still::before, .pv-still::after, .thumb-film::before, .thumb-film::after { content: ''; position: absolute; left: 0; right: 0; height: var(--film); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='14'%3E%3Crect x='4' y='3.5' width='8' height='7' rx='1.6' fill='%23e2e8f0'/%3E%3C/svg%3E") center / 16px 100% repeat-x; pointer-events: none; z-index: 2; }
.pv-still::before, .thumb-film::before { top: 0; }
.pv-still::after, .thumb-film::after { bottom: 0; }
.pv-still.pv-v::before, .pv-still.pv-v::after, .thumb-film.pv-v::before, .thumb-film.pv-v::after { top: 0; bottom: 0; left: auto; right: auto; width: var(--film); height: auto; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='16'%3E%3Crect x='3.5' y='4' width='7' height='8' rx='1.6' fill='%23e2e8f0'/%3E%3C/svg%3E") center / 100% 16px repeat-y; }
.pv-still.pv-v::before, .thumb-film.pv-v::before { left: 0; }
.pv-still.pv-v::after, .thumb-film.pv-v::after { right: 0; }
.pv-still .pv-dur { position: absolute; right: 10px; bottom: calc(var(--film) + 8px); z-index: 3; padding: 4px 8px; border-radius: 6px; background: rgba(15, 23, 42, .78); color: #fff; font-size: 13px; line-height: 1; font-weight: 600; }
.pv-still.pv-v .pv-dur { right: calc(var(--film) + 8px); bottom: 10px; }
/* Миниатюра: полосы поверх краёв кадра (полупрозрачные - кадр квадратный, обрезанный) */
.thumb-film { --film: 11px; }
.thumb-film::before, .thumb-film::after { background-color: rgba(17, 24, 39, .88); background-size: 11px 100%; }
.thumb-film.pv-v::before, .thumb-film.pv-v::after { background-color: rgba(17, 24, 39, .88); background-size: 100% 11px; }
.thumb-film .thumbnail-remove { z-index: 5; }
.thumb-film .thumb-vdur { bottom: calc(var(--film) + 4px); }
/* Звук в форме: миниатюра и превью — в цвет результата-звука (.hb-audio) */
.thumbnail.thumb-aud, .pv-aud { display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 35%, #334155 0, #1e293b 55%, #0f172a 100%); color: #e2e8f0; }
.thumb-aud .hb-aud-ico { width: 44%; height: auto; }
.pv-aud { flex-direction: column; gap: 20px; width: 100%; min-height: 240px; padding: 48px 16px 24px; box-sizing: border-box; border-radius: 8px; } /* Сверху — подпись файла (.cv-src) */
.pv-aud .hb-aud-disc { width: 96px; }
.pv-aud audio { width: min(100%, 420px); }
.pv-aud-t { font-size: 14px; color: #94a3b8; text-align: center; }
.thumb-num { position: absolute; right: 5px; bottom: 5px; z-index: 5; min-width: 9px; padding: 1px 5px; border-radius: 4px; background: rgba(15, 23, 42, .45); color: rgba(255, 255, 255, .85); font: 500 11px/1.35 Roboto, Arial, sans-serif; text-align: center; font-variant-numeric: tabular-nums; pointer-events: none; }
.thumb-film .thumb-num { bottom: calc(var(--film) + 4px); }
.thumb-film.pv-v .thumb-num { right: calc(var(--film) + 4px); bottom: 6px; }
.thumb-film.pv-v .thumb-vdur { left: calc(var(--film) + 4px); bottom: 6px; }
/* Окно «не поместится в память»: рискованный вариант - неприметной ссылкой */
.cv-risk { display: block; margin-top: 16px; font-size: 13px; color: #64748b; text-decoration: underline; }
.pv-noplay { display: flex; align-items: center; justify-content: center; width: min(100%, 420px); aspect-ratio: 16 / 9; padding: 20px; box-sizing: border-box;
    background: #1e293b; color: #cbd5e1; border-radius: 10px; text-align: center; font-size: 15px; line-height: 1.4; }

/* Batch режим (несколько изображений) */
.upload-container[data-mode="batch"] .preview-area {
    flex-wrap: wrap;
    gap: 15px;
    border: 0;
    justify-content: center;
    align-content: center; /* Ряды миниатюр - кучкой по центру (при высокой колонке настроек их растягивало по высоте) */
}

/* Миниатюры */
.thumbnail {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease; /* Не all: переход по opacity вместе с анимацией иногда застревал на середине */
    flex-shrink: 0;
    background: var(--color-bg);
    animation: thumbnailAppear 0.3s ease;
}

.thumb-more { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; border: 1px solid #d7d7d7; background: #fff; color: #475569; font: 500 14px/1.2 Roboto, Arial, sans-serif; cursor: pointer; }
.thumb-more b { font-size: 22px; font-weight: 700; color: var(--color-text); }
.thumb-more:hover { border-color: #e48100; color: #b45f00; }

@keyframes thumbnailAppear {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Монтаж: ролик среди фото — кадр и длительность */
.thumbnail video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; background: #0f172a; }
.thumb-vdur { position: absolute; left: 6px; bottom: 6px; z-index: 5; padding: 2px 6px; border-radius: 4px; background: rgba(15, 23, 42, .75); color: #fff; font: 600 11px/1.3 Roboto, Arial, sans-serif; pointer-events: none; }
.cv-src { position: absolute; left: 12px; top: 12px; z-index: 5; max-width: calc(100% - 80px); padding: 3px 8px; border-radius: 6px; background: rgba(15, 23, 42, .75); color: #fff; font: 500 12px/1.4 Roboto, Arial, sans-serif; pointer-events: none; }
.cv-src.pv-b { top: auto; bottom: 12px; max-width: calc(100% - 24px); box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Оценка результата над кнопкой: конвертер и сжатие видео, сжатие и конвертер фото. В тон .fe-info */
.pc-est { margin: 14px 0; padding: 14px 18px; background: linear-gradient(135deg, #fff 0%, #fff8ef 100%); border: 1px solid #f3e1c7; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); text-align: left; font-family: 'Roboto', Arial, sans-serif; font-size: 14px; line-height: 1.4; color: #475569; }
.pc-est.pc-busy > * { opacity: .35; }
.pc-est-wait { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #64748b; }
.pc-est-h { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #b45f00; }
.pc-est-grid { display: grid; grid-template-columns: auto 1fr; gap: 0 16px; margin: 0 0 10px; }
.pc-est-grid > span, .pc-est-grid > b { padding: 6px 0; border-bottom: 1px dashed #f0dcc0; }
.pc-est-grid > span { color: #64748b; }
.pc-est-grid > b { font-weight: 500; color: var(--color-text); overflow-wrap: anywhere; }
.pc-est-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.pc-est-from { color: #94a3b8; font-size: 15px; }
.pc-est-main > i { font-style: normal; color: #e48100; font-weight: 700; }
.pc-est-main > b { font-size: 19px; font-weight: 700; color: var(--color-text); }
.pc-est-pct { padding: 3px 10px; border-radius: 999px; background: #e8f7ee; font-size: 12.5px; font-weight: 600; color: #15803d; }
.pc-est-pct.is-up { background: #fdecec; color: #b91c1c; }
.pc-est-n { margin-top: 8px; font-size: 12.5px; line-height: 1.45; color: #64748b; }
.pc-est-n + .pc-est-n { margin-top: 4px; }
.pc-est > .pc-est-n:first-child { margin-top: 0; }
.pc-est-main + .pc-est-n { padding-top: 8px; border-top: 1px solid #f3e1c7; }

/* Обрезка видео (libs/video_trim.js): полоса времени под превью, рамка кадра поверх него */
.tr-box { padding: 12px 14px 14px; border: 1px solid #d7d7d7; border-radius: var(--radius-lg); background: #fff; font-family: 'Roboto', Arial, sans-serif; font-size: 14px; color: #475569; user-select: none; }
.tr-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tr-play { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--orangrad); color: #fff; cursor: pointer; flex: none; }
.tr-step { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin-left: -4px; padding: 0; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #1e293b; cursor: pointer; flex: none; touch-action: manipulation; -webkit-touch-callout: none; }
.tr-step:hover { border-color: #e48100; color: #b45f00; }
.tr-step:active { background: #fff7ed; }
.tr-h.is-act { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #e48100; } /* Её двигают кнопки ‹ › */
.tr-line { position: relative; height: 52px; border-radius: 8px; background: #e2e8f0; cursor: pointer; touch-action: none; }
.tr-thumbs { position: absolute; inset: 0; display: flex; overflow: hidden; border-radius: 8px; }
.tr-thumbs span { flex: 1; background: center / cover no-repeat; }
.tr-thumbs.tr-wave { align-items: center; gap: 1px; padding: 0 2px; background: #1e293b; }
.tr-wave span { min-height: 2px; border-radius: 1px; background: #7dd3fc; } /* Волна звука: высота - пик кусочка */
.tr-out { position: absolute; top: 0; bottom: 0; background: rgba(15, 23, 42, .62); }
.tr-out-a { left: 0; border-radius: 8px 0 0 8px; }
.tr-out-b { right: 0; border-radius: 0 8px 8px 0; }
.tr-sel { position: absolute; top: 0; bottom: 0; border-top: 3px solid #e48100; border-bottom: 3px solid #e48100; box-sizing: border-box; pointer-events: none; }
.tr-h { position: absolute; top: -4px; bottom: -4px; width: 16px; margin-left: -8px; border-radius: 5px; background: #e48100; cursor: ew-resize; box-shadow: 0 1px 4px rgba(30, 41, 59, .35); z-index: 2; }
.tr-h::after { content: ''; position: absolute; left: 6px; top: 50%; width: 4px; height: 18px; margin-top: -9px; border-left: 1px solid #fff; border-right: 1px solid #fff; box-sizing: border-box; }
.tr-h:focus-visible { outline: 2px solid #1e293b; outline-offset: 1px; }
.tr-ph { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(30, 41, 59, .6); pointer-events: none; z-index: 3; }
.tr-t { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.tr-t i { font-style: normal; color: #94a3b8; }
.tr-t input { width: 92px; height: 34px; padding: 0 8px; border: 1px solid #cbd5e1; border-radius: 8px; font: 500 14px 'Roboto', Arial, sans-serif; font-variant-numeric: tabular-nums; color: #1e293b; text-align: center; user-select: text; }
.tr-t input:focus { outline: none; border-color: #e48100; }
.tr-host { position: absolute; overflow: hidden; z-index: 4; pointer-events: none; }
.tr-host[hidden] { display: none; }
.tr-crop { position: absolute; box-sizing: border-box; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .55); cursor: move; pointer-events: auto; touch-action: none; }
.tr-grid { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, transparent 33.2%, rgba(255, 255, 255, .45) 33.3%, rgba(255, 255, 255, .45) 33.5%, transparent 33.6%, transparent 66.5%, rgba(255, 255, 255, .45) 66.6%, rgba(255, 255, 255, .45) 66.8%, transparent 66.9%), linear-gradient(transparent 33.2%, rgba(255, 255, 255, .45) 33.3%, rgba(255, 255, 255, .45) 33.5%, transparent 33.6%, transparent 66.5%, rgba(255, 255, 255, .45) 66.6%, rgba(255, 255, 255, .45) 66.8%, transparent 66.9%); opacity: 0; transition: opacity .15s; }
.tr-crop.is-drag .tr-grid { opacity: 1; }
.tr-crop.is-circle { border-radius: 50%; }
.tr-ch { position: absolute; width: 18px; height: 18px; border: 2px solid #e48100; border-radius: 4px; background: #fff; box-sizing: border-box; }
.tr-nw { left: -9px; top: -9px; cursor: nwse-resize; } .tr-se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.tr-ne { right: -9px; top: -9px; cursor: nesw-resize; } .tr-sw { left: -9px; bottom: -9px; cursor: nesw-resize; }
.tr-n, .tr-s { left: 50%; margin-left: -9px; cursor: ns-resize; } .tr-n { top: -9px; } .tr-s { bottom: -9px; }
.tr-e, .tr-w { top: 50%; margin-top: -9px; cursor: ew-resize; } .tr-e { right: -9px; } .tr-w { left: -9px; }
.pf-wm { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pf-box { position: absolute; box-sizing: border-box; border: 1.5px dashed #fff; outline: 1px dashed rgba(15, 23, 42, .6); cursor: move; pointer-events: auto; touch-action: none; }
.pf-box[hidden] { display: none; }
.pf-box .tr-ch { width: 14px; height: 14px; }
.pf-box .tr-nw { left: -7px; top: -7px; } .pf-box .tr-se { right: -7px; bottom: -7px; } .pf-box .tr-ne { right: -7px; top: -7px; } .pf-box .tr-sw { left: -7px; bottom: -7px; }
.tr-mont { margin-top: -10px; text-align: center; }
.tr-mont[hidden] { display: none; }
.tr-mont .btn { width: 100%; font-weight: 100; background: #fff; color: #1e293b; border: 1px solid #cbd5e1; box-shadow: none; }
.tr-mont .btn:hover { border-color: #e48100; color: #b45f00; }
.tr-mont-sub { margin-top: 6px; font-size: 12.5px; color: #64748b; }
@media (max-width: 768px) {
    .tr-box { padding: 10px; }
    .tr-ch { width: 24px; height: 24px; } /* Пальцем */
    .tr-nw { left: -12px; top: -12px; } .tr-se { right: -12px; bottom: -12px; } .tr-ne { right: -12px; top: -12px; } .tr-sw { left: -12px; bottom: -12px; }
    .tr-n, .tr-s { margin-left: -12px; } .tr-n { top: -12px; } .tr-s { bottom: -12px; } .tr-e, .tr-w { margin-top: -12px; } .tr-e { right: -12px; } .tr-w { left: -12px; }
    .tr-h { width: 22px; margin-left: -11px; } .tr-h::after { left: 9px; }
    .tr-t input { width: 84px; }
    .tr-bar { gap: 6px; }
    .tr-step { width: 32px; margin-left: 0; }
}
@media (max-width: 380px) { .tr-t input { width: 72px; padding: 0 4px; } }

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.thumbnail:hover img {
    transform: scale(1.05);
}

.thumbnail-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 25px;
    height: 25px;
    background: rgba(239, 68, 68, 0.95);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    transition: var(--transition);
    padding: 0;
    z-index: 10;
}
/* Крестик рисуем двумя линиями: символ «×» Chrome и Firefox ставят на разной высоте - по центру он не вставал */
.thumbnail-remove .icon { display: none; }
.thumbnail-remove::before, .thumbnail-remove::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 11px;
    height: 2px;
    margin: -1px 0 0 -5.5px;
    border-radius: 2px;
    background: #fff;
    transform: rotate(45deg);
}
.thumbnail-remove::after { transform: rotate(-45deg); }

.thumbnail-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Счётчик файлов: текст и полоса заполнения до предела, кнопки-значки */
.files-counter-message {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 10px 10px 10px 16px;
    background: rgba(255,255,255,.9);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--color-text-light);
    white-space: nowrap;
    bottom: 12px; /* Как кнопка запуска: прилипает только с pc-many */
    z-index: 20; /* Выше кнопок на миниатюрах */
}
.fc-info { flex: 1; min-width: 0; text-align: left; }
.fc-t { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.fc-t b { color: var(--color-text); font-weight: 600; }
.fc-tight .fc-t { display: none; }
.fc-bar { height: 6px; border-radius: 3px; background: #eef2f7; overflow: hidden; }
.fc-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #10b981, #34d399); transition: width .3s; }
.fc-btn { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--color-border); border-radius: 10px;
    background: #fff; color: var(--color-text); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.fc-btn svg { width: 18px; height: 18px; }
.fc-add { background: var(--color-primary); border-color: var(--color-primary); color: #fff; margin-right: -8px; }
.fc-add:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.fc-clear:hover { color: var(--color-danger); border-color: #fecaca; background: #fef2f2; }

/* Подсказка */
#uploadHint {
    text-align: center;
}

.upload-hint {
    color: var(--color-text-light);
    font-size: 14px;
}
.upload-hint:empty { display: none; }

/* Файловый инпут */
.file-input {
    display: none;
}

/* Панель настроек */
.settings-panel {
padding: 0;
}

.settings-content {
    transition: var(--transition);
}

.settings-panel.active .settings-content {
    opacity: 1;
    pointer-events: all;
}

.settings-panel:not(.active) .settings-content {
    opacity: 0.6;
    pointer-events: none;
}

.settings-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

/* Вместо настроек — коротко об инструменте */
.fe-info { position: relative; overflow: hidden; background: linear-gradient(135deg, #fff 0%, #fff8ef 100%); border: 1px solid #f3e1c7; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 18px 20px; text-align: left; font-family: 'Roboto', Arial, sans-serif; color: #475569; }
.fe-info-t { margin: 0 0 12px; font-size: 19px; line-height: 1.25; font-weight: 700; color: var(--color-text); }
.fe-info-steps { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; counter-reset: fe; }
.fe-info-steps li { counter-increment: fe; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; color: var(--color-text); }
.fe-info-steps li::before { content: counter(fe); flex: none; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, #ff9305, #d87a00); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(216, 122, 0, .3); }
.fe-info-tx { margin: 0; font-size: 14px; line-height: 1.6; }
.fe-info-tx b { font-weight: 500; color: #b45f00; }
.fe-info-foot { display: inline-block; margin: 14px 0 0; padding: 5px 12px; border-radius: 999px; background: #e8f7ee; font-size: 12.5px; font-weight: 500; color: #15803d; }

.setting-group {
background: #fff;
  padding: 10px 15px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 5px;
  border: 1px solid #e5e5e5;
}

.setting-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 5px;
}

.setting-control {
    width: 100%;
    padding: 10px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: white;
}

.setting-control:focus {
    outline: none;
    border-color: var(--color-primary);
}

.range-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.range-value {
    min-width: 40px;
    font-weight: 600;
    color: var(--color-primary);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
}

/* === СТИЛИ ДЛЯ COLOR PICKER === */
.color-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.color-preview:hover {
    transform: scale(1.05);
    border-color: var(--color-primary);
}

.color-input {
    width: 100%;
    height: 45px;
    padding: 5px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: #fff;
}

.color-input:hover {
    border-color: var(--color-primary);
}

.color-value {
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-bg);
    padding: 4px 10px;
    border-radius: 20px;
    font-family: monospace;
    border: 1px solid var(--color-border);
    white-space: nowrap;
}

/* === СТИЛИ ДЛЯ КОММЕНТАРИЕВ НАСТРОЕК === */
.setting-comment {
 font-size: .8em;
  color: #174e94;
}

/* === СТИЛИ ДЛЯ image_file === */
.image-file-container {
    margin-top: 4px;
    width: 100%;
}

.image-file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f9fafb;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid #e5e7eb;
}

.image-file-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    flex-shrink: 0;
}

.image-file-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.image-file-change-btn,
.image-file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;
}
.image-file-change-btn{flex:1;}

.image-file-change-btn:hover,
.image-file-upload-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.image-file-empty {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.image-file-hint {
    font-size: 11px;
    color: #6d7683;
}

.icon-upload::before {
    content: "📎";
    font-size: 14px;
}

/* Кнопка обработки: внизу колонки (оценка - под настройками) */
.processing-button-container {
    text-align: center;
    margin-top: auto;
    bottom: 12px; /* Действует только с sticky (pc-many) */
    z-index: 5;
}
/* Много файлов (pc-many, от 12) — лента вытягивается: кнопка и счётчик у низа окна (решение владельца: меньше — стоят внизу формы) */
@media (min-width: 769px) { .upload-container.pc-many .processing-button-container, .upload-container.pc-many .files-counter-message { position: sticky; } }
.upload-container:not(.pc-many) .pc-to-set { display: none; }
.upload-container.no-settings .processing-button-container { margin-top: 0; }
.pc-to-set { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 8px; padding: 10px 20px; background: #e2e8f0; color: #334155; font-weight: 500; }
.pc-to-set:hover { background: #cbd5e1; }
.pc-to-set[hidden] { display: none; }

#startProcessingBtn {
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    width: 100%;
}

#processingButtonText {
    font-size: 16px;
}

/* История */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Блоки результатов: «Последняя» и «Прошлые», режимы «одно фото» и «много фото» */
.history-block { background: #fff; border: 1px solid #e8ebef; border-radius: 18px; animation: slideUp 0.4s ease; text-align: left; font-family: 'Roboto', Arial, sans-serif; font-size: 14px; line-height: 1.4; color: #1e293b; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hb-wrap { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.hb-head { display: flex; align-items: center; gap: 12px; min-height: 40px; } /* Высота кнопки «Все»: без неё шапка не прыгает */
.hb-head-t { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.hb-title { margin: 0; padding: 0; font-size: 20px; font-weight: 700; line-height: 1.2; color: #1e293b; font-family: inherit; text-align: left; background: none; text-shadow: none; }
.hb-sub { font-size: 13px; color: #64748b; }
.hb-all-btn { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 12px; border: 0; border-radius: 12px; background: #fff; color: #1e293b; font: 700 15px 'Roboto', Arial, sans-serif; white-space: nowrap; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); transition: background .15s; }
.hb-all-btn:hover { background: #fff4e6; }
/* ⋯ — меню блока (выбрать, удалить, в «Прошлые»), только в «много фото»: неяркая, справа в шапке */
.hb-dots { flex: none; margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; }
.hb-dots:hover, .hb-dots[aria-expanded="true"] { background: rgba(255, 255, 255, .24); }
.hb-all-btn svg { flex: none; color: #e48100; transition: transform .15s; }
.hb-all-btn:hover svg { transform: translateX(-2px); }
.hb-all-n { display: flex; align-items: center; justify-content: center; height: 26px; min-width: 26px; padding: 0 8px; box-sizing: border-box; border-radius: 8px; background: var(--orangrad); color: #fff; font-size: 13px; font-variant-numeric: tabular-nums; }
.hb-all-s { display: none; }
/* Плитка «все» в начале ленты миниатюр: прилипает к левому краю; фон блока под ней и тенью на отступы (padding ленты 3px, gap 8px) закрывает уезжающие миниатюры; сама плитка — ::before */
.hb-all { --hb-bg: #5a616e; flex: none; position: sticky; left: 0; z-index: 2; width: 68px; height: 68px; padding: 0; box-sizing: border-box; border: 0; border-radius: 0; background: var(--hb-bg); box-shadow: 0 0 0 3px var(--hb-bg), 5px 0 0 3px var(--hb-bg); color: #fff; cursor: pointer; }
.history-block[data-hb="past"] .hb-all { --hb-bg: #4a505c; }
.hb-all::before { content: ''; position: absolute; inset: 0; border: 1px solid rgba(255, 255, 255, .45); border-radius: 9px; background: #1f232b; transition: background .15s; }
.hb-all:hover::before { background: #2d323c; }
.hb-all em { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 700 16px/1.1 'Roboto', Arial, sans-serif; font-style: normal; pointer-events: none; }
.hb-all em small { font-size: 11px; font-weight: 500; }

.hb-single { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 24px; }
.hb-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hb-stage { border: 1px solid #dfdfdf; position: relative; display: flex; align-items: center; justify-content: center; height: max(280px, min(calc(100vh - 260px), 520px)); /* Блок с каруселью целиком на экране, под шапкой сайта */ border-radius: 12px; overflow: hidden; background: #f1f3f6; touch-action: pan-y pinch-zoom; /* Листание пальцем - сами, вертикальная прокрутка страницы - браузер */ }
.hb-stage .hb-pic { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.hb-stage-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(3px) grayscale(1); opacity: .4; }
.hb-stage .pend-skel { width: 100%; height: 100%; }
/* PNG с прозрачностью: клетка на всю площадь, размытый фон не нужен */
.hb-stage.img-alpha, .hb-fs .hb-stage.img-alpha, .hb-tile-img.img-alpha, .single-preview-image-container.img-alpha, .thumbnail.img-alpha { background-color: #fff; background-image: linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%), linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.img-alpha .hb-stage-bg { display: none; }
.hb-stage-err { padding: 0 72px; text-align: center; font-size: 16px; line-height: 1.45; color: #991b1b; }
.hb-pos { position: absolute; bottom: 12px; left: 12px; display: flex; align-items: center; height: 30px; padding: 0 10px; border-radius: 8px; background: rgba(30, 41, 59, .72); color: #fff; font-size: 13px; font-variant-numeric: tabular-nums; }
.hb-ba { position: absolute; bottom: 12px; right: 12px; display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: #fff; box-shadow: 0 1px 4px rgba(30, 41, 59, .25); }
.hb-ba-btn { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #1e293b; font: 500 13px 'Roboto', Arial, sans-serif; cursor: pointer; }
.hb-ba-btn.is-on { background: var(--orangrad); color: #fff; }
.hb-tools { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.hb-tool { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 11px; border: 0; border-radius: 10px; background: #fff; color: #1e293b; font: 500 14px 'Roboto', Arial, sans-serif; cursor: pointer; box-shadow: 0 1px 4px rgba(30, 41, 59, .25); opacity: .8; transition: opacity .15s; }
.hb-tool:hover { background: #f1f3f6; opacity: 1; }
.hb-tool-t { display: none; } /* Только иконка, текст - при наведении; на телефоне всегда только иконка */
@media (hover: hover) and (min-width: 769px) { .hb-tool:hover .hb-tool-t { display: inline; } }
.hb-arrow { position: absolute; top: 50%; margin-top: -22px; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: #fff; color: #1e293b; cursor: pointer; box-shadow: 0 1px 4px rgba(30, 41, 59, .25); opacity: .8; transition: opacity .15s; }
.hb-arrow:hover { background: #f1f3f6; opacity: 1; }
.hb-prev { left: 12px; }
.hb-fwd { right: 12px; }
.hb-thumbs { position: relative; display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; padding: 3px; scrollbar-width: thin; }
.hb-stage.pc-busy .hb-pic, .hb-stage.pc-busy .hb-stage-bg { visibility: hidden; }
.hb-thumb { flex: none; width: 68px; height: 68px; padding: 0; box-sizing: border-box; border: 1px solid #e2e8f0; border-radius: 9px; overflow: hidden; background: #f1f3f6; cursor: pointer; }
.hb-thumb.pc-busy { --sz: 20px; --bw: 2px; }
.hb-thumb img, .hb-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
div.hb-pic.hb-audio, div.hb-pic.hb-file { display: flex; } /* Сильнее .hb-stage .hb-pic и .hb-tile-img .hb-pic (display: block) */
.hb-audio { flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 20px; box-sizing: border-box; background: radial-gradient(circle at 50% 35%, #334155 0, #1e293b 55%, #0f172a 100%); color: #e2e8f0; }
.hb-aud-disc { display: grid; place-items: center; flex: none; width: clamp(56px, 24%, 132px); aspect-ratio: 1; border-radius: 50%; background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; box-shadow: 0 10px 30px rgba(2, 132, 199, .35), 0 0 0 10px rgba(56, 189, 248, .08); }
.hb-aud-disc .hb-aud-ico { width: 46%; height: auto; }
.hb-aud-eq { display: flex; align-items: center; justify-content: center; gap: 4px; width: min(90%, 420px); height: 44px; }
.hb-aud-eq i { flex: 1 1 0; max-width: 8px; height: 100%; border-radius: 3px; background: rgba(148, 163, 184, .4); transform: scaleY(var(--h)); transition: background .3s; }
.hb-audio.is-play .hb-aud-eq i { background: #38bdf8; animation: hbEq .8s ease-in-out var(--d) infinite alternate; }
@keyframes hbEq { from { transform: scaleY(var(--h)); } to { transform: scaleY(calc(1.1 - var(--h))); } }
@media (prefers-reduced-motion: reduce) { .hb-audio.is-play .hb-aud-eq i { animation: none; } }
.hb-audio audio { width: min(90%, 420px); }
.hb-aud-t { font-size: 14px; color: #94a3b8; text-align: center; }
.hb-stage .hb-audio { cursor: auto; }
.hb-file { display: flex; align-items: center; justify-content: center; background: #000; color: #94a3b8; }
.hb-file img { display: block; width: 100%; height: 100%; object-fit: contain; }
.hb-tile-img .hb-file img { object-fit: cover; }
.hb-file .hb-aud-ico { width: 30%; max-width: 110px; height: auto; }
.hb-file-t { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: max-content; max-width: 90%; box-sizing: border-box; padding: 7px 12px; border-radius: 8px; background: rgba(15, 23, 42, .82); color: #fff; font-size: 13px; line-height: 1.35; text-align: center; }
.hb-thumb .hb-aud-ico { display: block; width: 60%; height: 60%; margin: 20%; color: #64748b; }
.hb-stage video.hb-pic { cursor: auto; background: #000; } /* Видео: плеер, клик — его кнопки */
.hb-thumb.is-err { border-color: #fecaca; background: #fef2f2; color: #991b1b; font: 700 18px 'Roboto', Arial, sans-serif; }
.hb-thumb.is-cur { border: 3px solid #0284c7; }

/* Полноэкранный просмотр: те же .hb-stage и .hb-thumbs */
.hb-fs { position: fixed; inset: 0; z-index: 9990; display: flex; flex-direction: column; gap: 10px; padding: 12px; box-sizing: border-box; background: #14161b; font-family: 'Roboto', Arial, sans-serif; font-size: 14px; color: #fff; }
.hb-fs .hb-stage { flex: 1 1 auto; border: 0px; height: auto; min-height: 0; background: none; border-radius: 0; }
.hb-fs .hb-stage .hb-pic { cursor: default; }
.hb-fs .hb-stage.hb-zoomable { touch-action: none; }
.hb-fs .hb-zoomable .hb-pic { cursor: zoom-in; transform-origin: 50% 50%; will-change: transform; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.hb-fs .hb-zoomable.is-zoomed .hb-pic { cursor: zoom-out; }
.hb-fs .hb-zoomable.is-drag .hb-pic { cursor: grabbing; }
.hb-fz { position: absolute; right: 12px; bottom: 12px; z-index: 2; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(30, 41, 59, .72); }
.hb-fz button { display: flex; align-items: center; justify-content: center; width: 36px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: #fff; font: 400 22px/1 Roboto, Arial, sans-serif; cursor: pointer; }
.hb-fz .hb-fz-val { width: auto; min-width: 54px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.hb-fz button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.hb-fz button:disabled { opacity: .35; cursor: default; }
.hb-fs .hb-stage-err { color: #fecaca; }
.hb-fs .hb-ba { top: 12px; left: 12px; bottom: auto; right: auto; }
.hb-fs .hb-thumbs { flex: none; justify-content: safe center; }
.hb-fs .hb-thumb { border-color: #3a3f4b; background: #23262e; }
.hb-fs-close { position: absolute; top: 12px; right: 12px; z-index: 1; display: flex; align-items: center; box-shadow: 0 1px 4px rgba(30, 41, 59, .25); justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: #fff; color: #1e293b; cursor: pointer; }
.hb-fs-close:hover { background: #f1f3f6; }

.hb-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 4px 8px 4px 0; }
.hb-photo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hb-photo-name { min-width: 0; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-chip { flex: none; display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 700; }
.hb-chip.is-ok { background: #dcfce7; color: #166534; }
.hb-chip.is-err { background: #fee2e2; color: #991b1b; }

.hb-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; padding: 12px 0; border-top: 1px solid #f0f2f5; border-bottom: 1px solid #f0f2f5; }
.hb-fact span { display: block; font-size: 12px; color: #64748b; }
.hb-fact b { font-weight: 500; word-break: break-word; }

.hb-prompt { display: flex; flex-direction: column; gap: 6px; }
.hb-prompt-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: #64748b; }
.hb-copy { height: 28px; padding: 0 8px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; color: #1e293b; font: 12px 'Roboto', Arial, sans-serif; cursor: pointer; }
.hb-copy:hover { border-color: #cbd5e1; }
.hb-prompt-t { line-height: 1.45; word-break: break-word; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.hb-prompt-t.is-open { display: block; }
.hb-more { align-self: flex-start; padding: 0; border: 0; background: none; color: #b45f00; font: 13px 'Roboto', Arial, sans-serif; cursor: pointer; }

.hb-exp { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.hb-exp-t { font-size: 13px; }
.hb-exp-t b { font-weight: 700; }
.hb-exp-bar { height: 4px; border-radius: 2px; background: #f0f2f5; overflow: hidden; }
.hb-exp-bar i { display: block; height: 100%; border-radius: 2px; background: #e48100; }
.hb-exp-row { display: flex; align-items: center; gap: 10px; }
.hb-exp-own { container-type: inline-size; }
.hb-cfg { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 2px 0; border: 0; background: none;
    color: inherit; font: inherit; font-size: 13px; cursor: pointer; opacity: .65; }
.hb-cfg:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
@container (max-width: 340px) { .hb-cfg span { display: none; } }
/* Своя обработка: часы видны всегда (красные — меньше часа), при наведении — корзина */
.hb-soon.hb-bin { padding: 0; border: 0; cursor: pointer; background: rgba(30, 41, 59, .6); transition: background .15s; }
.hb-soon.hb-bin.is-soon, .hb-soon.hb-bin:hover, .hb-soon.hb-bin:focus-visible { background: #dc2626; }
.hb-bin-d { display: none; }
.hb-bin-c, .hb-bin-d { line-height: 0; }
.hb-bin:hover .hb-bin-c, .hb-bin:focus-visible .hb-bin-c { display: none; }
.hb-bin:hover .hb-bin-d, .hb-bin:focus-visible .hb-bin-d { display: block; }
.hb-soon.hb-bin-stage { top: 12px; right: 12px; width: 34px; height: 34px; z-index: 2; }

.hb-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; box-sizing: border-box; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; color: #1e293b; font: 500 14px 'Roboto', Arial, sans-serif; cursor: pointer; }
.hb-btn:hover:not(:disabled) { border-color: #cbd5e1; background: #f8fafc; }
.hb-btn:disabled { opacity: .5; cursor: not-allowed; }
.hb-dl { gap: 8px; min-height: 48px; border: 0; background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; font-size: 16px; font-weight: 700; }
.hb-dl:hover:not(:disabled) { background: linear-gradient(135deg, #0284c7, #0369a1); }
/* Кнопки под фото — на графитовом блоке: яркая только «Скачать», остальные полупрозрачные */
.hb-dlrow { display: flex; gap: 10px; }
.hb-dlrow .hb-dl { flex: 1 1 auto; min-width: 0; }
.hb-share { flex: none; width: 48px; min-height: 48px; padding: 0; }
.hb-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hb-actions .hb-btn:only-child { grid-column: 1 / -1; }
.hb-2l { gap: 8px; min-height: 48px; padding: 4px 12px; line-height: 1.25; }
.hb-2l span { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; column-gap: 6px; }
.hb-2l b { font-weight: 700; font-size: 14px; }
.hb-2l small { font-size: 11.5px; color: #e2e6ec; }
.hb-2l small::before { content: '· '; }
.hb-2l, .hb-share { border-color: rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: #fff; }
.hb-2l:hover:not(:disabled), .hb-share:hover:not(:disabled) { border-color: rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .14); }
.hb-menu { gap: 8px; min-height: 40px; border: 1px dashed rgba(255, 255, 255, .3); background: rgba(0, 0, 0, .08); color: #ffd9a8; }
.hb-menu:hover:not(:disabled), .hb-menu[aria-expanded="true"] { border: 1px solid rgba(255, 255, 255, .3); background: rgba(0, 0, 0, .14); }
.hb-actions .hb-menu { min-height: 48px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .08); color: #fff; } /* «Изменить» — как «Переделать» */
.hb-actions .hb-menu:hover:not(:disabled), .hb-actions .hb-menu[aria-expanded="true"] { border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .14); }

.hb-warn { font-size: 14px; color: #475569; }
.hb-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.hb-grid::after { content: ''; flex-grow: 999; } /* Последний неполный ряд не растягивается */
.hb-tile { flex: var(--r) 1 calc(var(--r) * 210px); max-width: calc(var(--r) * 330px); min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hb-tile-img { position: relative; width: 100%; aspect-ratio: var(--r); border-radius: 10px; overflow: hidden; background: #f1f3f6; }
.hb-tile-img .hb-pic { display: block; width: 100%; height: 100%; object-fit: cover; cursor: pointer; transition: filter 0.2s ease; }
.hb-look { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: #fff; color: #1e293b; font: 500 14px 'Roboto', Arial, sans-serif; white-space: nowrap; cursor: pointer; box-shadow: 0 1px 4px rgba(30, 41, 59, .25); opacity: 0; transition: opacity .15s; }
.hb-tile-img:hover .hb-look, .hb-look:focus-visible { opacity: 1; }
@media (hover: hover) { .hb-tile-img:hover .hb-pic { filter: blur(1px); } } /* «Прошлые» — свои, ниже */
@media (hover: none) { .hb-look { display: none; } } /* Телефон: наведения нет, плитка открывается нажатием на фото */
.hb-tile-img .pend-skel { width: 100%; height: 100%; }
/* Фото плитки грузится: заготовка с бликом. Анимация только «от» (fill backwards): потом действуют обычные правила */
.hb-tile-img.is-loading { background: rgba(255,255,255,.08); }
.hb-tile-img.is-loading > * { opacity: 0; }
.hb-tile-img.is-loading::after { content: ''; position: absolute; top: 0; bottom: 0; left: -100%; width: 300%; pointer-events: none;
    background: repeating-linear-gradient(90deg, rgba(255,255,255,0) 0, rgba(255,255,255,0) 10%, rgba(255,255,255,.12) 16.6667%, rgba(255,255,255,0) 23.3333%, rgba(255,255,255,0) 33.3333%);
    animation: pendShine 1.8s linear infinite; will-change: transform; }
.hb-tile-img.is-in .hb-pic { animation: hbPicIn .5s cubic-bezier(.2, .8, .2, 1) backwards; }
.hb-tile-img.is-in .hb-check, .hb-tile-img.is-in .hb-soon { animation: hbFadeIn .3s ease .25s backwards; }
@keyframes hbPicIn { from { opacity: 0; transform: scale(1.06); filter: blur(6px); } }
@keyframes hbFadeIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hb-tile-img.is-loading::after { animation: none; } .hb-tile-img.is-in .hb-pic { animation-name: hbFadeIn; } }
/* Смена режима блока: копии фото в полёте. Ниже шапки сайта (z-index: 500) */
.hb-fly { position: absolute; z-index: 100; max-width: none; object-fit: cover; pointer-events: none; }
.hb-check { position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; padding: 0; box-sizing: border-box; border: 2px solid #fff; border-radius: 7px; background: rgba(30, 41, 59, .45); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.hb-check.is-on { border-color: #e48100; background: #e48100; }
.hb-soon { position: absolute; top: 8px; right: 8px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #dc2626; color: #fff; }
.hb-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-meta { font-size: 12px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-tile-err { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box; padding: 10px; border: 1px solid #fecaca; background: #fef2f2; text-align: center; cursor: pointer; }
.hb-err-t { font-size: 13px; font-weight: 700; color: #991b1b; }
.hb-retry { height: 32px; padding: 0 12px; border: 1px solid #fca5a5; border-radius: 8px; background: #fff; color: #991b1b; font: 13px 'Roboto', Arial, sans-serif; cursor: pointer; }

.hb-foot { display: flex; align-items: center; gap: 16px; padding: 16px 0 12px; border-top: 1px solid #f0f2f5; background: #fff; }
.hb-wrap:has(> .hb-foot) { padding-bottom: 8px; } /* 12px нижнего отступа — у самого .hb-foot, чтобы прилипший не касался края окна */
.hb-foot.is-stuck { position: sticky; bottom: 0; z-index: 4; box-shadow: 0 -10px 16px -8px rgba(0, 0, 0, .35); animation: hbFootIn .25s ease-out; } /* Как кнопка запуска; класс ставит скрипт */
@keyframes hbFootIn { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .hb-foot.is-stuck { animation: none; } }
.hb-foot-t { flex: 1 1 auto; min-width: 0; }
.hb-foot-tit { font-size: 15px; font-weight: 700; }
.hb-foot .hb-exp { margin-top: 2px; color: #475569; }
.hb-foot .hb-exp-t b { color: #1e293b; }
.hb-foot-btns { flex: none; display: flex; align-items: center; gap: 8px; }
.hb-act { gap: 7px; min-width: 112px; min-height: 46px; padding: 0 14px; border: 0; background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; font-weight: 700; }
.hb-act:hover:not(:disabled) { border: 0; background: linear-gradient(135deg, #0284c7, #0369a1); }

/* Результаты — графитовая зона под инструментом. .hb-fs и окно PDF — вне .history-block */
.history-container:has(.history-block) { gap: 24px; margin: 15px -15px -15px; padding: 20px 16px 24px; background: #4a505c; }
.history-block { border: 0; background: #5a616e; color: #fff; }
.history-block[data-hb="past"] { background: #4a505c; }
.history-block[data-hb="past"] .hb-wrap { padding: 0 18px; }
/* «Прошлые» (всегда последний блок; после него в зоне — <script> истории) без нижнего отступа: под «Скачать … как» — 12px у .hb-foot + этот, всего 16, как над кнопками */
.history-container:has(> .history-block[data-hb="past"] > .hb-wrap > .hb-foot) { padding-bottom: 4px; }
.history-block .hb-title, .history-block .hb-foot .hb-exp-t b { color: #fff; }
.history-block .hb-sub, .history-block .hb-fact span, .history-block .hb-prompt-head, .history-block .hb-warn, .history-block .hb-meta, .history-block .hb-foot .hb-exp, .history-block .pend-time, .history-block .pend-note { color: #e2e6ec; }
.history-block .hb-more, .history-block .hb-meta.pend-time { color: #ffd9a8; }
.history-block .hb-stage { border: 0; }
.history-block .hb-facts, .history-block .hb-foot { border-color: #727987; }
.history-block .hb-foot { background: #5a616e; }
.history-block[data-hb="past"] .hb-foot { background: #4a505c; }
/* «Прошлые», «много фото»: плитки чёрно-белые, при наведении — цветные, без размытия (решение владельца; на сенсорных экранах наведения нет — цветные) */
@media (hover: hover) {
    .history-block[data-hb="past"] .hb-tile .hb-pic { filter: grayscale(80%); }
    .history-block[data-hb="past"] .hb-tile:hover .hb-pic { filter: grayscale(0%); }
}
.history-block .hb-exp-bar { background: #4a505c; }
.history-block .hb-thumb.is-cur { border-color: #7dd3fc; }

/* Окно настроек PDF */
.pdfm-bg { position: fixed; inset: 0; z-index: 9990; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; background: rgba(20, 22, 27, .6); }
.pdfm { display: flex; flex-direction: column; width: 100%; max-width: 620px; max-height: 100%; border-radius: 18px; background: #fff; font-family: 'Roboto', Arial, sans-serif; font-size: 14px; color: #1e293b; text-align: left; }
.pdfm-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #f0f2f5; }
.pdfm-title { font-size: 18px; font-weight: 700; }
.pdfm-x { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: #f1f3f6; color: #1e293b; cursor: pointer; }
.pdfm-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 16px 20px; }
.pdfm-field { margin: 0; padding: 0; background: none; border: 0; box-shadow: none; min-width: 0; }
.pdfm-field.is-wide { grid-column: 1 / -1; }
.pdfm-field.is-section { grid-column: 1 / -1; margin-top: 4px; padding-top: 16px; border-top: 1px solid #e2e8f0; font-weight: 700; }
.pdfm-range { display: flex; align-items: center; gap: 8px; }
.pdfm-range span { flex: none; font-size: 13px; color: #475569; }
.pdfm-color { display: block; width: 56px; height: 34px; padding: 2px; box-sizing: border-box; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; cursor: pointer; }
.pdfm-foot { flex: none; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid #f0f2f5; }
.pdfm-foot .hb-dl { min-height: 44px; font-size: 15px; }
@media (max-width: 560px) { .pdfm-body { grid-template-columns: minmax(0, 1fr); } }

@media (max-width: 768px) {
    .hb-head{padding: 10px 0;}
    /* Телефон: фото и карусель, сразу под ними - скачать и срок, ниже сведения */
    .hb-wrap { padding: 12px 8px; gap: 12px; }
    .hb-wrap:has(> .hb-foot) { padding-bottom: 0; }
    .hb-title { font-size: 18px; }
    .history-container:has(.history-block) { margin: 20px -8px -8px; padding: 0 0 14px; gap: 16px; }
    .history-block { border-radius: 0; }
    .history-block[data-hb="past"] .hb-wrap { padding: 0 8px; }
    .hb-head-t { flex-direction: column; align-items: flex-start; }
    .hb-sub { font-size: 12px; }
    .hb-single { display: flex; flex-direction: column; gap: 12px; }
    .hb-info { display: contents; }
    .hb-info.pend-info { display: flex; order: 3; }
    .hb-left { order: 1; }
    .hb-photo { order: 2; }
    .hb-dlrow { order: 3; }
    .hb-exp { order: 4; }
    .hb-facts { order: 5; }
    .hb-prompt { order: 6; }
    .hb-actions { order: 7; }
    .hb-menu { order: 8; }
    .hb-stage { height: auto; aspect-ratio: 4 / 3; }
    .hb-stage-err { padding: 0 56px; font-size: 14px; }
    .hb-arrow { width: 40px; height: 40px; margin-top: -20px; }
    .hb-prev { left: 8px; }
    .hb-fwd { right: 8px; }
    .hb-thumb, .hb-all { width: 56px; height: 56px; }
    .hb-all em { font-size: 14px; }
    .hb-all em small { font-size: 10px; }
    .hb-all-btn { height: 36px; padding: 0 6px 0 10px; font-size: 14px; }
    .hb-all-n { height: 24px; }
    .hb-all-l { display: none; }
    .hb-all-s { display: inline; }
    .hb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .hb-grid::after { display: none; }
    .hb-tile { max-width: none; }
    .hb-tile-img { aspect-ratio: 1; }
    .hb-tile .hb-name, .hb-tile .hb-meta { display: none; }
    .hb-tile .pend-time { display: block; }
    .hb-err-t { font-size: 12px; }
    .hb-retry { height: 28px; padding: 0 6px; font-size: 12px; }
    .hb-foot { flex-direction: column; align-items: stretch; gap: 10px; }
    .hb-foot-btns { gap: 6px; }
    .hb-act { flex: 1 1 0; flex-direction: column; gap: 3px; min-width: 0; min-height: 58px; padding: 0 2px; font-size: 12px; }
}

/* Задание в работе: заготовка с бликом. Наклон — skewX, а не угол градиента: у наклонного шаг зависит от высоты, блик прыгал */
.pend-skel { position: relative; overflow: hidden; background: #eceff4; display: flex; align-items: center; justify-content: center; color: #c7cdd8; }
.pend-skel svg { width: 34%; max-width: 150px; height: auto; }
.pend-skel::after { content: ''; position: absolute; top: 0; bottom: 0; left: -100%; width: 300%;
    background: repeating-linear-gradient(90deg, rgba(255,255,255,0) 0, rgba(255,255,255,0) 10%, rgba(255,255,255,.75) 16.6667%, rgba(255,255,255,0) 23.3333%, rgba(255,255,255,0) 33.3333%);
    animation: pendShine 1.8s linear infinite; will-change: transform; }
@keyframes pendShine { from { transform: translateX(0) skewX(-15deg); } to { transform: translateX(33.3333%) skewX(-15deg); } }
.hb-chip.is-wait { background: #fef3c7; color: #92400e; }
.pend-info { gap: 12px; }
.pend-stage { min-height: 1.5em; }
.pend-ind { width: 220px; max-width: 100%; height: 5px; border-radius: 999px; background: #f1f5f9; overflow: hidden; position: relative; }
.pend-ind i { position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; border-radius: 999px; background: linear-gradient(90deg, #ff9305, #d87a00); animation: pendInd 1.6s ease-in-out infinite; }
@keyframes pendInd { from { left: -40%; } to { left: 100%; } }
.pend-time { font-size: 14px; color: #64748b; font-variant-numeric: tabular-nums; }
.hb-meta.pend-time { font-size: 12px; color: #b45f00; font-weight: 500; }
.pend-note { font-size: 13px; color: #64748b; }
@media (prefers-reduced-motion: reduce) { .pend-skel::after, .pend-ind i { animation: none; } }



/* Иконки */
.icon {
    display: inline-block;
    font-style: normal;
}

.icon-plus::before { content: "+"; }
.icon-delete::before { content: "×"; }
.icon-settings::before { content: "⚙"; }
.icon-download::before { content: "⬇"; }
.icon-zip::before { content: "📦"; }
.icon-upload::before { content: "📎"; }

/* Адаптивность */
@media (max-width: 768px) {
    /* Телефон: ширина дороже рамок. Панель на весь экран, у инструмента нет рамки, остаются только карточки настроек */
    .photo-processor { width: 100%; border-radius: 0; box-shadow: none; background: var(--color-bg); }
    .container { padding: 16px 8px 8px; }
    .upload-container { min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
    .setting-group { padding: 10px 12px; }
    .upload-hint{display:none;}
    .processing-button-container, .files-counter-message { position: static; } /* Не липнет: иначе после загрузки настроек могут не заметить */
    .pc-to-set { display: none; }

    .upload-area {
        flex-direction: column;
        min-height: auto;
        gap: 0px;
    }
    .files-counter-message{margin-bottom: 15px;}
    
    .preview-section, .control-section {
        min-width: 100%;
        max-width: 100%;
    }
    
    .preview-area {
        min-height: 200px;
    }
    
    .settings-grid { grid-template-columns: 1fr; }
    
    
    .image-file-preview {
        flex-wrap: wrap;
    }
    
    .color-container {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .settings-title { font-size: 18px; }
}


/* Дополнительные стили для image_file */
.image-file-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.image-file-delete-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: #b91c1c;
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;
}

.image-file-delete-btn:hover {
    background: #fecaca;
    border-color: #ef4444;
}

.image-file-delete-btn .icon-delete::before {
    content: "×";
    font-size: 14px;
    font-weight: bold;
}







/* Стили для ошибок в истории */
.history-error-preview {
    box-sizing: border-box;
    cursor: pointer;
    width: 100%;
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #dc2626;
    font-size: 16px;
    text-align: center;
    padding: 20px;
    border: 2px solid #fecaca;
    border-radius: 8px;
}

.history-error-icon {
    font-size: 48px;
    margin-bottom: 10px;
}


.single-preview-image-container {
    position: static; /* См. выше: якорь для absolute-кнопок - .preview-area */
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 60vh;
    overflow: hidden;
}

/* Ретушь загруженного фото: одно фото и миниатюры */
.preview-retouch { position: absolute; top: 15px; left: 15px; z-index: 10; }
.thumb-retouch { position: absolute; top: 8px; left: 8px; z-index: 10; display: flex; align-items: center; justify-content: center; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 50%; background: #fff; color: #1e293b; cursor: pointer; opacity: .7; transition: opacity .15s; }
.thumb-retouch svg { width: 14px; height: 14px; }
.thumb-retouch:hover { opacity: 1; }

/* Анимации для прелоадера (улучшенные) */

/* Стили для режима без настроек */
.upload-container.no-settings .upload-area {
    flex-direction: column;
}

.upload-container.no-settings .preview-section {
    width: 100%;
    max-width: 100%;
}

.upload-container.no-settings .control-section {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.upload-container.no-settings .control-section.no-settings .settings-panel {
    display: none;
}

.upload-container.no-settings .control-section.no-settings .processing-button-container {
    width: auto;
    min-width: 300px;
    max-width: 500px;
}

.upload-container.no-settings .preview-area {
    min-height: 250px;
}

.upload-container.no-settings[data-mode="batch"] .preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.upload-container.no-settings .single-preview-container {
    align-items: normal; /* вместо center */
}

.upload-container.no-settings .single-preview-image-container {
    max-height: 60vh; height: auto;
}

.textarea-container, .string-input-container {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
}

.textarea-field {
    width: 100%;
    padding: 10px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.textarea-field:focus, .string-input-field:focus {
    outline: none;
    border-color: var(--color-primary);
}

.textarea-counter, .string-counter {
    position: absolute;
    bottom: -20px;
    right: 5px;
    font-size: 11px;
    color: #6d7683;
}

.string-input-field {
    width: 100%;
    padding: 10px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

/* Компактный режим для настроек */
.setting-group.compact {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1px 5px;
  border: 0px;
  background: none;
  box-shadow: none;
}

.setting-group.compact .setting-label {
    width: 40%;
    margin-bottom: 0;
    font-size: 13px;
    white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setting-group.compact .setting-control {
    width: 60%;
    padding: 5px 6px;
}

.setting-group.compact .range-container {
    width: 60%;
}

.setting-group.compact .checkbox-group {
    width: 60%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.setting-group.compact .checkbox-label {
    width: auto;
}

.setting-group.compact .color-container {
    width: 60%;
}

.setting-group.compact .image-file-container {
    width: 60%;
}

.setting-group.compact .string-input-container,
.setting-group.compact .textarea-container {
    width: 60%;
}

.setting-group.compact .setting-comment {
    width: 100%;
    margin-top: 5px;
    margin-left: 40%;
    font-size: 11px;
}
.setting-comment.up-hint { padding: 6px 10px; border-radius: var(--radius-sm, 6px); background: #fff4e5; color: #8a4b00; font-size: 12.5px; line-height: 1.4; }
/* «Пакетная обработка» — в строке счётчика символов, слева; неприметно, как сам счётчик */
.pc-each { display: grid; gap: 6px; margin-top: -10px; text-align: left; }
.pc-each > .checkbox-label { justify-self: start; gap: 6px; max-width: calc(100% - 70px); font-size: 12px; color: #6d7683; }
.pc-each > .checkbox-label input { width: 13px; height: 13px; margin: 0; }
.pc-each[hidden], .pc-each .up-hint[hidden] { display: none; }

/* Поле не по умолчанию — .pc-chg, ↺ — .pc-rs */
/* Подпись — как без обёртки, ↺ — поверх правого края её колонки; поля по бокам симметричные, чтобы центр подписи не сдвигался */
.pc-lab { position: relative; min-width: 0; }
.setting-group.compact .pc-lab { width: 40%; }
.setting-group.compact .pc-lab .setting-label { width: 100%; box-sizing: border-box; }
.pc-chg .pc-lab .setting-label { padding-left: 26px; padding-right: 26px; }
.pc-rs { display: none; position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: none; color:#c94200; cursor: pointer; align-items: center; justify-content: center; }
.pc-rs:hover, .pc-rs:focus-visible { background: #e0e7ff; outline: none; }
.pc-chg .pc-rs { display: inline-flex; }
/* Одна высота у списков и кнопок-списков в строке (иначе логотип модели и иконка пропорций растягивали свои) */
.setting-group.compact select.setting-control, .setting-group.compact .mp-btn, .setting-group.compact .ar-btn { height: 36px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
.pc-chg select.setting-control, .pc-chg .ar-btn { background: #ffeedc; border-color: #e3d5c5;}

/* Компактные поля (у всех форм): подписи влево, столбцом по самой длинной; в две колонки — с tabSettings.cols2: сетка [подпись | поле | подпись | поле], группа — subgrid, поэтому подписи каждой колонки на одной линии.
   Модель (.pc-full), последнее непарное (.pc-wide) и не compact — во всю ширину; пары (.pc-two) — от ширины блока настроек, порог — cols2, не окна. ↺ — место под неё есть всегда */
.settings-grid.pc-cols { grid-template-columns: max-content minmax(0, 1fr); gap: 10px 0; }
.pc-cols > .setting-group { grid-column: 1 / -1; }
.pc-cols > .setting-group.compact { display: grid; grid-template-columns: subgrid; align-items: center; gap: 5px 0; padding: 0 1.5em; } /* gap: свой gap группы сбил бы колонки subgrid */
.pc-cols > .compact > .pc-lab, .pc-cols > .compact > .setting-label { grid-column: 1; width: auto; }
.pc-cols > .compact > :not(.pc-lab):not(.setting-label) { grid-column: 2 / -1; width: 100%; box-sizing: border-box; margin-left: 0; }
.pc-cols > .compact .setting-label { text-align: left; padding: 0 30px 0 0; }
.pc-cols > .compact .pc-rs { right: 4px; }
/* Галочки — сеткой; без подписи — от левого края, в две колонки как поля */
.pc-cols > .compact > .checkbox-group { display: grid; grid-template-columns: 1fr; gap: 10px 16px; text-align: left; } /* в две колонки — только с .pc-two */
.pc-cols > .compact > .checkbox-group:first-child { grid-column: 1 / -1; }
/* Подписи не режутся — сжимаются поля */
.pc-two > .compact > .checkbox-group:first-child { grid-template-columns: 1fr 1fr; column-gap: 28px; }
.settings-grid.pc-cols.pc-two { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); }
.pc-two > .setting-group.compact:not(.pc-full):not(.pc-wide) { grid-column: span 2; }
.pc-two > .compact.pc-r:not(.pc-wide) .setting-label { padding-left: 28px; }
/* Отступ compact-групп — у всей сетки: иначе он встаёт между колонками и сужает одно поле; карточки — обратно на край */
.settings-grid.pc-cols.pc-two { padding: 0 1.5em; }
.pc-two > .setting-group.compact { padding-left: 0; padding-right: 0; }
.pc-two > .setting-group:not(.compact) { margin: 0 -1.5em; }

#startProcessingBtn.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: auto; /* Важно: оставляем возможность клика */
    background: #555;
}

#startProcessingBtn.btn-disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    background: #333;
}

/* ===== Вкладки инструментов ===== */
.pc-tabs{position:relative; z-index:30; /* выше прилипающих кнопки запуска и счётчика формы - панель «Прочие» над ними */ width:95%; max-width:1200px; margin:0 auto; background:#eceef2; border-radius:20px 20px 0 0; box-shadow:0 -12px 20px -14px rgba(0,0,0,.35); /* тень только вверх: вниз (на блок под активной вкладкой) не заходит */ text-align:left; font-family:'Roboto',Arial,sans-serif;}
.pc-tabs ~ .photo-processor{border-top-left-radius:0; border-top-right-radius:0;} /* ~: между ними стоит <script> */
.pc-tabs{--pc-on:#fff; --pc-edge:#bbb;}
.pc-tabs-strip{display:flex; gap:0; padding:4px 5px 0; border-radius:20px 20px 0 0; box-shadow: inset 0 -.5px 0 #cbcbcb; }
.pc-tab{box-sizing:border-box; position:relative; flex:1 1 0; max-width:220px; /* В разделе с 2-3 инструментами (Видео) вкладки не растягиваются на всю ширину */
    min-width:max-content; /* равные, пока подпись влезает; длинная («Водяной знак» в «Прочих») берёт своё, остальные ужимаются */ display:flex; align-items:center; justify-content:center; gap:9px; height:44px; padding:0 10px; border:0; border-radius:14px 14px 0 0; background:transparent; color:#4b5563; font:500 15px/1 'Roboto',Arial,sans-serif; cursor:pointer; white-space:nowrap; text-decoration:none; transition:background .15s,color .15s; -webkit-tap-highlight-color:transparent;}
.pc-tab svg{color:#6b7280; flex:none; transition:color .15s,transform .2s;}
/* У иконки внутри svg ~3px пустоты слева, у текста справа её нет - группа «иконка + текст» на глаз смещена вправо. Компенсируем */
.pc-tab>svg{margin-left:-3px;}
.pc-tab>span{display:flex; align-items:center; gap:4px;}
/* Черта между вкладками; рядом с выбранной и наведённой не нужна */
.pc-tab + .pc-tab::before{content:''; position:absolute; left:0; top:50%; width:1px; height:18px; margin-top:-9px; background:#d3d7de; transition:opacity .15s;}
.pc-tab:hover::before, .pc-tab:hover + .pc-tab::before, .pc-tab.is-active::before, .pc-tab.is-active + .pc-tab::before{opacity:0;}
/* Подсветка при наведении - без нижнего 1px: там линия полосы, полупрозрачный фон её осветлял бы */
.pc-tab:hover, .pc-tabs.is-open .pc-tab-other{background:linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,.55)) top / 100% calc(100% - 1px) no-repeat; color:#1e293b;}
.pc-tab:hover svg{color:#c96f00;}
.pc-tab.is-active, .pc-tab.is-active:hover{border:1px solid var(--pc-edge); border-bottom:0; color:#1e293b; font-weight:700; z-index:1; background:var(--pc-on);}
.pc-tab.is-active svg{color:#e48100;}
.pc-tabs.is-open .pc-chev{transform:rotate(180deg);}
.pc-tab:focus-visible, .pc-free:focus-visible, .pc-tabs-next:focus-visible, .pc-sec:focus-visible{outline:2px solid #e48100; outline-offset:-2px;}

/* Разделы (Фото, Видео, Аудио) — ярлыки над полосой вкладок; место под них — .cln-head */
.pc-secs{position:absolute; left:0; bottom:100%; display:flex; align-items:flex-end; gap:4px;}
.pc-sec{position:relative; display:flex; align-items:center; gap:7px; height:36px; padding:0 18px; border:0; border-radius:12px 12px 0 0; background:rgba(255,255,255,.07); color:#c7cad1; font:500 14px/1 'Roboto',Arial,sans-serif; cursor:pointer; white-space:nowrap; text-decoration:none; transition:background .15s,color .15s; -webkit-tap-highlight-color:transparent;}
.pc-sec svg{color:#9ca3af; flex:none; transition:color .15s;}
.pc-sec:hover{background:rgba(255,255,255,.13); color:#fff;}
.pc-sec:hover svg{color:#f0a33a;}
.pc-sec.is-active, .pc-sec.is-active:hover{background:#eceef2; color:#1e293b; font-weight:700; cursor:default;}
.pc-sec.is-active svg{color:#c96f00;}
.pc-sec i{font-style:normal; font-size:11px; font-weight:500; padding:3px 7px; border-radius:999px; background:rgba(240,154,42,.18); color:#f0a33a;}
.pc-sec.is-active::before, .pc-sec.is-active::after{content:''; position:absolute; bottom:0; width:12px; height:12px; pointer-events:none;}
.pc-sec.is-active::before{left:-12px; background:radial-gradient(circle at 0 0, transparent 12px, #eceef2 12.5px);}
.pc-sec.is-active::after{right:-12px; background:radial-gradient(circle at 100% 0, transparent 12px, #eceef2 12.5px);}
.pc-sec.is-active:first-child::before{display:none;}
/* Левый угол полосы всегда прямой: ярлыки стоят от самого края, и при неактивном первом ярлыке скруглённый угол
   отходил от него уголком */
.pc-tabs, .pc-tabs-strip{border-top-left-radius:0;}
/* Сообщение раздела «скоро» - над ярлыком */
.pc-secs-msg{position:absolute; bottom:calc(100% + 10px); left:0; z-index:60; width:max-content; max-width:300px; padding:10px 14px; border-radius:12px; background:#fff; color:#1e293b; font:500 14px/1.4 'Roboto',Arial,sans-serif; box-shadow:0 10px 30px rgba(0,0,0,.25); opacity:0; visibility:hidden; transform:translateY(4px); transition:opacity .15s,transform .15s,visibility .15s; pointer-events:none;}
.pc-secs-msg::after{content:''; position:absolute; top:100%; left:24px; border:7px solid transparent; border-top-color:#fff;}
.pc-secs-msg.is-show{opacity:1; visibility:visible; transform:none;}

.pc-tabs-panel{display:none; position:absolute; top:100%; right:0; width:520px; max-width:100%; box-sizing:border-box; z-index:50; background:#fff; border-radius:0 0 16px 16px; box-shadow:0 18px 40px rgba(0,0,0,.18); padding:14px 14px 16px;}
.pc-tabs.is-open .pc-tabs-panel{display:block;}
.pc-tabs-panel-head{display:flex; align-items:baseline; justify-content:space-between; gap:10px; padding:2px 10px 10px; margin-bottom:8px; border-bottom:1px solid #edf0f3;}
.pc-tabs-panel-head b{font-size:14px; color:#1e293b; text-transform:uppercase; letter-spacing:.4px;}
.pc-tabs-panel-head span{font-size:13px; color:#475569;}
.pc-tabs-panel-grid{display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:4px;}
.pc-free{display:flex; gap:12px; align-items:center; padding:10px; border-radius:10px; text-decoration:none; color:#1e293b;}
.pc-free:hover{background:#fff7ec;}
.pc-free.is-active{background:#ffefd9;}
.pc-free-ico{width:40px; height:40px; border-radius:10px; background:#fff4e5; color:#c96f00; display:flex; align-items:center; justify-content:center; flex:none;}
.pc-free-txt{display:flex; flex-direction:column; gap:3px; min-width:0;}
.pc-free-txt b{font-size:15px; font-weight:500; color:#1e293b;}
.pc-free-txt span{font-size:13px; color:#475569;}

.pc-tabs-fade, .pc-tabs-next{display:none;}

@media (max-width:1200px){ .pc-tab{font-size:14px; gap:7px; padding:0 6px;} }

/* Узкий экран: вкладки «иконка над подписью». Пока помещаются - растягиваются на всю ширину,
   не помещаются - полоса листается вбок (пальцем, мышью, кнопкой «⋯») */
@media (max-width:1000px){
    .pc-tabs-strip{overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch; cursor:grab; user-select:none; -webkit-user-select:none;}
    .pc-tabs-strip::-webkit-scrollbar{display:none;}
    .pc-tabs.is-drag .pc-tabs-strip{cursor:grabbing;}
    .pc-tabs-strip{padding:6px 8px 0;}
    .pc-tab{flex:1 0 86px; max-width:none; height:52px; flex-direction:column; gap:2px; padding:0 4px; font-size:12px; line-height:1.1;}
    .pc-tab>svg{margin-left:0; width:24px; height:24px;}
    .pc-tab .pc-chev{width:12px; height:12px;}
    .pc-tab-other{flex-basis:104px; padding:0 8px;}
    /* Без наведения (палец «залипает» на вкладке) */
    .pc-tab:hover{background:transparent; color:#4b5563;}
    .pc-tab:hover svg{color:#6b7280;}
    .pc-tab:hover + .pc-tab::before{opacity:1;}
    .pc-tab.is-active + .pc-tab::before{opacity:0;}
    .pc-tab.is-active:hover{color:#1e293b;}
    .pc-tab.is-active:hover svg{color:#e48100;}
    .pc-tabs-fade{display:block; position:absolute; top:0; left:0; height:58px; width:24px; pointer-events:none; border-top-left-radius:20px; background:linear-gradient(to left, rgba(236,238,242,0), #eceef2); opacity:0; transition:opacity .2s;}
    .pc-tabs:not(.at-start) .pc-tabs-fade{opacity:1;}
    .pc-tabs-next{display:flex; position:absolute; top:0; right:0; height:58px; width:48px; border:0; padding:0 0 0 12px; border-top-right-radius:20px; background:linear-gradient(to right, rgba(236,238,242,0), #eceef2 40%); color:#36383F; align-items:center; justify-content:center; cursor:pointer;}
    .pc-tabs-next>span{width:28px; height:28px; border-radius:50%; background:#fff; box-shadow:0 1px 4px rgba(0,0,0,.18); display:flex; align-items:center; justify-content:center;}
    .pc-tabs.at-end .pc-tabs-next{display:none;}
    .pc-tabs-panel{position:static; width:auto; max-width:none; border-radius:0; box-shadow:none; padding:10px 8px 12px; border-bottom:1px solid #edf0f3;}
    .pc-tabs-panel-head{padding:2px 8px 8px;}
    .pc-tabs-panel-head b{font-size:13px;}
    .pc-tabs-panel-head span{font-size:12px;}
}
@media (max-width:560px){ .pc-tabs-panel-grid{grid-template-columns:minmax(0, 1fr);} }
/* Телефон: вкладки на весь экран, как и панель под ними (.photo-processor) */
@media (max-width:768px){
    .pc-tabs{width:100%; border-radius:0; box-shadow:none; --pc-on:var(--color-bg);} /* Форма на телефоне - цвета фона, выбранная вкладка - тоже */
    .pc-tabs-strip, .pc-tabs-fade, .pc-tabs-next{border-top-left-radius:0; border-top-right-radius:0;}
    /* Ярлыки разделов - с отступом от края экрана, ниже и уже */
    .pc-secs{left:12px;}
    .pc-sec{height:34px; padding:0 14px; font-size:13px;}
    .pc-sec.is-active:first-child::before{display:block;}
}