/* ═══════════════════════════════════════════════════════════════
   Studio — проект креатора: слева референсы (персонажи · места · объекты),
   в центре дубли текущего клипа, справа клипы фильма, снизу биты клипа по таймлайну и композер.
   ═══════════════════════════════════════════════════════════════ */
.studio{display:flex;flex-direction:column;height:calc(100dvh - var(--tab));min-height:0;position:relative}
/* два состояния: список проектов и открытый проект */
.studio:not(.open) > :not(.st-list){display:none}
.studio.open .st-list{display:none}
.st-list{flex:1;overflow:auto;scrollbar-width:none;padding:calc(env(safe-area-inset-top) + 16px) var(--pad) 24px}
.st-list .head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.st-list .head h1{font-size:22px}
.st-projs{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
.st-proj{position:relative;aspect-ratio:3/2;border-radius:16px;overflow:hidden;cursor:pointer}
.st-proj .st{position:absolute;inset:0;display:grid;grid-template-columns:2fr 1fr;grid-template-rows:1fr 1fr;gap:3px}
.st-proj .st i:first-child{grid-row:1/3}
.st-proj .nm{position:absolute;left:0;right:0;bottom:0;padding:28px 14px 12px;font-weight:700;color:#fff;background:linear-gradient(#0000,#0c0217e6);opacity:0;transform:translateY(6px);transition:opacity .2s,transform .2s}
.st-proj:hover .nm,.st-proj:focus-within .nm{opacity:1;transform:none}
.st-proj .nm small{display:block;font-size:12px;color:var(--dim);font-weight:500;margin-top:2px}
.st-proj .x{position:absolute;right:10px;top:10px;width:28px;height:28px;padding:0;border-radius:50%;background:#0c0217cc;border:1px solid var(--line);color:var(--dim);display:grid;place-items:center;opacity:0;transition:opacity .15s;cursor:pointer}
.st-proj:hover .x{opacity:1}
.st-proj .x:hover{color:#fff;border-color:#ff6b5c}
.st-proj .x svg{display:block;width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.st-proj.new{border:1px dashed var(--line);display:grid;place-items:center;align-content:center;gap:4px;color:var(--dim);text-align:center;font-size:13px;transition:border-color .15s,color .15s}
.st-proj.new:hover{border-color:var(--dim);color:#fff}
.st-proj.new b{font-size:24px;line-height:1;font-weight:400;margin-bottom:4px}
.st-proj.new small{display:block;font-size:11px}
/* библиотека на главной: группы по видам, «+ New» первой плиткой */
.st-lib{margin-top:26px;display:grid;gap:18px}
.st-lib h4{margin:0 0 8px;font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--dim)}
.st-lib .row{display:flex;gap:8px;flex-wrap:wrap}
.st-list .st-lib .m{width:100px;height:100px}   /* специфичнее общего .studio .m */
.core.in > .studio{animation:none}      /* экран сразу на месте: без въезда и мигания скролла */
html.lock{overflow:hidden}
.studio .g0{background:linear-gradient(135deg,#f7b733,#fc4a1a)}.studio .g8{background:linear-gradient(135deg,#7b2ff7,#ff2fd0)}.studio .g2{background:linear-gradient(135deg,#22c1c3,#fdbb2d)}

/* ── референсы: на ПК колонка, на мобилке ряд сверху ── */
.st-cast{flex:none;padding:10px var(--pad) 8px;display:flex;gap:12px;overflow:auto;scrollbar-width:none}
.st-cast h4{display:none}
.st-cast .pname{display:none}   /* название проекта: на пк в левой колонке, правится на месте */
.st-cast .ms{display:block}
.st-cast .row{display:flex;gap:8px}
.studio .m{display:flex;flex-direction:column;gap:4px;align-items:center;justify-content:center;width:64px;height:64px;flex:none;border-radius:14px;border:2px dashed var(--line);font-size:12px;color:var(--dim);cursor:pointer;white-space:nowrap;overflow:hidden;transition:border-color .15s,color .15s}
.studio .m:hover{border-color:var(--dim);color:#fff}
.studio .m i{font-style:normal;font-size:16px;line-height:1}
.studio .m span{transition:opacity .15s,height .2s}
.studio .m.ref{border:0;justify-content:flex-end;padding-bottom:6px;color:#fff;font-weight:600;text-shadow:0 1px 4px #000c;position:relative}
.studio .m.ref .x{position:absolute;right:4px;top:4px;width:20px;height:20px;padding:0;border-radius:50%;background:#0c0217cc;border:1px solid var(--line);color:var(--dim);display:grid;place-items:center;opacity:0;transition:opacity .15s;cursor:pointer}
.studio .m.ref:hover .x{opacity:1}
.studio .m.ref .x:hover{color:#ff6b5c}
.studio .m.ref .x svg{display:block;width:11px;height:11px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* ── центр: дубли · язычок · биты · низ ── */
.st-work{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}
/* дубли текущего клипа: последний сверху, скролл вниз — прошлые попытки; выбранный идёт в фильм */
.studio .stage{flex:1;min-height:0;overflow:auto;scrollbar-width:none;mask-image:linear-gradient(#0000,#000 16px,#000 calc(100% - 32px),#0000);display:grid;gap:10px;align-content:start;justify-items:center;padding:12px var(--pad) 16px;container-type:size}
.studio ::-webkit-scrollbar,.studio::-webkit-scrollbar,.st-char ::-webkit-scrollbar{display:none}   /* каретки в Studio не показываем */
/* размер от формата (--ar = w/h): высота — сколько влезает, ширина от неё. Плавно тянется сам формат, а не размеры —
   тогда с раскрытием бита плашка ужимается синхронно, без догоняющей анимации */
@property --ar{syntax:"<number>";inherits:true;initial-value:1}
.st-take{position:relative;--h:min(100cqh - 10px,calc(100cqw / var(--ar)));height:var(--h);width:calc(var(--h) * var(--ar));flex:none;border-radius:16px;background:var(--panel);border:1px solid var(--line);display:grid;place-items:center;cursor:pointer;overflow:hidden;transition:border-color .15s,--ar .3s cubic-bezier(.4,0,.2,1)}
.st-take .st-vp{position:absolute;inset:0}
/* свой плеер: панель снизу по наведению; play/pause и звук — пары иконок, видимая по классу обёртки */
.st-vp video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;background:#000}
/* большая кнопка play по центру, пока видео стоит */
.st-vp .big{position:absolute;left:50%;top:50%;width:64px;height:64px;margin:-32px 0 0 -32px;border-radius:50%;border:1px solid #ffffff40;background:#0c0217b3;backdrop-filter:blur(6px);color:#fff;display:grid;place-items:center;cursor:pointer;padding:0;transition:opacity .2s,transform .2s}
.st-vp .big svg{width:24px;height:24px;fill:#fff;stroke:none;margin-left:3px}
.st-vp.playing .big{opacity:0;transform:scale(.8);pointer-events:none}
.st-vp .ctl{position:absolute;left:0;right:0;bottom:0;display:flex;align-items:center;gap:10px;padding:26px 12px 10px;background:linear-gradient(#0000,#05000ae6);opacity:0;transition:opacity .2s}
.st-vp:hover .ctl,.st-vp:not(.playing) .ctl{opacity:1}
.st-vp .ctl button{width:30px;height:30px;padding:0;border-radius:50%;border:1px solid #ffffff2e;background:#0c0217b3;color:#fff;display:grid;place-items:center;cursor:pointer;flex:none}
.st-vp .ctl button:hover{border-color:#fff}
.st-vp .ctl svg{display:block;width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.st-vp .ctl [data-pp] svg{fill:#fff;stroke:none}
.st-vp .ctl [data-pp] svg+svg,.st-vp.playing .ctl [data-pp] svg:first-child{display:none}
.st-vp.playing .ctl [data-pp] svg+svg{display:block}
.st-vp .ctl [data-mute] svg+svg,.st-vp.muted .ctl [data-mute] svg:first-child{display:none}
.st-vp.muted .ctl [data-mute] svg+svg{display:block}
.st-vp .t{font:700 11px var(--mono);color:#fff;font-variant-numeric:tabular-nums;white-space:nowrap}
.st-vp .line{flex:1;height:14px;display:flex;align-items:center;cursor:pointer}
.st-vp .line::before{content:"";position:absolute;left:0;right:0;height:3px;border-radius:2px;background:#ffffff30}
.st-vp .line{position:relative}
.st-vp .line b{position:relative;display:block;height:3px;border-radius:2px;background:linear-gradient(90deg,var(--acc2),var(--acc));width:0}
/* дубль во весь экран: видео в своём формате, чёрный фон, клик мимо — закрыть */
.st-full{position:fixed;inset:0;z-index:40;background:#000;display:grid;place-items:center;cursor:zoom-out}
.st-full .st-vp{position:relative;height:100dvh;max-width:100vw;aspect-ratio:var(--ar,9/16);cursor:default}
.st-full .st-vp video{object-fit:contain}
.st-beat.play{border-color:var(--acc)}   /* бит, который сейчас играет в дубле */
.studio .tl>.st-beat.play::before{background:var(--acc);box-shadow:0 0 0 2px var(--acc)}
.st-take .wait{display:grid;justify-items:center;gap:10px}
.st-take .wait small{font:700 12px var(--mono);color:var(--dim);font-variant-numeric:tabular-nums}
.st-take .spin{width:26px;height:26px;border:2px solid #ffffff30;border-top-color:#fff;border-radius:50%;animation:st-spin .8s linear infinite}
.st-take.fail{border-color:#ff6b5c66}
.st-take small{color:#ff6b5c;font-size:12px;padding:0 20px;text-align:center}
.st-take:hover{border-color:var(--dim)}
.st-take.view{border-color:#fff}
.st-take.on{border-color:var(--acc)}
.st-take>i{width:0;height:0;border-left:16px solid #ffffff60;border-top:10px solid transparent;border-bottom:10px solid transparent;margin-left:4px}
/* слева сверху: версия и галочка «в фильме»; справа сверху — корзина по наведению */
.st-take .hd{position:absolute;left:10px;top:10px;display:flex;align-items:center;gap:6px;z-index:1}   /* поверх видео */
.st-take b{height:28px;display:inline-flex;align-items:center;font-size:11px;color:#fff;background:#0009;border-radius:8px;padding:0 9px;font-weight:700}
.st-take .use{width:28px;height:28px;border-radius:50%;border:1px solid var(--line);background:#0c0217cc;color:var(--dim);display:grid;place-items:center;cursor:pointer;padding:0;transition:background .15s,border-color .15s,color .15s}
.st-take .use svg{display:block;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.st-take .use:hover{color:#fff;border-color:var(--dim)}
.st-take.on .use{color:#fff;background:var(--acc);border-color:var(--acc)}
/* удалить: × по наведению у дубля и клипа, ссылка Remove beat в раскрытом бите */
.st-take .x,.st-clip .x{position:absolute;right:8px;bottom:8px;width:24px;height:24px;border-radius:50%;background:#0c0217cc;border:1px solid var(--line);color:var(--dim);font-size:11px;display:grid;place-items:center;opacity:0;transition:opacity .15s;cursor:pointer}
.st-take .x{right:10px;top:10px;bottom:auto;width:28px;height:28px;padding:0;z-index:1}
.st-take .x svg{display:block;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.st-take:hover .x,.st-clip:hover .x{opacity:1}
.st-take .x:hover,.st-clip .x:hover{color:#fff;border-color:#ff6b5c}
.st-clip .x{right:6px;top:6px;bottom:auto;width:24px;height:24px;padding:0}
.st-clip .x svg{display:block;width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
/* удалить бит — корзина в заголовке слева от шеврона, только у раскрытого */
.st-beat .rm{width:28px;height:28px;border-radius:50%;border:1px solid var(--line);background:#0c0217cc;color:var(--dim);display:grid;place-items:center;cursor:pointer;padding:0;flex:none;opacity:0;pointer-events:none;transition:opacity .2s}
.st-beat.open .rm{opacity:1;pointer-events:auto}
.st-beat .rm svg{display:block;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.st-beat .rm:hover{color:#fff;border-color:#ff6b5c}
.st-take.empty{border-style:dashed;cursor:default}
.st-take.empty i{display:none}
.studio .handle{flex:none;height:22px;display:grid;place-items:center;cursor:pointer;color:var(--dim)}   /* без линии: биты лежат на фоне, держит их рейл */
.st-work.one .handle{display:none}
.studio .handle:hover{color:#fff}
.studio .handle::after{content:"";width:7px;height:7px;border-right:1.5px solid;border-bottom:1.5px solid;transform:rotate(45deg);margin-top:-4px;transition:transform .25s}
.st-work.hid .handle::after{transform:rotate(225deg);margin-top:4px}
.studio .tl{flex:none;max-height:340px;overflow:auto;scrollbar-width:none;padding:6px var(--pad) 0 calc(var(--pad) + 34px);display:flex;flex-direction:column;gap:8px;transition:max-height .28s cubic-bezier(.4,0,.2,1),padding .28s}
.studio .tl>*:first-child{margin-top:auto}   /* мало битов — прижаты к низу; много — обычный скролл, без пустого хвоста */
.studio .tl>*{flex:none}
/* рейл: точка у каждого бита, линия вниз к следующему и к композеру */
.studio .tl>*{position:relative}
.studio .tl>*::before{content:"";position:absolute;left:-30px;top:28px;width:10px;height:10px;box-sizing:border-box;margin-top:-5px;border-radius:50%;background:var(--line);border:2px solid var(--bg);box-shadow:0 0 0 2px var(--line);z-index:1}   /* у бита рамка 1px: точка и линия на 1px левее, чем у композера */
.studio .tl>*::after{content:"";position:absolute;left:-26px;top:28px;bottom:-8px;width:2px;background:var(--line)}   /* линия до точки следующего; bottom вместо height — не раздувает скролл таймлайна */
.studio .tl.scroll{mask-image:linear-gradient(#0000,#000 24px)}
.studio .tl>*:last-child::after{bottom:0}   /* хвост вниз рисует композер — иначе лишние пиксели скролла */
.studio .tl>.st-beat.open::before{background:var(--acc);box-shadow:0 0 0 2px var(--acc)}
.st-work.hid .tl{max-height:0;padding-top:0}
.st-tag{color:#fff;font-weight:600;white-space:nowrap}
.st-tag i{display:inline-block;width:11px;height:11px;border-radius:50%;vertical-align:-1px;margin:0 4px 0 1px}
.st-tag b{color:var(--acc);font-weight:700}
/* бит: таймкод · текст · шеврон; раскрытый — Duration / Location / Camera / Prompt */
.st-beat{display:grid;grid-template-columns:auto 1fr;gap:0 16px;align-items:center;background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:0 16px 0 18px;cursor:pointer;transition:background .15s,border-color .15s}
.st-beat:hover{background:var(--panel2)}
.st-beat.open{border-color:var(--acc);background:var(--panel2)}
.st-beat .tm{font-size:12px;color:#fff;font-weight:700;font-variant-numeric:tabular-nums;min-width:40px;align-self:start;line-height:56px}
.st-beat .body{display:grid;grid-template-columns:minmax(0,1fr);min-width:0}   /* minmax(0): шапка nowrap не растягивает колонку */
.st-beat .hd{display:flex;align-items:center;gap:12px;height:56px}
.st-beat .tx{flex:1;font-size:15px;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.st-beat .chev{width:7px;height:7px;border-right:1.5px solid var(--dim);border-bottom:1.5px solid var(--dim);transform:rotate(-45deg);margin-right:4px;transition:transform .2s,border-color .2s;flex:none}
.st-beat:hover .chev{border-color:#fff}
.st-beat.open .chev{transform:rotate(45deg);border-color:var(--acc)}
.st-beat .det{display:grid;grid-template-rows:0fr;transition:grid-template-rows .25s cubic-bezier(.4,0,.2,1)}
.st-beat.open .det{grid-template-rows:1fr}
.st-beat .det>div{overflow:hidden;min-height:0}
.st-beat .full{font-size:13px;line-height:1.6;color:#d9c6ff;border-top:1px solid var(--line);padding:12px 0 16px;display:grid;gap:8px;cursor:default}
.st-beat .full .kv{display:grid;grid-template-columns:72px 1fr;gap:10px;align-items:start}
.st-beat .full .kv>span{color:var(--dim);font-size:12px;line-height:34px}
.st-beat .full p{margin:0;background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:6px 10px;min-height:34px;cursor:text;outline:0}
.st-beat .full p:empty::before,.st-beat .full p::before{cursor:text}
.st-beat .full p:focus{border-color:#7b2ff7}
.st-beat .full .act{color:#fff;font-size:14px;min-height:64px;padding-bottom:30px}
.st-beat .full .pw{position:relative}
.st-beat .full .imp{position:absolute;right:8px;bottom:8px;color:var(--acc);font-weight:700;font-size:11px;border:1px solid #ff2fd055;border-radius:999px;padding:3px 9px;background:var(--bg);cursor:pointer}
.st-beat .full .imp:hover{background:#ff2fd022}
.st-beat .full .dur{display:flex;align-items:center;height:34px;color:#fff;font-size:13px;gap:10px;max-width:340px}
.st-beat .full .dur b{min-width:18px;text-align:right;font-weight:700;font-family:var(--mono);font-variant-numeric:tabular-nums}
/* дорожка и бегунок по доле --p; во время перетаскивания без анимации — шагает за курсором, после — прилипает плавно */
.st-beat .full .dur .track{position:relative;flex:1;min-width:120px;height:20px;display:flex;align-items:center;cursor:pointer;touch-action:none}
.st-beat .full .dur .track::before{content:"";position:absolute;left:0;right:0;height:4px;border-radius:2px;background:#ffffff1f}
.st-beat .full .dur .track i{position:absolute;left:0;height:4px;width:var(--p);border-radius:2px;background:linear-gradient(90deg,var(--acc2),var(--acc))}
.st-beat .full .dur .track em{position:absolute;left:var(--p);width:14px;height:14px;margin-left:-7px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #000a}
.st-beat .full .dur .track i,.st-beat .full .dur .track em{transition:width .15s cubic-bezier(.22,1,.36,1),left .15s cubic-bezier(.22,1,.36,1)}
.st-beat .full .dur .track.drag i,.st-beat .full .dur .track.drag em{transition:none}
.st-beat .full .dur .track.drag em{transform:scale(1.15)}
.st-beat .full .dur span{color:var(--dim);font-size:12px}
.st-beat .full .lc{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 10px;border-radius:10px;background:var(--bg);border:1px solid var(--line);color:#fff;font-size:12px;font-weight:600;cursor:pointer;justify-self:start}
.st-beat .full .lc:hover{border-color:var(--acc)}
.st-beat .full .lc.add{width:34px;padding:0;justify-content:center;background:none;border-style:dashed;color:var(--dim)}
.st-beat .full .lc i{width:11px;height:11px;border-radius:50%}
/* композер: всегда под битами; точка рейла пустая, линия вверх к последнему биту (свёрнуто — затухает: там есть тайминг) */
.st-comp{flex:none;padding:4px var(--pad) 14px calc(var(--pad) + 34px)}
.st-comp .comp{position:relative;display:flex;align-items:center;gap:8px;min-height:48px}
.st-comp .comp::before{content:"";position:absolute;left:-29px;top:50%;width:10px;height:10px;box-sizing:border-box;margin-top:-5px;border-radius:50%;background:var(--bg);border:2px solid var(--bg);box-shadow:0 0 0 2px var(--line);z-index:1}
.st-comp .comp::after{content:"";position:absolute;left:-25px;bottom:50%;height:28px;width:2px;background:var(--line);transition:background .3s}   /* до низа последнего бита: 24 до центра + 4 паддинга */
.st-work.hid .comp::after{background:linear-gradient(#0000,var(--line))}
.st-comp .comp.empty::after{display:none}
.st-add{display:inline-flex;align-items:center;gap:8px;height:36px;padding:0 22px 0 14px;border-radius:10px;border:1px dashed var(--line);color:var(--dim);font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap}
.st-add:hover{color:#fff;border-color:var(--dim)}
.st-add i{font-style:normal;font-size:16px;line-height:1}
.st-comp .sp{flex:1}
.st-comp .sep{width:1px;height:28px;background:var(--line);margin:0 6px}   /* выбираемое | запуск */
/* плашки параметров: модель · качество · формат · длина; попап над плашкой */
.st-p{display:inline-flex;align-items:center;gap:6px;height:36px;padding:0 12px;border-radius:10px;background:#ffffff0a;border:1px solid var(--line);font-size:12px;color:#fff;font-weight:600;cursor:pointer;white-space:nowrap;position:relative}
.st-p:hover{border-color:var(--dim)}
.st-p.on{border-color:var(--acc)}
.st-p small{color:var(--dim);font-weight:500;font-size:11px}
.st-pop{position:absolute;bottom:calc(100% + 8px);left:0;min-width:200px;max-height:240px;overflow:auto;scrollbar-width:none;background:#0e0320;border:1px solid var(--line);border-radius:12px;padding:0 6px 6px;box-shadow:0 16px 40px #000a;z-index:5;animation:st-in .18s ease-out;cursor:default}   /* не grid: sticky-шапку grid запирает в её ячейке; сверху без паддинга — шапка сама у потолка */
@keyframes st-in{from{opacity:0;transform:translateY(6px)}}
.st-pop div{display:flex;justify-content:space-between;gap:20px;padding:6px 10px;border-radius:8px;font-size:12px;font-weight:600;color:#fff;cursor:pointer}
.st-pop div+div{margin-top:2px}
.st-pop div:hover{background:#ffffff10}
.st-pop div.on{background:#ff2fd014;color:var(--acc)}
.st-pop div small{color:var(--dim);font-weight:500;display:inline-flex;align-items:center;gap:6px}
.st-pop div.off{opacity:.35;pointer-events:none}
.st-pop .cq{width:auto;margin:0;min-width:56px;justify-content:center}
.st-pop .rate{min-width:56px;justify-content:center}   /* колонки под шапку */
/* шапка списка моделей: подписи колонок над точками и ценой */
.st-pop .hdr{position:sticky;top:0;margin:0 -6px;background:#0e0320;padding:13px 15px 4px;font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:#6b5a8a;cursor:default}
.st-pop .hdr:hover{background:#0e0320}
.st-pop .hdr b{color:#6b5a8a;font-weight:600}
.st-pop .hdr small{color:#6b5a8a}
.st-pop .hdr span{min-width:56px;text-align:center}
.st-comp .btn{height:36px;padding:0 18px;font-size:13px;border-radius:10px;box-shadow:none}
.st-comp .btn.ghost{border-radius:10px}

/* ── клипы фильма: справа колонкой, последний сверху; на мобилке ряд снизу ── */
.st-clips{flex:none;display:flex;gap:8px;padding:10px var(--pad);overflow:auto;scrollbar-width:none}
.st-clip{position:relative;width:96px;aspect-ratio:16/9;flex:none;border-radius:10px;background:var(--panel);border:1px solid var(--line);cursor:pointer;transition:border-color .15s}
.st-clip:hover{border-color:var(--dim)}
.st-clip.on{border-color:var(--acc)}
.st-clip.drop{border-color:var(--acc);background:#ff2fd014}
.st-clip b{position:absolute;left:8px;top:6px;font-size:12px;color:#fff}
.st-clip small{position:absolute;right:8px;bottom:6px;font-size:11px;color:var(--dim)}
.st-clip .cont{position:absolute;left:-8px;top:50%;width:8px;height:2px;margin-top:-1px;background:var(--line)}   /* связка с предыдущим клипом: старт с его последнего кадра */
.st-clip.add{border-style:dashed;display:grid;place-items:center;color:var(--dim);font-size:18px;background:none}
.st-clip.add:hover{color:#fff}

/* ── пикер референсов: по @ в промпте или по плашке локации ── */
.studio .pick{position:absolute;z-index:10;background:#0e0320;border:1px solid var(--line);border-radius:12px;padding:6px;display:none;gap:2px;box-shadow:0 16px 40px #000a;width:200px}
.studio .pick.on{display:grid}
.studio .pick .o{display:flex;gap:8px;align-items:center;padding:6px 8px;border-radius:8px;cursor:pointer;font-size:13px;color:#fff}
.studio .pick .o:hover{background:#ffffff10}
.studio .pick .o i{width:22px;height:22px;border-radius:50%;flex:none}
.studio .pick .o span{color:var(--dim);font-size:11px;margin-left:auto}
.studio .pick .o i.img{border-radius:6px;background-size:200%;background-position:0 0;background-color:#000}   /* лицо анфас — первая ячейка коллажа */
.studio .pick .o i.img.place{background-size:auto 200%;background-position:-8px 0}
.studio .pick .o i.new{border-radius:6px;border:1px dashed var(--line);display:grid;place-items:center;font-style:normal;color:var(--dim);font-size:14px;line-height:1}

@media (min-width:900px){
  .studio{flex-direction:row;height:calc(100vh - 61px)}
  .st-list{padding:26px 40px 60px}
  .st-list .head h1{font-size:24px}
  .st-projs{grid-template-columns:repeat(4,1fr)}
  .st-cast{width:220px;padding:16px 14px;display:grid;gap:18px;align-content:start;overflow:hidden auto;scrollbar-width:none;transition:width .28s cubic-bezier(.4,0,.2,1),padding .28s}
  .st-cast .pname{display:block;font-size:16px;font-weight:700;color:#fff;outline:0;border-radius:6px;padding:2px 4px;margin:-2px -4px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:text}
  .st-cast .pname:hover{background:#ffffff08}
  .st-cast .pname:focus{background:#ffffff10;white-space:normal}
  .st-cast h4{display:block;margin:0 0 8px;font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--dim);white-space:nowrap}
  .st-cast .sec{min-width:0}
  .st-cast .ms>div{overflow:auto hidden;scrollbar-width:none;padding-bottom:2px}
  .st-cast .m{width:88px;height:88px}
  .studio .stage{padding:16px 24px}
  .studio .tl{padding:6px 24px 0 58px}
  .st-comp{padding:4px 24px 16px 58px}
  .st-clips{width:200px;flex-direction:column;gap:14px;padding:16px 14px}
  .st-clip{width:100%}
  .st-clip .cont{left:50%;top:auto;bottom:-14px;width:2px;height:14px;margin:0 0 0 -1px}
}

/* ── новый референс (персонаж / место): слева ввод и результат, справа карточка ── */
.mo-card.st-char{display:grid;gap:18px;max-height:calc(100dvh - 40px);overflow:auto;scrollbar-width:none}
.st-char .card{display:grid;gap:14px;font-size:15px;min-width:0}
.st-char h4{margin:0;font-size:12px;letter-spacing:.1em;text-transform:uppercase;color:#6b5a8a}
.st-char .thumb{width:100%;max-width:150px;aspect-ratio:1;border-radius:16px;border:2px dashed var(--line);background-size:200%;background-position:0 0}   /* первая ячейка 2×2 коллажа: лицо анфас / общий план */
.st-char .thumb.place,.st-char .thumb.object,.st-char .thumb.motion{max-width:200px;aspect-ratio:16/9}
/* @имя (персонаж) или 📍имя (место) — заголовок карточки под превью */
.st-char .title{display:flex;align-items:center;gap:4px;font-size:22px;font-weight:700;min-width:0}
.st-char .title .at{color:var(--acc)}
.st-char .title svg{width:20px;height:20px;fill:none;stroke:var(--acc);stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.st-char .title input{flex:1;min-width:0;background:none;border:0;outline:0;color:#fff;font:inherit}
.st-char .title input::placeholder{color:#6b5a8a}
.st-char .thumb.on{border:0}
.st-char .kv{display:grid;gap:8px}
.st-char .kv div{display:grid;grid-template-columns:72px 1fr;gap:10px;align-items:baseline;line-height:1.5}
.st-char .kv span{color:#6b5a8a}
.st-char .kv b{color:#fff;font-weight:500;padding:1px 4px;margin-left:-4px;border-radius:5px;outline:0;cursor:text}
.st-char .kv b:hover{background:#ffffff08}
.st-char .kv b:focus{background:#ffffff10}
.st-char .about{background:var(--panel2);border:1px solid var(--line);border-radius:11px;padding:11px 13px;color:#d9c6ff;line-height:1.55;align-self:start;outline:0;font-size:15px;cursor:text}
.st-char .about:empty::before{content:attr(data-ph);color:#6b5a8a;cursor:text}
.st-char .card .btn{width:100%;height:44px;padding:0;font-size:15px;border-radius:11px;box-shadow:none}
.st-char .card .btn:disabled{opacity:.35;cursor:default}
.st-char .main{display:grid;gap:12px;align-content:start;min-width:0;overflow:auto;scrollbar-width:none}   /* на низком экране скроллится; попап моделей открывается вниз внутри — не режется */
.st-char h3{margin:0;font-size:19px}
.st-char .st-pop{left:auto;right:0}   /* пилюля у правого края — попап к правому краю; в верхней зоне вниз (сверху места нет и .main его срежет), в нижней вверх */
.st-char .zone:first-of-type .st-pop{top:calc(100% + 8px);bottom:auto}
/* зона: заголовок → плашка (промпт, строка Reference + кнопка, референсы под ней) → результат */
.st-char .zone{display:grid;gap:10px}
.st-char .zone .hd{display:flex;align-items:center;gap:12px}
.st-char .src{background:var(--panel2);border:1px solid var(--line);border-radius:13px;padding:12px 14px;display:grid;gap:8px}
/* опросник: подпись слева, ответ справа; опциональный пункт пустой — серый и свёрнут, раскрывается плавно */
.st-char .form{display:grid}
.st-char .qa{display:grid;grid-template-columns:76px minmax(0,1fr);gap:14px;align-items:center;padding:8px 0;border-top:1px solid var(--line);min-height:41px}
.st-char .qa:first-child{border-top:0;padding-top:0;min-height:33px}
.st-char .qa:last-child{padding-bottom:0;min-height:33px}
.st-char .qa>span{font-size:13px;font-weight:600;color:var(--dim)}
.st-char .txt{color:#fff;font-size:15px;line-height:1.55;min-height:24px;outline:0;cursor:text}
.st-char .txt:empty::before{content:attr(data-ph);color:#6b5a8a;cursor:text}
.st-char .qa.opt>[data-tg]{cursor:pointer;user-select:none;white-space:nowrap;display:inline-flex;align-items:center;justify-self:start;text-align:left}   /* в колонке подписи, вровень с Who / Look */
.st-char .qa.opt.empty>[data-tg]{color:#6b5a8a}
.st-char .qa.opt>[data-tg]::after{content:"";width:5px;height:5px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg);margin-left:10px;transition:transform .15s}
.st-char .qa.opt.open>[data-tg]::after{transform:rotate(45deg) translate(-2px,-2px)}
.st-char .qa.opt .fold{display:grid;grid-template-rows:0fr;transition:grid-template-rows .25s cubic-bezier(.4,0,.2,1)}
.st-char .qa.opt .fold>div{overflow:hidden;min-height:0}
.st-char .qa.opt.open .fold{grid-template-rows:1fr}
.st-char .qa.opt .fold .ph,.st-char .qa.opt .fold>div>.smp,.st-char .qa.opt .fold>div>.ib{margin:2px 0}
.st-char .row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.st-char .row .sp{flex:1}
.st-char .row .st-p{height:40px;font-size:13px;padding:0 14px}   /* в ряд с кнопкой */
/* Audio тумблером; выключен — зона видна, но приглушена */
.st-char .sw{width:30px;height:18px;border-radius:999px;background:#ffffff14;border:1px solid var(--line);position:relative;cursor:pointer;transition:background .2s,border-color .2s}
.st-char .sw::after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:var(--dim);transition:left .2s,background .2s}
.st-char .sw.on{background:#ff2fd033;border-color:var(--acc)}
.st-char .sw.on::after{left:14px;background:var(--acc)}
.st-char .zone>*:not(.hd){transition:opacity .2s}
.st-char .zone.off>*:not(.hd){opacity:.55;pointer-events:none}
.st-char .ph{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.st-char .ph span{position:relative;width:48px;height:48px}
.st-char .ph img{display:block;width:100%;height:100%;border-radius:9px;object-fit:cover}
.st-char .ph .x{position:absolute;right:3px;top:3px;width:22px;height:22px;padding:0;border-radius:50%;background:#0c0217cc;border:1px solid var(--line);color:var(--dim);display:grid;place-items:center;opacity:0;transition:opacity .15s;cursor:pointer}
.st-char .ph span:hover .x{opacity:1}
.st-char .ph .x:hover{color:#fff;border-color:#ff6b5c}
.st-char .ph .x svg{display:block;width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.st-char .ph i.add{width:48px;height:48px;border-radius:9px;border:1.5px dashed var(--line);display:grid;place-items:center;font-style:normal;color:var(--dim);font-size:18px;line-height:1;cursor:pointer}
.st-char .ph i.add:hover{color:#fff;border-color:var(--dim)}
/* аудио: плашка с волной — образец, результат (res), ожидание (wait), пусто в карточке (none) */
.st-char .smp{display:inline-flex;align-items:center;gap:10px;height:40px;padding:0 12px 0 8px;border-radius:10px;background:#ffffff0a;border:1px solid var(--line);font-size:12px;color:var(--dim);font-weight:600}
.st-char .smp.res{border-color:var(--acc);background:#ff2fd010;color:#fff}
.st-char .smp.none{border-style:dashed;background:none;color:#6b5a8a}
.st-char .smp.clip b{color:#fff;font-weight:600;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}   /* ролик: имя файла · длительность */
.st-char .smp .pl{width:26px;height:26px;padding:0;border-radius:50%;background:linear-gradient(135deg,var(--acc2),var(--acc));display:grid;place-items:center;color:#fff}
.st-char .smp.none .pl{display:none}
.st-char .smp .pl svg{width:11px;height:11px;fill:#fff;stroke:none;display:block;margin-left:1px}
.st-char .smp .pl svg+svg,.st-char .smp.playing .pl svg:first-child{display:none}
.st-char .smp.playing .pl svg+svg{display:block;margin:0}
.st-char .wave{display:flex;align-items:center;gap:2px;height:18px}
.st-char .wave i{width:3px;border-radius:2px;background:var(--dim);display:block}
.st-char .smp.res .wave i{background:var(--acc)}
.st-char .smp.wait .wave i{background:linear-gradient(90deg,#ffffff10 25%,#ffffff28 50%,#ffffff10 75%) 0 0/200% 100%;animation:skel 1.4s linear infinite}
.st-char .smp .x{color:var(--dim);display:grid;place-items:center;width:22px;height:22px;padding:0;border-radius:50%;margin-left:2px}
.st-char .smp .x:hover{color:#ff6b5c}
.st-char .smp .x svg{display:block;width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.st-char .ib{display:inline-flex;align-items:center;gap:6px;height:36px;padding:0 12px;border-radius:9px;border:1.5px dashed var(--line);color:var(--dim);font-size:13px;font-weight:600;cursor:pointer}
.st-char .ib:hover{color:#fff;border-color:var(--dim)}
.st-char .ib svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.st-char .main .btn{height:40px;padding:0 16px;font-size:14px;border-radius:11px;box-shadow:none;white-space:nowrap}
.st-char .main .btn:has(.cost),.st-comp .btn:has(.cost){padding-right:14px}
.st-char .main .btn:disabled{opacity:.75;cursor:default}
.st-char .spin{display:inline-block;width:14px;height:14px;border:2px solid #ffffff55;border-top-color:#fff;border-radius:50%;vertical-align:-2px;margin-right:8px;animation:st-spin .8s linear infinite}
@keyframes st-spin{to{transform:rotate(360deg)}}
.st-char .err{font-size:13px;color:#ff6b5c}
/* результат визуала: персонаж — вкладки Full body / Face, место — Views */
.st-char .arts{display:flex;gap:10px;flex-wrap:wrap}
.st-char .art{display:grid;gap:6px}
.st-char .art b{font-size:13px;color:var(--dim);font-weight:600}
.st-char .col{width:100%;display:grid;grid-template-columns:repeat(4,1fr);gap:2px;border-radius:12px;overflow:hidden;background:#000;aspect-ratio:16/9;object-fit:cover;cursor:pointer}
.st-char .col.sq{grid-template-columns:1fr 1fr;aspect-ratio:1}
.st-char .col.views{grid-template-columns:1fr 1fr}
.st-char video.col{object-fit:contain;cursor:default}   /* клип движения как есть, вертикальный — с полями */
.st-char .col i{display:block}
.st-char .busy .col{gap:0;background:linear-gradient(90deg,#ffffff10 25%,#ffffff28 50%,#ffffff10 75%) 0 0/200% 100%;animation:skel 1.4s linear infinite}   /* одна волна на весь лист, как у плашки аккаунта */
.st-char .busy .col i{background:none;box-shadow:inset 0 0 0 1px #000}
.studio .m.ref.img{background-size:200%;background-position:0 0}   /* первая ячейка 2×2 коллажа: лицо анфас */
.studio .m.ref.img.place,.studio .m.ref.img.object,.studio .m.ref.img.motion{background-size:auto 200%;background-position:-25px 0}
/* узкая полоска «+» — когда в ряду уже есть плитки; большая Add — когда пусто */
.studio .m.slim{width:26px;padding:0;border-width:1.5px}   /* не .bar — он занят прогресс-баром в base */
.studio .m.slim span{display:none}
/* шторка библиотеки поверх рабочей области */
/* шторка выезжает из сайдбара; visibility — чтобы скрытая не ловила клики и фокус, на выходе прячется после перехода */
.st-sheet{position:absolute;left:210px;top:10px;bottom:10px;width:290px;scrollbar-width:none;background:#0e0320d9;backdrop-filter:blur(10px);border-radius:16px;padding:16px 14px;display:grid;gap:12px;align-content:start;z-index:12;box-shadow:0 16px 40px #0008;overflow:auto;scrollbar-width:none;opacity:0;visibility:hidden;transform:translateX(-16px);transition:opacity .2s,transform .28s cubic-bezier(.4,0,.2,1),visibility 0s .28s}
.st-sheet.on{opacity:1;visibility:visible;transform:none;transition:opacity .2s,transform .28s cubic-bezier(.4,0,.2,1)}
.st-sheet h4{margin:0;font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--dim)}
.st-sheet input{width:100%;height:36px;padding:0 12px;border-radius:10px;background:var(--panel2);border:1px solid var(--line);color:#fff;font-size:13px;outline:0}
.st-sheet input::placeholder{color:#6b5a8a}
.st-sheet .row{display:flex;gap:8px;flex-wrap:wrap}
.st-sheet .m{width:80px;height:80px;font-size:11px}
.st-sheet .m.cast{opacity:.45;cursor:default}
.st-sheet .m.cast .chk{position:absolute;right:5px;top:5px;width:18px;height:18px;border-radius:50%;background:var(--acc);color:#fff;font-size:11px;display:grid;place-items:center;font-style:normal}
@media (max-width:899px){.st-sheet{left:12px;right:12px;top:auto;bottom:12px;width:auto;max-height:60vh;transform:translateY(16px)}.st-sheet.on{transform:none}}   /* общий план 16:9 — по высоте, середина ячейки в плитке 64px */
@media (min-width:900px){
  .mo-card.st-char{width:min(1040px,100%);height:min(780px,calc(100dvh - 40px));grid-template-columns:minmax(0,1fr) 300px;gap:24px;padding:24px 26px;overflow:visible}   /* visible: попап моделей выходит за карточку */
  .st-char .card{grid-template-rows:auto auto auto auto auto 1fr auto;border-left:1px solid var(--line);padding-left:24px}
  .st-char .card.voice{grid-template-rows:auto auto auto auto auto 1fr auto auto auto}
  .st-char .col{height:140px;width:auto;max-width:100%}   /* фиксированная высота — под ней ещё зона Audio; ширину даёт формат */
}

/* ── коллаж крупно ── */
.mo.lb{z-index:36;align-items:center;padding:20px}
.mo-card.st-lb{width:max-content;max-width:100%;border-radius:18px;padding:10px;position:relative;overflow:hidden}
/* подпись и кнопки — поверх картинки снизу, по наведению */
.st-lb .hd{position:absolute;left:10px;right:10px;bottom:10px;border-radius:0 0 10px 10px;display:flex;align-items:center;gap:10px;padding:26px 14px 12px;font-size:13px;font-weight:700;
           background:linear-gradient(#0000,#05000ae6);opacity:0;transition:opacity .2s;pointer-events:none}
.mo-card.st-lb:hover .hd{opacity:1;pointer-events:auto}
.st-lb .acts{margin-left:auto;display:flex;gap:6px}
.st-lb .acts button{width:32px;height:32px;border-radius:9px;border:1px solid #ffffff2e;background:#0c0217cc;color:#fff;display:grid;place-items:center;cursor:pointer}
.st-lb .acts button:hover{border-color:#fff}
.st-lb .acts svg{display:block;width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.st-lb img{display:block;max-width:min(860px,calc(100vw - 80px));max-height:calc(100dvh - 120px);border-radius:10px;background:#000}
