/* Палитра общего оформления Товарбота. */
:root{--brand:#2476ff;--brand-dark:#1559d6;--ink:#142b47;--muted:#647a96;--line:#dce7f5;--soft:#edf5ff;--canvas:#f4f8fd}
/* Адаптивная компоновка панели выбора и фотографии. */
*{box-sizing:border-box}body{margin:0;background:var(--canvas);color:var(--ink);font:17px/1.5 "Segoe UI",sans-serif}header,main{max-width:1120px;margin:auto;padding:20px 5%}header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--line)}a{color:var(--brand-dark)}main{display:grid;grid-template-columns:1fr 1.15fr;gap:40px;align-items:start}h1{font:normal clamp(32px,5vw,58px)/1.06 Georgia,serif}label{display:block;font-weight:600;margin:18px 0}select,input,button{font:inherit;border-radius:8px;padding:10px 14px}select,input{display:block;width:100%;border:1px solid #99afc9;background:white}button{background:var(--brand);color:white;border:0;cursor:pointer}button:disabled{opacity:.5}figure{margin:0;background:white;border-radius:16px;overflow:hidden}canvas{width:100%;display:block}small{color:var(--muted)}@media(max-width:700px){main{grid-template-columns:1fr;gap:16px}h1{margin:12px 0}figure{max-width:480px;width:100%;margin:auto}}
/* Карточки каталога и фильтры остаются доступны с клавиатуры и на телефоне. */
/* Каталог продолжает страницу под сценой, каждая фирма занимает свою сетку. */
.constructor{max-width:1260px;grid-template-columns:minmax(0,1fr);gap:12px}
.constructor h1{margin:0}
.preview-tools{display:grid;grid-template-columns:minmax(0,480px) 44px;gap:8px;justify-content:center;align-items:start}
.preview-tools aside{display:grid;gap:8px}
/* На компьютере перемешивание справа получает отдельную колонку; телефон сохраняет ширину фото. */
@media(min-width:701px){.preview-tools.has-ceiling-shuffle{grid-template-columns:minmax(0,480px) 96px}}
.preview-tools aside>.scene-control,.preview-tools aside>.ribbon-control{width:44px}
#ceiling-shuffle{position:absolute;left:52px;top:0}
#ceiling-shuffle[hidden]{display:none}
/* Мобильная мини-кнопка повторяет положение удаления фона, но остаётся самостоятельной доступной кнопкой. */
@media(max-width:700px){#ceiling-shuffle{left:auto;right:-4px;top:29px;z-index:2;width:21px;height:21px;min-height:0;border:2px solid white;border-radius:50%;background:var(--brand);color:white}#ceiling-shuffle svg{width:14px;height:14px}}
/* Палитра открывается влево от правой панели и помещается на мобильном экране. */
.ribbon-control{position:relative}
#ribbon-toggle{display:grid;place-items:center;width:44px;height:44px;margin:0;padding:0;border:1px solid var(--line);border-radius:9px;background:white;color:#aaa}
#ribbon-toggle:disabled{opacity:.45}
#ribbon-palette{position:absolute;right:52px;top:0;width:222px;max-width:calc(100vw - 84px);padding:14px;background:white;border:1px solid var(--line);border-radius:12px;box-shadow:0 6px 25px #0002;z-index:5}
#ribbon-palette[hidden]{display:none}
/* Четыре колонки учитывают внутреннюю ширину блока; отступ оставляет место для обводки выбора. */
.ribbon-swatches{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));justify-items:center;gap:8px;margin-top:8px}
.ribbon-swatches button{display:grid;place-items:center;width:100%;max-width:40px;height:auto;aspect-ratio:1;min-height:0;margin:0;padding:0;border:1px solid #888;border-radius:50%;background:var(--ribbon-color);color:#111}
.ribbon-swatches button[aria-pressed="true"]{outline:3px solid var(--brand-dark);outline-offset:2px}
.ribbon-swatches button[aria-pressed="true"]::after{content:"✓";background:white;border-radius:50%;padding:0 3px;font-weight:bold}
#status{height:3.2em;overflow:auto;margin:0;text-align:center}
.constructor .criteria{grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr))}
#choices{grid-column:1/-1;min-width:0}
#choices h2{font:normal 28px Georgia,serif;margin:20px 0 10px}
.brand-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(72px,1fr));gap:4px;background:white;padding:6px;border-radius:10px}
@media(max-width:760px){.brand-grid{grid-template-columns:repeat(auto-fill,minmax(58px,1fr))}}
.product {position:relative;min-width:0}
.product label {position:relative;display:grid;place-items:center;margin:0;padding:5px;aspect-ratio:4/5;cursor:pointer;border-radius:7px}
/* В палитре номер, название оттенка и артикул стоят непосредственно под фото. */
#choices h3{font:500 20px/1.3 "Segoe UI",sans-serif;margin:16px 0 4px}
.product label{display:flex;flex-direction:column;align-items:stretch;aspect-ratio:auto;height:100%;justify-content:flex-start}
.product img{width:100%;height:auto;aspect-ratio:600/780;object-fit:contain}
.swatch-caption{display:grid;text-align:center;font:normal 11px/1.25 "Segoe UI",sans-serif;color:var(--ink);overflow-wrap:anywhere}
/* Кнопки выбора накладываются на фото и сохраняют размеры ряда. */
.product input {position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.product label:has(:checked) {box-shadow:inset 0 0 0 2px #23783e}
.product label:has(:checked)::after {content:"✓";position:absolute;top:2px;right:2px;border-radius:50%;width:19px;text-align:center;background:#23783e;color:white;font: bold 15px/19px sans-serif;pointer-events:none}
.product label:has(:focus-visible) {outline:2px solid #12628d;outline-offset:1px}
.product button {position:absolute;top:24px;right:2px;background:rgb(20 43 71 / 55%);width:24px;height:24px;padding:0;line-height:1}
.product input:disabled {cursor:default}
/* Две колонки сохраняют место для фотографий на узких экранах. */
.criteria{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 10px;margin-bottom:12px}
.criteria label{margin:0;font-size:14px}.criteria select{max-width:100%;padding:6px}
#composition{min-height:48px;display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:0}#composition button{max-width:100%;overflow-wrap:anywhere;margin:0;font-size:14px}
/* Pointer Events работают и на телефоне; прокрутка страницы доступна вне маленьких цветовых плашек. */
#composition [data-selection-index]{cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#composition .is-moving{opacity:.5;cursor:grabbing}
#composition .is-drop-target{outline:3px solid var(--brand-dark);outline-offset:2px;transform:translateY(-2px)}
/* На телефоне прокручивается таблица; окно загрузки вписывается в экран. */
.catalog-admin{max-width:1440px;margin:auto;padding:2vw}.catalog-scroll{overflow-x:auto}.catalog-scroll table{border-collapse:collapse;width:100%;background:white}.catalog-scroll td,.catalog-scroll th{padding:7px;border-bottom:1px solid #ddd;text-align:left}.catalog-scroll img{width:44px;height:56px;object-fit:contain}.catalog-scroll button{margin:2px;font-size:14px}#sheet{max-width:96vw;width:1000px;max-height:90vh;border:0;border-radius:12px}#sheet::backdrop{background:#142b4788}
/* Полоса остаётся внутри границ таблицы и закрепляется снизу окна при чтении длинного списка. */
.catalog-scroll{scrollbar-width:none}
.catalog-scroll::-webkit-scrollbar{display:none}
.catalog-scroll th:first-child,.catalog-scroll td:first-child{position:sticky;left:0;z-index:1;background:white;box-shadow:1px 0 #ddd}
.catalog-rail{position:sticky;bottom:0;z-index:2;background:var(--canvas);padding:3px 1px}
.catalog-rail input{display:block;width:100%;height:20px;margin:0;padding:0;accent-color:var(--brand);cursor:ew-resize}
/* Шапка перекрывает строки и закреплённые фото; угловая ячейка остаётся непрозрачной. */
.catalog-scroll thead{position:relative;z-index:2;background:white}
.catalog-scroll th{background:white;box-shadow:inset 0 -1px var(--line)}
/* Переход в справочник рядом с основным действием каталога. */
.reference-link{display:inline-block;padding:8px 14px;border:1px solid #99afc9;border-radius:8px;text-decoration:none}

/* Кнопки остаются справа даже при узком экране; видимый значок не уменьшает область нажатия. */
#save,#tile-option{display:grid;place-items:center;position:relative;width:44px;height:44px;margin:0;padding:0;border-radius:9px}
.download-icon{font:600 24px/22px system-ui;border:solid currentColor;border-width:0 0 2px}
#tile-mode{position:absolute;inset:0;width:100%;height:100%;opacity:0;margin:0;cursor:pointer}
#tile-option{background:white;color:var(--brand-dark);border:1px solid var(--line)}
#tile-option:has(:checked){background:var(--brand-dark);color:white}
#tile-option:has(:disabled){opacity:.45}
#tile-option:has(:focus-visible){outline:2px solid var(--brand-dark);outline-offset:2px}
.tiles-icon{width:7px;height:7px;background:currentColor;box-shadow:9px 0,0 9px,9px 9px;transform:translate(-4.5px,-4.5px);pointer-events:none}
/* Заголовки, поля и переход в настройки используют общую тему кабинета. */
body{font:15px/1.6 Inter,system-ui,"Segoe UI",sans-serif}
header{background:white;gap:16px;flex-wrap:wrap}
h1,#choices h2{font-family:inherit;font-size:clamp(25px,4vw,34px);font-weight:700;line-height:1.2}
#choices h2{font-size:25px}
.settings-link,.reference-link{display:inline-flex;align-items:center;min-height:42px;padding:8px 16px;background:var(--soft);color:var(--brand-dark);border:1px solid var(--line);border-radius:9px;text-decoration:none;font-weight:600}
:where(button,a,input,select):focus-visible{outline:2px solid var(--brand-dark);outline-offset:2px}
.criteria{gap:12px}.criteria select{width:100%;min-width:0}
.constructor>section,main>section{min-width:0}
.catalog-admin{padding:clamp(16px,3vw,36px)}
.catalog-scroll td,.catalog-scroll th{padding:10px 12px}
.catalog-scroll button{white-space:nowrap}
.reference-page{max-width:780px}
.reference-page form,#values{padding:clamp(16px,3vw,24px);background:white;border:1px solid var(--line);border-radius:14px}
.reference-page form label:first-child{margin-top:0}
#values{list-style:none;margin:0}
#values li{display:grid;grid-template-columns:minmax(0,1fr) 40px 40px;align-items:center;gap:10px;padding:8px 0}
#values li+li{border-top:1px solid var(--line)}
#values li span{overflow-wrap:anywhere}
#values button{height:40px;width:40px;display:grid;place-items:center;padding:0;background:var(--soft);color:var(--brand-dark);border:1px solid var(--line);font:600 20px/1 system-ui}
#values button:hover:enabled,.settings-link:hover,.reference-link:hover{background:#dcecff}
#values button:disabled{opacity:.4;cursor:default}

/* Размер и его артикул остаются вместе даже в узкой карточке. */
.size-option{display:grid;grid-template-columns:5rem minmax(0,1fr);gap:.5rem;align-items:center;margin:.4rem 0}.size-option label{display:flex;align-items:center;gap:.4rem;margin:0}.size-option input[type=checkbox]{width:auto}

/* Размер над отметкой, как в таблице поставщика. */
.catalog-admin td:has(.size-choice){white-space:nowrap}.catalog-admin .size-choice{display:inline-flex;flex-direction:column;align-items:center;margin:0 .25rem;cursor:pointer}.size-choice input[type=radio]{width:1rem;height:1rem;accent-color:#198348}

/* Общая панель каталога: выбор файла занимает остаток строки. */
.catalog-actions{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-bottom:12px}
.catalog-actions>button,.catalog-actions>.reference-link{margin:0;white-space:nowrap;padding-inline:12px}
.catalog-actions>#book{flex:1 1 165px;min-width:0;width:auto;max-width:100%;margin:0;padding:6px;box-sizing:border-box}

/* Кнопки редактирования остаются в пределах строки. */
#values li{grid-template-columns:minmax(0,1fr) repeat(3,40px)}#values li.editing{grid-template-columns:minmax(0,1fr) auto auto}#values li.editing button{width:auto;padding:0 8px;font-size:14px}#values li.editing input{min-width:0}

/* Заголовок раскрывает всю фирму; индикатор показывает состояние. */
.brand-section{min-width:0;margin:16px 0 24px}
.brand-header{display:flex;align-items:center;flex-wrap:wrap;gap:10px 24px;padding:10px 12px;border-radius:10px;background:var(--soft);border:1px solid var(--line)}
#choices .brand-header h2{margin:0;font:600 24px/1.3 "Segoe UI",sans-serif;min-width:0}
.brand-disclosure{display:flex;align-items:center;gap:12px;background:transparent;color:var(--ink);padding:8px 0;font:inherit;text-align:left;overflow-wrap:anywhere}
.brand-disclosure::before{content:"";width:9px;height:9px;border-right:2px solid var(--brand-dark);border-bottom:2px solid var(--brand-dark);transform:rotate(-45deg);flex:none}
.brand-disclosure[aria-expanded=true]::before{transform:rotate(45deg)}
/* Переключатели подписей не сворачивают фирму и переносятся на узком экране. */
.brand-tools{display:flex;flex-wrap:wrap;gap:6px}
.brand-option{display:inline-flex;align-items:center;gap:6px;min-height:38px;padding:6px 9px;background:white;color:var(--muted);border:1px solid var(--line);font-size:14px;white-space:nowrap}
/* До заполнения размерных данных скрываем оба управления у всех фирм; логика остаётся в app.js. */
.brand-option[data-key="sizeVisible"],.brand-option[data-key="skuVisible"]{display:none}
.brand-option[aria-pressed=true]{background:#dcecff;color:var(--brand-dark);border-color:#99bdf6}
.brand-option:disabled{cursor:default;opacity:.5}
.brand-option svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
.brand-sizes{margin:12px 0;padding:12px;border:1px solid var(--line);border-radius:10px;min-width:0;background:white}
.brand-sizes legend{font-size:14px;color:var(--muted);padding:0 4px}
.brand-size-options{display:flex;flex-wrap:wrap;gap:8px}
.brand-size-options label{display:flex;align-items:center;gap:6px;margin:0;padding:7px 10px;border:1px solid var(--line);border-radius:8px;font-size:14px;font-weight:400;cursor:pointer}
.brand-size-options input{width:16px;height:16px;margin:0;accent-color:#23783e;flex:none}
.brand-size-options label:has(:checked){background:var(--soft);border-color:var(--brand)}
.brand-size-reset{margin-top:10px;background:var(--soft);color:var(--brand-dark);padding:6px 10px;font-size:14px}
.brand-size-summary{margin:10px 0;color:var(--muted);font-size:14px;overflow-wrap:anywhere}
.swatch-variant{display:grid;gap:2px;border-top:1px solid var(--line);margin-top:4px;padding-top:4px}
.swatch-variant>span:first-child{font-weight:600}
.swatch-sku{color:var(--muted);overflow-wrap:anywhere}
.brand-body[hidden],.brand-sizes[hidden],.brand-size-summary[hidden]{display:none}
@media(max-width:480px){.brand-header{gap:6px;padding:8px}.brand-tools{gap:4px}.brand-option{padding:6px;font-size:13px}}

/* Личные настройки сцены открываются влево от инструментов и не выходят за экран телефона. */
.scene-control{position:relative}.scene-tool{display:grid;place-items:center;width:44px;height:44px;padding:0;background:white;color:var(--ink);border:1px solid var(--line)}
.scene-panel{position:absolute;right:52px;top:0;width:220px;padding:12px;background:white;border:1px solid var(--line);border-radius:12px;box-shadow:0 6px 25px #0002;z-index:6}
.scene-panel[hidden],.background-actions button[hidden]{display:none}.scene-panel label{margin:0 0 8px;font-size:16px}.temperature-labels{display:flex;justify-content:space-between;font-size:14px}.temperature-labels span:first-child{color:#996934}.temperature-labels span:last-child{color:#48799b}
#light-temperature{padding:0;margin:12px 0;accent-color:var(--brand);height:28px}#light-value{display:block;text-align:center;font-size:14px}.scene-panel p{font-size:13px;margin:8px 0 0}.background-actions{display:flex;gap:6px;margin-top:10px}.background-actions button{font-size:14px;padding:8px;min-height:40px}#background-delete{background:#fbe9e9;color:#a02828;font-size:24px;line-height:1;min-width:40px}

/* Нативное поле файла скрыто: выбор запускается только кнопкой в панели. */
#background-file[hidden]{display:none}

/* Нулевая точка между оттенками одновременно служит кнопкой точного сброса. */
.temperature-labels{align-items:center}.temperature-labels #light-zero{padding:0 8px;min-width:28px;height:28px;line-height:26px;border:1px solid var(--line);background:var(--soft);color:var(--ink);font-weight:600}

/* Скрываем только название и номер оттенка, сохраняя изображение и остальные подписи. */
.swatch-caption .swatch-color[hidden]{display:none}

/* Номер оттенка и его название занимают отдельные строки и при возврате скрытой подписи. */
.swatch-caption .swatch-color{display:grid;gap:2px}
.swatch-caption .swatch-color[hidden]{display:none}

/* Красный крестик остаётся на углу кнопки фона, не создавая вложенной кнопки. */
#background-clear{position:absolute;right:-4px;top:29px;z-index:2;display:grid;place-items:center;width:21px;height:21px;min-height:0;padding:0;border-radius:50%;border:2px solid white;background:#d92535;color:white;font:700 18px/1 sans-serif}
#background-clear[hidden]{display:none}

/* Миниатюрный индикатор не занимает отдельную строку панели инструментов. */
#light-toggle{position:relative}
#light-badge{position:absolute;right:-6px;bottom:-4px;display:flex;align-items:center;justify-content:center;min-width:25px;height:17px;padding:0 3px;border:1px solid white;border-radius:7px;background:#fff0d6;color:#975005;font:700 10px/1 "Segoe UI",sans-serif;pointer-events:none}
#light-badge[data-temperature="cold"]{background:#e2f3ff;color:#185f9a}
#light-badge[hidden]{display:none}

/* Миниатюра не перехватывает события в скрытом состоянии; анимация только opacity/transform. */
#mini-preview{position:fixed;right:max(14px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom));z-index:10;width:120px;padding:4px;border:1px solid var(--line);border-radius:12px;background:white;color:var(--ink);box-shadow:0 5px 24px #142b4733;opacity:0;visibility:hidden;transform:translateY(16px) scale(.92);pointer-events:none;transition:opacity .24s ease,transform .24s ease,visibility 0s linear .24s}
#mini-preview.is-visible{opacity:1;visibility:visible;transform:translateY(0) scale(1);pointer-events:auto;transition:opacity .24s ease,transform .24s ease,visibility 0s}
#mini-preview canvas{width:100%;border-radius:8px}#mini-preview span{display:block;font:600 12px/1.5 "Segoe UI",sans-serif;padding-top:2px}
@media(max-width:700px){#mini-preview{width:96px}}
@media(prefers-reduced-motion:reduce){#mini-preview,#mini-preview.is-visible{transition:none;transform:none}}

/* Управление подгонкой находится сразу под фото и одинаково доступно мышью и пальцем. */
.photo-fit{min-width:0}.photo-zoom{display:flex;justify-content:center;align-items:center;gap:16px;margin-top:12px}.photo-zoom button{width:48px;height:48px;padding:0;font-size:28px;line-height:1}.photo-zoom output{min-width:60px;text-align:center;font-weight:600}.photo-zoom-slider{margin:12px 0}.photo-fit #fit-hint{font-size:14px;color:var(--muted)}
#fit{touch-action:none;user-select:none;cursor:default}#fit.has-photo{cursor:grab}#fit.is-dragging{cursor:grabbing}

/* Готовая подборка показана настоящим JPEG: стандартное меню браузера остаётся доступным. */
/* Постоянная высота соответствует исходному кадру1600×2000 при ширине480: максимум600px.
   Узкий экран:90vw после боковых полей5%+5%, минус44px панели и8px зазора; коэффициент2000/1600.
   Размер bitmap больше не влияет на поток: и Canvas, и JPG целиком вписаны в одну рамку. */
.selection-preview{position:relative;height:min(600px,calc((90vw - 52px)*1.25))}
.selection-preview>canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
.selection-preview #selection-image{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:block;-webkit-touch-callout:default;user-select:auto}
.selection-preview #selection-image[hidden]{display:none}

/* Стандартные фоны. */
.scene-presets{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin:10px 0}.scene-presets button{min-width:0;min-height:42px;padding:5px 3px;background:#f1f4f8;color:var(--ink);border:1px solid var(--line);font-size:12px}.scene-presets button[aria-pressed=true]{background:#dcecff;border-color:var(--brand);color:var(--brand-dark);font-weight:700}.scene-panel:has(.scene-presets){width:258px}

/* Миниатюры стандартных и личного фона находятся в одной панели, не шире мобильного экрана. */
.scene-presets{grid-template-columns:repeat(2,minmax(0,1fr))}
.scene-presets button{min-height:76px;font-size:14px;padding:6px}
.scene-presets button[hidden]{display:none}
.background-sample,#custom-background-preview{display:block;width:100%;height:32px;margin-bottom:4px;border:1px solid #c9d3df;border-radius:4px;object-fit:cover}
.sample-studio{background:linear-gradient(135deg,#f6f7f9,#dce2ea)}
.sample-white{background:white}.sample-warm{background:linear-gradient(135deg,#faf8f4,#e3dbd1)}
.scene-panel:has(.scene-presets){width:min(258px,calc(100vw - 92px));max-height:60vh;overflow-y:auto}
.background-actions button{min-height:44px}#background-delete{min-width:44px}

/* Миниатюры показывают два предоставленных владельцем задника с версией суточного кэша. */
.background-sample{background-size:cover;background-position:center}
.sample-light{background-image:url('/studio-backgrounds/light-wall-v2.jpg?v=8bb226fa2737191a56f456b1cc8112626d98e88811655b96a9533c6a34cd1b27')}
.sample-dark{background-image:url('/studio-backgrounds/dark-wall-v2.jpg?v=76af719d1ddb9a0ef795cb5304ee503ff099a72453817b84dc10d275fe675d8b')}

/* Пять компактных карточек помещаются в три ряда без внутренней прокрутки. */
.display-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;margin-top:8px}
.display-options button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:64px;padding:5px 3px;margin:0;font-size:11px;line-height:1.15;color:var(--ink);background:#f5f8fc;border:1px solid #dce5ef;border-radius:9px}
.display-options button:hover{background:#eaf3ff;border-color:#94bce9}
.display-options button[aria-pressed=true]{border-color:var(--brand);background:#e4efff;color:var(--brand-dark);box-shadow:inset 0 0 0 1px var(--brand)}
.display-options .display-mode-icon{display:block;width:52px;height:40px;object-fit:contain;flex-shrink:0}
.display-options span{max-width:100%;overflow-wrap:normal}
#display-panel{width:min(248px,calc(100vw - 92px));padding:10px;overflow:visible}
/* На низком экране ещё уменьшаем рисунки, сохраняя площадь нажатия не менее 44 px. */
@media(max-height:520px){.display-options button{min-height:46px;flex-direction:row;font-size:10px;gap:3px}.display-options .display-mode-icon{width:32px;height:28px}#display-panel{position:fixed;top:8px;right:60px}.display-options{gap:4px;margin-top:5px}}

#tile-mode[hidden]{display:none}

/* Две половины переключателя органик справа от отображения, без расширения мобильной панели. */
@media(min-width:701px){.preview-tools.has-organic-variants{grid-template-columns:minmax(0,480px) 96px}}
#organic-variants{position:absolute;left:52px;top:0;display:grid;grid-template-rows:1fr 1fr;width:44px;height:44px;border:1px solid var(--line);border-radius:9px;background:white;overflow:hidden}
#organic-variants[hidden]{display:none}
#organic-variants button{display:grid;place-items:center;padding:0;min-width:0;min-height:0;border-radius:0;background:white;color:#71869e;border:0}
#organic-variants button+button{border-top:1px solid var(--line)}
#organic-variants button[aria-pressed=true]{background:#dcecff;color:var(--brand-dark)}
#organic-variants svg{width:20px;height:20px}
@media(max-width:700px){
 #organic-variants{left:auto;right:-4px;top:-5px;width:23px;height:54px;overflow:visible;gap:8px;border:0;background:transparent}
 #organic-variants button{width:23px;height:23px;border:2px solid white;border-radius:50%;box-shadow:0 0 0 1px var(--line);background:#edf5ff;color:#71869e}
 #organic-variants button+button{border:2px solid white}
 #organic-variants button[aria-pressed=true]{background:var(--brand);color:white}
 #organic-variants svg{width:17px;height:17px}
}

/* Органик использует общую кнопку перемешивания рядом с двухчастным переключателем. */
@media(min-width:701px){.preview-tools.has-organic-variants.has-ceiling-shuffle{grid-template-columns:minmax(0,480px) 148px}.has-organic-variants #ceiling-shuffle{left:104px}}
/* Правые углы заняты вариантами гирлянды; перемешивание — у нижнего левого угла основной иконки. */
@media(max-width:700px){.has-organic-variants #ceiling-shuffle{left:-4px;right:auto;top:29px}}

/* Количество единственного цвета рядом с плашкой: числовая клавиатура и диапазон1..19. */

/* Числа находятся под изображением в собственной строке, поэтому не попадают в JPG/PNG и не закрывают фото. */
.preview-tools aside{grid-column:2;grid-row:1}
#bundle-counts{grid-column:1;grid-row:2;display:flex;justify-content:center;flex-wrap:wrap;gap:8px 7px;padding:4px 4px 10px}
#bundle-counts[hidden]{display:none}
.bundle-count{position:relative;display:inline-flex}
.bundle-count>button[data-bundle-count]{width:34px;height:34px;padding:0;border:1px solid var(--line);border-radius:8px;background:white;color:var(--ink);font-size:14px;line-height:1}
.bundle-count>button[aria-pressed=true]{background:var(--brand);border-color:var(--brand);color:white}
.bundle-count .bundle-shuffle{position:absolute;right:-5px;bottom:-6px;width:21px;height:21px;padding:2px;border:2px solid white;border-radius:50%;background:var(--brand);color:white;display:grid;place-items:center;z-index:1}
.bundle-shuffle svg{width:13px;height:13px}.bundle-count .bundle-shuffle[hidden]{display:none}
.bundle-count button:focus-visible{outline:2px solid var(--brand-dark);outline-offset:3px}
@media(max-width:700px){#bundle-counts{gap:9px 7px}.bundle-count>button[data-bundle-count]{width:36px;height:36px}}

/* Пустое сообщение не оставляет место от временно скрытой панели поиска; ошибки остаются видимыми. */
#status:empty{display:none}

/* Индикатор не занимает места в потоке, не перекрывает нажатия и не попадает в экспорт Canvas. */
#scene-loading{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:2;width:42px;height:42px;padding:8px;display:grid;place-items:center;border-radius:50%;background:#fffffff0;box-shadow:0 2px 12px #142b4733;pointer-events:none}
#scene-loading[hidden]{display:none}
#scene-loading>span{width:26px;height:26px;border:3px solid #dce7f5;border-top-color:var(--brand);border-radius:50%;animation:scene-spin .8s linear infinite}
@keyframes scene-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){#scene-loading>span{animation:none}}

/* Две постоянные строки сохраняют положение каталога при добавлении/удалении цветов.
   Число колонок увеличивается после восьмой позиции; текст подгоняется по доступной высоте/ширине. */
#composition{display:grid;grid-template-columns:repeat(var(--selection-columns,4),minmax(0,120px));grid-template-rows:repeat(2,44px);height:94px;min-height:94px;align-content:start;align-items:stretch}
#composition button[data-selection-index]{min-width:0;width:100%;height:44px;padding:4px 6px;font-size:var(--selection-font,14px);line-height:1.1;overflow:hidden;overflow-wrap:anywhere}
/* Значок расположен у нижнего правого угла самой картинки миниатюры, над подписью «Наверх». */
#mini-shuffle{position:fixed;right:max(10px,calc(env(safe-area-inset-right) - 4px));bottom:calc(max(14px,env(safe-area-inset-bottom)) + 22px);z-index:11;width:25px;height:25px;padding:3px;border:2px solid white;border-radius:50%;background:var(--brand);color:white;box-shadow:0 1px 5px #142b4733}
#mini-shuffle[hidden]{display:none}#mini-shuffle svg{display:block;width:15px;height:15px}
/* Первый выбор использует то же меню; после выбора обычная геометрия панели восстанавливается. */
.preview-tools{position:relative}
.first-display .selection-preview>canvas,.first-display #selection-image{visibility:hidden!important}
.first-display #bundle-counts{visibility:hidden}
.first-display #mini-preview,.first-display #mini-shuffle{display:none!important}
.first-display #display-panel{position:fixed!important;right:auto;z-index:8;max-width:calc(100vw - 90px);border-color:#d6e3f4;box-shadow:0 12px 35px #17365324}
.first-display #display-toggle{color:#2476ff;background:#eaf2ff;border-color:#96baff;box-shadow:0 0 0 3px #2476ff14}
.first-display #display-panel>strong{font-size:17px}
.welcome-hint{margin:3px 0 10px;color:#647a96;font-size:12px;line-height:1.35}
#welcome-tail{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:7}
