/* «Новый ролик». Токены — из макета Claude Design (тёмная тема, стекло, моно-акцент). */
[data-theme=dark] {
  --app: #000; --chrome: rgba(10,10,10,.4); --panel: rgba(20,20,20,.5); --bg: rgba(255,255,255,.035);
  --sunk: #000; --raise: rgba(255,255,255,.08); --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.16);
  --fg: #f2f2f2; --dim: #a3a3a3; --faint: #6b6b6b;
  --warn: #e5b454; --warn-soft: rgba(229,180,84,.14); --bad: #ff6b5e; --bad-soft: rgba(255,107,94,.12);
  --acc: #f2f2f2; --acc-fg: #0a0a0a;
  --blur: blur(34px) saturate(1.6); --hl: inset 0 1px 0 rgba(255,255,255,.07); --amb-l: .4; --amb-o: .55;
  color-scheme: dark;
}
[data-theme=light] {
  --app: #f2f2f3; --chrome: rgba(255,255,255,.5); --panel: rgba(255,255,255,.58); --bg: rgba(0,0,0,.03);
  --sunk: #e6e6e8; --raise: rgba(0,0,0,.06); --line: rgba(0,0,0,.09); --line2: rgba(0,0,0,.17);
  --fg: #111; --dim: #5a5a5a; --faint: #8c8c8c;
  --warn: #9a6700; --warn-soft: rgba(154,103,0,.1); --bad: #d12b1f; --bad-soft: rgba(209,43,31,.08);
  --acc: #111; --acc-fg: #fff;
  --blur: blur(34px) saturate(1.8); --hl: inset 0 1px 0 rgba(255,255,255,.9); --amb-l: .82; --amb-o: .7;
  color-scheme: light;
}
:root { --acc-soft: color-mix(in oklab, var(--acc) 12%, transparent); --acc-line: color-mix(in oklab, var(--acc) 40%, transparent); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--app); color: var(--fg); font: 400 13px/1.4 'Onest', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--acc); text-decoration: none; }
[hidden] { display: none !important; }
::placeholder { color: var(--faint); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.mono { font-family: 'JetBrains Mono', monospace; }
.dim { color: var(--dim); } .faint { color: var(--faint); } .acc { color: var(--acc); }
.small { font-size: 11px; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; gap: 4px; }
.hint { font-size: 11.5px; color: var(--dim); }
.center-t { text-align: center; padding: 30px 0; }
.err { font-size: 12px; color: var(--bad); }

.btn { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); font-size: 12px; font-weight: 500; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--line2); }
.btn.icon { width: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
.btn.plus { width: 26px; height: 26px; font-size: 16px; font-weight: 400; }
.btn.soft { height: 30px; padding: 0 12px; border-color: var(--acc-line); background: var(--acc-soft); font-size: 12.5px; }
.btn.soft:disabled { opacity: .45; }
.inp { height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: 12px; outline: none; min-width: 0; }
.inp:focus { border-color: var(--line2); }
.sel { min-width: 150px; font-size: 12.5px; padding: 0 8px; }
/* Список выпадашки рисует браузер: без своего фона он белый, а текст — светлый из темы. */
select.inp { color-scheme: inherit; }
select.inp option { background: var(--app); color: var(--fg); }
[data-theme=dark] select.inp option { background: #141414; }
.link-dim, .link-acc { border: 0; padding: 0; background: none; font-size: 12px; }
.link-dim { color: var(--dim); height: 24px; align-self: flex-start; }
.link-dim:hover { color: var(--fg); }
.link-acc { color: var(--acc); font-weight: 500; }
.pills { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.pills button { height: 22px; min-width: 26px; padding: 0 8px; border: 0; border-radius: 4px; background: none; color: var(--dim); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.pills button.on { background: var(--raise); color: var(--fg); }
#nvar button { font-family: 'JetBrains Mono', monospace; padding: 0; }
.tag { padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); padding: 1px 6px; }
.tag.ok { background: var(--acc-soft); color: var(--acc); }
.tag.review { background: var(--raise); border: 1px solid var(--line2); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

/* ── каркас ─────────────────────────────────────────────────────────── */
.app { position: relative; isolation: isolate; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.ambient { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: var(--amb-o); transition: background .6s; }
.top { height: 46px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--chrome); backdrop-filter: var(--blur); }
.brand { display: flex; align-items: center; gap: 8px; margin-right: 16px; color: var(--fg); font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.brand i { width: 12px; height: 12px; border-radius: 3px; background: var(--acc); }
.nav { display: flex; gap: 2px; }
.nav a { padding: 5px 10px; border-radius: 6px; color: var(--dim); white-space: nowrap; }
.nav a:hover { color: var(--fg); }
.nav a.on { background: var(--raise); color: var(--fg); font-weight: 500; }
#spent { font-size: 12px; margin-right: 8px; }
#drawer-btn { margin-right: 8px; }
.theme-ico { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); color: var(--dim); }

.grid { flex: 1; min-height: 0; display: grid; position: relative; gap: 0 8px; padding: 8px;
  grid-template-columns: 300px minmax(0,1fr) 380px; grid-template-rows: minmax(0,1fr) auto;
  grid-template-areas: "left center right" "left center build"; }
.app[data-gallery] .grid { grid-template-columns: 500px minmax(0,1fr) 380px; }

.panel { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--panel); backdrop-filter: var(--blur); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--hl); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.p-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.p-head b { font-weight: 600; }
.p-tools { display: flex; gap: 6px; padding: 0 12px 10px; }
.p-tools .inp { flex: 1 1 140px; }
.p-tools.wrap { flex-wrap: wrap; padding: 0 14px 10px; }

/* ── исходники ──────────────────────────────────────────────────────── */
.sources { grid-area: left; position: relative; }
.app[data-gallery] .sources { display: none; }
.sources .scroll { padding: 0 12px 12px; }
.src-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px 8px; }
.card { display: flex; flex-direction: column; gap: 4px; min-width: 0; cursor: pointer; }
.cover { position: relative; aspect-ratio: 9/16; border-radius: 6px; overflow: hidden; outline: 1px solid transparent; outline-offset: 2px; background-size: 28px 28px; }
.card.on .cover { outline: 2px solid var(--acc); }
.cover video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.cover video.ok { opacity: 1; }
.cover .code { position: absolute; left: 5px; top: 5px; font: 500 9px 'JetBrains Mono'; color: rgba(255,255,255,.7); text-shadow: 0 1px 2px #000; }
.cover .dur { position: absolute; right: 4px; bottom: 6px; padding: 1px 4px; border-radius: 3px; background: rgba(0,0,0,.7); color: #fff; font: 500 10px 'JetBrains Mono'; }
.cover .prog { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: #fff; }
.card .nm { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dim); }
.card.on .nm { color: var(--fg); }
.card .res { font: 400 10px 'JetBrains Mono'; color: var(--faint); margin-top: -3px; }
.up .cover { background: var(--raise); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; }
.up.bad .cover { border: 1px dashed var(--bad); }
.up .big { font: 600 12px 'JetBrains Mono'; color: var(--acc); text-align: center; }
.up.bad .big { color: var(--bad); }
.up .sm { font-size: 10.5px; color: var(--dim); text-align: center; line-height: 1.25; }
.up .ubar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.up .ubar span { display: block; height: 100%; background: var(--acc); }
.up .x { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border: 0; background: none; color: var(--dim); font-size: 13px; padding: 0; }
.empty-drop { height: 100%; min-height: 220px; border: 1px dashed var(--line2); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--dim); cursor: pointer; }
.empty-drop:hover { border-color: var(--acc); color: var(--fg); }
.empty-drop span { width: 32px; height: 32px; border-radius: 8px; border: 1px solid currentColor; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.drop-over { position: absolute; inset: 6px; border: 1.5px dashed var(--acc); border-radius: 10px; background: var(--acc-soft); display: flex; align-items: center; justify-content: center; font-weight: 500; pointer-events: none; }
.scrim { display: none; }

/* ── превью ─────────────────────────────────────────────────────────── */
.center { grid-area: center; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 20px 12px; }
.stage { flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; }
.frame { position: relative; height: 100%; aspect-ratio: 9/16; max-width: 100%; border-radius: 14px; overflow: hidden; background: #050505; container-type: inline-size; box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0,0,0,.45); }
.frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame.result video { object-fit: contain; }
.nosrc { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #656c76; font: 400 3.4cqw 'JetBrains Mono'; background: repeating-linear-gradient(135deg, #0e1216 0 8px, #0b0e12 8px 16px); }
.f-label { position: absolute; left: 4cqw; top: 4cqw; font: 500 3cqw 'JetBrains Mono'; color: rgba(255,255,255,.7); text-shadow: 0 1px 2px #000; }
.f-result { position: absolute; right: 4cqw; top: 3.6cqw; padding: .6cqw 2cqw; border-radius: 1.2cqw; background: rgba(0,0,0,.65); color: #fff; font: 500 3cqw 'Onest'; }
/* Полоса размытия: на ролике она встаёт на место чужих субтитров, наши — поверх. */
.band { position: absolute; left: 0; right: 0; top: 71%; height: 11%; backdrop-filter: blur(2.2cqw); -webkit-backdrop-filter: blur(2.2cqw); mask: linear-gradient(transparent, #000 25%, #000 75%, transparent); pointer-events: none; }
.caps { position: absolute; left: 6%; right: 6%; top: 76.5%; transform: translateY(-50%); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1cqw 2cqw; pointer-events: none; }
.frame.result .band, .frame.result .caps { display: none; }
.cw { display: inline-block; white-space: nowrap; line-height: 1.1; paint-order: stroke fill; transition: transform .12s ease, color .12s, background .12s; }

.transport { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 6px; flex: none; }
.t-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.t-row .btn.icon { background: var(--panel); }
.timeline { position: relative; height: 30px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; overflow: hidden; }
.seg { position: absolute; top: 5px; bottom: 5px; min-width: 3px; background: var(--acc-soft); border: 1px solid var(--acc-line); border-radius: 3px; overflow: hidden; display: flex; align-items: center; padding-left: 3px; font: 500 9px 'JetBrains Mono'; color: var(--dim); }
.seg.on { background: var(--acc); border-color: var(--acc); color: var(--acc-fg); }
.head { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px; background: var(--fg); pointer-events: none; }
.ticks { display: flex; justify-content: space-between; font: 400 10px 'JetBrains Mono'; color: var(--faint); }

/* ── вкладки и настройки ────────────────────────────────────────────── */
.ptabs { display: none; grid-area: tabs; background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ptabs button { flex: 1; height: 44px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--dim); font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px; }
.ptabs i { font: normal 500 10px 'JetBrains Mono'; color: var(--faint); }
.app[data-ptab="0"] .ptabs [data-ptab="0"], .app[data-ptab="1"] .ptabs [data-ptab="1"], .app[data-ptab="2"] .ptabs [data-ptab="2"] { color: var(--fg); border-bottom-color: var(--acc); }

.right { grid-area: right; border-bottom: 0; border-radius: 12px 12px 0 0; }
.rtabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.rtabs button { height: 32px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--dim); font-weight: 500; }
.app[data-rtab=script] .rtabs [data-rtab=script], .app[data-rtab=design] .rtabs [data-rtab=design] { color: var(--fg); border-bottom-color: var(--acc); }
.r-body { padding: 14px 16px 16px; }
.tab-script, .tab-design { display: flex; flex-direction: column; }
.tab-script { gap: 12px; } .tab-design { gap: 20px; }
.tab-info { display: none; flex-direction: column; gap: 14px; }
.app[data-rtab=script] .tab-design, .app[data-rtab=design] .tab-script,
.app[data-rtab=info] .tab-script, .app[data-rtab=info] .tab-design { display: none; }
.app[data-rtab=info] .tab-info { display: flex; }
/* Колонки с прокруткой: блоки внутри не сжимаются — иначе список фраз обрезался до трёх. */
.tab-script > *, .tab-design > *, .tab-info > *, #ai-done > *, #plist-wrap > * { flex-shrink: 0; }
.only-view { display: none !important; }
.app[data-view] .rtabs .only-view { display: inline-block !important; }
.app[data-rtab=info] .rtabs [data-rtab=info] { color: var(--fg); border-bottom-color: var(--acc); }
#ai-idle, #ai-run, #ai-done, #plist-wrap { display: flex; flex-direction: column; gap: 8px; }
#ai-run { gap: 10px; }
#gen-nosrc { margin-top: -4px; }

.seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.seg2 button { height: 30px; border: 0; border-radius: 6px; background: none; color: var(--dim); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg2 button.on { background: var(--raise); color: var(--fg); box-shadow: 0 0 0 1px var(--line2); }
.seg2 .mono { font-size: 10.5px; }

.bar { height: 2px; background: var(--line); border-radius: 1px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--acc); transition: width .3s; }
.skel-tabs { display: flex; gap: 6px; }
.sk { background: var(--raise); border-radius: 3px; animation: pulse 1.8s ease-in-out infinite; }
.skel-tabs .sk { width: 76px; height: 26px; border-radius: 6px; }
@keyframes pulse { 50% { opacity: .45; } }

.vt { height: 28px; padding: 0 10px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--dim); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.vt.on { border-color: var(--line2); background: var(--raise); color: var(--fg); }
.vt .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.again { height: 28px; padding: 0 6px; border: 0; background: none; color: var(--dim); font-size: 12px; white-space: nowrap; }
.again:hover { color: var(--fg); }
.idea { font-weight: 600; font-size: 13.5px; text-wrap: pretty; }
.warn-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--warn); }

.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.ph { display: grid; grid-template-columns: 14px 70px minmax(0,1fr) 18px; gap: 6px; align-items: start; padding: 7px 8px; cursor: pointer; }
.ph + .ph { border-top: 1px solid var(--line); }
.ph.on { background: var(--acc-soft); }
.ph.drag { opacity: .4; }
.ph .grip { color: var(--faint); font-size: 10px; line-height: 19px; cursor: grab; letter-spacing: -2px; user-select: none; }
.ph .tc { font: 500 10.5px/19px 'JetBrains Mono'; color: var(--faint); white-space: nowrap; }
.ph.on .tc { color: var(--acc); }
.ph textarea { field-sizing: content; resize: none; border: 0; background: none; font-size: 13px; line-height: 19px; padding: 0; margin: 0; outline: none; width: 100%; min-height: 19px; overflow: hidden; }
.ph .del { width: 18px; height: 19px; border: 0; background: none; color: var(--faint); padding: 0; font-size: 14px; }
.ph .del:hover { color: var(--bad); }
.add { height: 32px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--dim); font-size: 12.5px; text-align: left; padding: 0 30px; }
.add:hover { color: var(--fg); }
.skel .ph { cursor: default; }
.counts { display: flex; gap: 12px; font-size: 11px; color: var(--dim); }

.block { display: flex; flex-direction: column; gap: 8px; }
.block.row { flex-direction: row; }
.b-head { display: flex; align-items: baseline; gap: 8px; }
.b-head b, .block > b, .block.row b { font-weight: 600; }
.b-head .dim { font-size: 12px; }
.voices { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.vc { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; min-width: 0; text-align: left; }
.vc b { display: block; font-weight: 600; font-size: 12.5px; }
.vc span { display: block; font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc.on, .chip.on { border-color: var(--acc); background: var(--acc-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line); background: var(--bg); font-size: 12px; }

.tiles { display: grid; gap: 10px 6px; }
.tiles.q4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.tiles.auto { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 14px 8px; }
.tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; cursor: pointer; }
.tile .pv { position: relative; aspect-ratio: 9/16; border-radius: 6px; overflow: hidden; container-type: inline-size; outline: 1px solid transparent; outline-offset: 2px; }
.tile.on .pv { outline: 2px solid var(--acc); }
.tile .words { position: absolute; left: 3%; right: 3%; top: 55%; transform: translateY(-50%); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1.5cqw 5cqw; }
.tile .id { font: 400 10.5px 'JetBrains Mono'; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiles.auto .tile .id { font-size: 11px; font-weight: 500; }
.tile.on .id { color: var(--fg); }
.tile .lb { font-size: 10.5px; line-height: 1.3; color: var(--dim); margin-top: -2px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.opt { padding: 9px 10px; border-radius: 8px; display: flex; flex-direction: column; gap: 3px; }
.opt b { font-weight: 600; font-size: 12.5px; }
.opt .mono { font-size: 11px; }
.opt.on { border: 1px solid var(--acc); background: var(--acc-soft); }
.opt.off { border: 1px dashed var(--line2); color: var(--dim); cursor: not-allowed; }
.opt em { font: normal 500 10.5px 'Onest'; margin-left: 6px; padding: 0 6px; border-radius: 9px; border: 1px solid var(--line2); }

.gallery { grid-area: left; display: none; z-index: 3; }
.app[data-gallery] .gallery { display: flex; }
.gallery .scroll { padding: 2px 14px 14px; }
.gallery .p-head { padding: 12px 14px 8px; }

/* ── сборка ─────────────────────────────────────────────────────────── */
.build { grid-area: build; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; padding: 12px 16px; gap: 8px; z-index: 2; overflow: visible; }
.go { height: 40px; border: 0; border-radius: 8px; background: var(--acc); color: var(--acc-fg); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.go:disabled { background: var(--raise); color: var(--faint); }
.go .dotsep { opacity: .55; }
.go .mono { font-weight: 700; }
.b-hint { font-size: 11.5px; color: var(--dim); }
.b-hint.warn { color: var(--warn); }
.stages { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.stages div { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.stages i { height: 4px; border-radius: 2px; background: var(--line); }
.stages span { font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stages .done i { background: var(--acc); }
.stages .now i { background: var(--acc); animation: pulse 1.4s ease-in-out infinite; }
.stages .done span, .stages .now span { color: var(--fg); }
.b-two { display: flex; gap: 6px; }
.b-two > * { flex: 1; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.b-two .main { border: 0; background: var(--acc); color: var(--acc-fg); font-weight: 600; }
.b-two .sec { border: 1px solid var(--line); background: var(--bg); color: var(--fg); font-weight: 500; }
.b-wide { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: none; font-size: 12.5px; font-weight: 500; }
.b-retry { height: 32px; padding: 0 16px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); font-size: 12.5px; font-weight: 500; }
.b-err { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.only-tablet { display: none; }

/* ── планшет ────────────────────────────────────────────────────────── */
@media (max-width: 1279px) and (min-width: 768px) {
  .only-tablet { display: inline-block; }
  .grid, .app[data-gallery] .grid { grid-template-columns: minmax(0,1fr) 360px; grid-template-areas: "center right" "center build"; }
  .sources { grid-area: center; width: 300px; display: none; z-index: 5; box-shadow: 12px 0 40px rgba(0,0,0,.5); }
  .app[data-drawer] .sources { display: flex; }
  .app[data-drawer] .scrim { display: block; grid-area: center; background: rgba(0,0,0,.5); z-index: 4; }
  .gallery { grid-area: right; border-radius: 12px 12px 0 0; }
  .app[data-gallery][data-rtab=design] .right { display: none; }
  .app[data-gallery]:not([data-rtab=design]) .gallery { display: none; }
}

/* ── телефон ────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .nav, #spent { display: none; }
  .grid, .app[data-gallery] .grid { gap: 0; padding: 0; grid-template-columns: minmax(0,1fr);
    grid-template-rows: 42vh auto minmax(0,1fr) auto; grid-template-areas: "center" "tabs" "content" "build"; }
  .panel { border: 0; border-radius: 0 !important; }
  .center { padding: 10px 12px 8px; }
  .timeline { height: 22px; }
  .ticks { display: none; }
  .ptabs { display: flex; }
  .rtabs { display: none; }
  .sources, .right, .gallery { grid-area: content; display: none; }
  .app[data-ptab="0"] .sources { display: flex; }
  .app[data-ptab="1"] .right, .app[data-ptab="2"]:not([data-gallery]) .right { display: flex; }
  .app[data-ptab="2"][data-gallery] .gallery { display: flex; }
  .build { border-top: 1px solid var(--line); }
}

/* ── вход ───────────────────────────────────────────────────────────── */
.login-page { position: relative; isolation: isolate; min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-amb { background: radial-gradient(50% 45% at 40% 35%, oklch(0.4 0.06 250) 0%, transparent 75%), radial-gradient(40% 40% at 70% 80%, oklch(0.34 0.07 290) 0%, transparent 70%); }
[data-theme=light] .login-amb { background: radial-gradient(50% 45% at 40% 35%, oklch(0.85 0.06 250) 0%, transparent 75%), radial-gradient(40% 40% at 70% 80%, oklch(0.88 0.07 290) 0%, transparent 70%); }
.login-box { width: 100%; max-width: 340px; padding: 24px; gap: 14px; }
.login-box .brand { margin: 0 0 6px; font-size: 16px; }
.login-box label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--dim); }
.login-box .inp { height: 38px; font-size: 14px; color: var(--fg); }
.login-box .go { margin-top: 4px; }
.user { font-size: 12px; margin-right: 6px; }
.user a { color: var(--dim); margin-left: 8px; }
.user a:hover { color: var(--fg); }

/* ── папки исходников ───────────────────────────────────────────────── */
.sel-f { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 500; }
.src-foot { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 11.5px; flex-wrap: wrap; }
.src-foot .mono { font-size: 11px; }
.src-foot .sf-in { color: var(--dim); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-foot select { height: 26px; max-width: 130px; font-size: 11.5px; }
.src-foot .btn { height: 26px; font-size: 11.5px; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.cover img.ok { opacity: 1; }
.cover .code, .cover .dur, .cover .prog { z-index: 1; }
.cover .none { position: absolute; left: 0; right: 0; top: 45%; text-align: center; font: 500 9.5px 'JetBrains Mono'; color: rgba(255,255,255,.6); }

/* ── библиотека: вкладки «Исходники / Ролики» ────────────────────────── */
.sources .p-head { gap: 6px; }
.sources .p-head .sel-f { height: 30px; font-size: 13px; font-weight: 600; }
.ltabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.ltabs button { height: 32px; padding: 0 8px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--dim); font-weight: 500; white-space: nowrap; }
.ltabs .mono { font-size: 11px; color: var(--faint); }
.ltabs em { font-style: normal; color: var(--warn); }
.app[data-ltab=src] .ltabs [data-ltab=src], .app[data-ltab=vid] .ltabs [data-ltab=vid] { color: var(--fg); border-bottom-color: var(--acc); }
.lt { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.app[data-ltab=src] .lt-vid, .app[data-ltab=vid] .lt-src { display: none; }
.lt .scroll { padding: 0 12px 12px; }
.hint.empty { grid-column: 1 / -1; padding: 24px 8px; text-align: center; }
.pills .mono { font-size: 10.5px; color: var(--faint); }
.pills button.on .mono { color: var(--dim); }
.chip-x { height: 26px; padding: 0 9px; border: 1px solid var(--acc-line); border-radius: 13px; background: var(--acc-soft); font: 500 11px 'JetBrains Mono', monospace; }

/* значок «сделано роликов» на исходнике */
.cover .made { position: absolute; right: 4px; top: 4px; z-index: 1; padding: 1px 5px; border-radius: 3px; background: rgba(0,0,0,.72); color: #fff; font: 600 10px 'JetBrains Mono'; cursor: pointer; display: flex; align-items: center; gap: 3px; }
.cover .made.busy i, .st i, .work-btn i { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.cover .made:hover { background: #000; }

/* карточка ролика */
.vcard.on .cover { outline: 2px solid var(--acc); }
.st { position: absolute; left: 4px; bottom: 6px; z-index: 1; display: flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 4px; font: 600 10px 'Onest'; background: rgba(0,0,0,.75); color: #fff; white-space: nowrap; }
.st.ok { background: rgba(22,120,60,.92); }
.st.review { background: rgba(160,110,20,.92); }
.st.bad { background: rgba(190,40,30,.92); }
.st.wait { background: rgba(0,0,0,.75); color: #ddd; }
.row .st, .sent .st { position: static; }
.sbar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.15); z-index: 1; }
.sbar span { display: block; height: 100%; background: var(--warn); transition: width .4s; }
.tag.wait { background: var(--raise); }
.tag.work { background: var(--warn-soft); color: var(--warn); }

/* «В работе» в шапке */
.work-btn { height: 28px; padding: 0 10px; margin-right: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--fg); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.work-btn:hover { border-color: var(--line2); }

/* ── просмотр готового ролика ────────────────────────────────────────── */
.v-head { display: flex; align-items: center; gap: 8px; }
.v-head b { font-size: 14px; }
.v-err { font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.v-err.bad { background: var(--bad-soft); color: var(--bad); }
.v-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--dim); }
.v-meta a { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }
.list.ro .ph { grid-template-columns: 16px 70px minmax(0,1fr); cursor: default; }
.list.ro .n { font-size: 10.5px; line-height: 19px; color: var(--faint); }
.list.ro .tx { font-size: 13px; line-height: 19px; }
.v-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.v-acts .btn { height: 30px; }
.note { height: auto; min-height: 52px; padding: 7px 9px; resize: vertical; font-size: 12.5px; line-height: 1.4; color: var(--fg); }
.block > .btn { align-self: flex-start; }
.danger { color: var(--bad) !important; }
.b-two .sec:disabled { opacity: .45; }

/* нижняя панель редактора */
.dest { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.dest select { height: 24px; max-width: 150px; font-size: 11.5px; }
.sent { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 12px; text-align: left; }
.sent:hover { border-color: var(--line2); }

/* уведомления */
.toasts { position: fixed; right: 16px; top: 54px; z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 10px 10px 10px 14px; border: 1px solid var(--line2); border-radius: 10px; background: var(--app); box-shadow: 0 12px 40px rgba(0,0,0,.45); font-size: 12.5px; opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s; }
.toast.in { opacity: 1; transform: none; }
.toast button { height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--acc); color: var(--acc-fg); font-size: 12px; font-weight: 600; white-space: nowrap; }
.toast .tx { background: none; color: var(--faint); padding: 0 4px; font-weight: 400; }
@media (max-width: 767px) {
  .toasts { left: 12px; right: 12px; }
  .toast { max-width: none; }
  .work-btn { margin-right: 4px; }
  .app[data-view][data-ptab="2"] .right { display: flex; }
}

/* ── открытый ролик ──────────────────────────────────────────────────── */
.vstrip { display: none; align-items: center; gap: 8px; padding: 10px 12px 0 8px; }
.app[data-view] .vstrip { display: flex; }
.vstrip b { font-size: 13.5px; }
.vstrip .tag { display: inline-flex; align-items: center; gap: 5px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; }
.kv span { color: var(--dim); }
.kv b { font-weight: 500; }
.tab-info > .btn { align-self: flex-start; height: 30px; }

/* ── плеер ───────────────────────────────────────────────────────────── */
.transport { gap: 4px; }
.pbtn { width: 30px; height: 30px; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--fg); display: inline-flex; align-items: center; justify-content: center; }
.pbtn:hover:not(:disabled) { background: var(--raise); }
.pbtn:disabled { opacity: .35; }
.pbtn svg { width: 18px; height: 18px; fill: currentColor; }
#play { width: 34px; height: 34px; border-radius: 50%; background: var(--acc); color: var(--acc-fg); }
#play:hover:not(:disabled) { background: var(--acc); filter: brightness(.9); }
#play svg { width: 16px; height: 16px; }
.pbtn.speed { width: auto; min-width: 34px; padding: 0 6px; font-size: 11.5px; color: var(--dim); }
.t-row { gap: 8px; }
.t-row .mono { font-size: 12px; }
.vol { display: flex; align-items: center; gap: 2px; }
.vol input { -webkit-appearance: none; appearance: none; width: 78px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--fg) var(--p, 100%), var(--line2) var(--p, 100%)); cursor: pointer; }
.vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--fg); border: 0; }
.vol input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--fg); border: 0; }
#mute.off { color: var(--dim); }
.pm button { height: 24px; font-size: 11.5px; }

/* дорожка фраз над перемоткой */
.lane { position: relative; height: 22px; }
.lane .seg { top: 2px; bottom: 2px; cursor: pointer; }
.lane .seg:hover { border-color: var(--fg); }

/* перемотка */
.scrub { position: relative; height: 18px; cursor: pointer; touch-action: none; }
.scrub .track { position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 2px; background: var(--line2); overflow: hidden; transition: top .12s, height .12s; }
.scrub:hover .track, .scrub.drag .track { top: 6px; height: 6px; border-radius: 3px; }
.scrub .buf { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: color-mix(in oklab, var(--fg) 22%, transparent); }
.scrub .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--acc); }
.scrub .knob { position: absolute; top: 9px; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 3px color-mix(in oklab, var(--acc) 25%, transparent); transform: scale(0); transition: transform .12s; pointer-events: none; }
.scrub:hover .knob, .scrub.drag .knob { transform: scale(1); }
.scrub .tip { position: absolute; bottom: 20px; transform: translateX(-50%); padding: 2px 6px; border-radius: 4px; background: var(--fg); color: var(--app); font-size: 11px; white-space: nowrap; pointer-events: none; }
.frame { cursor: pointer; }
.frame:fullscreen { border-radius: 0; height: 100%; width: auto; aspect-ratio: 9/16; margin: 0 auto; background: #000; }
.frame:fullscreen video { object-fit: contain; }

@media (max-width: 767px) {
  .vol input, .pbtn.speed, #phrase-now { display: none; }
  .t-row { gap: 4px; white-space: nowrap; }
  .t-row #t-dur { margin-right: 2px; }
  .pm button { padding: 0 7px; }
  .ptabs .only-view { display: none !important; }
  .app[data-view] .ptabs .only-view { display: flex !important; }
  .app[data-ptab="3"] .right { display: flex; }
  .ptabs button { font-size: 12.5px; }
}
