/* ==========================================================================
   Flair Studio — мини-приложение Telegram. Тёмная «студийная» тема:
   кадр — главный, интерфейс не спорит с ним за внимание.
   ========================================================================== */

:root {
  --bg: #0a0a10;
  --bg-2: #101018;
  --surface: #15151f;
  --surface-2: #1c1c28;
  --surface-3: #252533;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #f4f4f8;
  --text-2: #a6a6b8;
  --text-3: #6f6f82;
  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --accent-soft: rgba(139, 92, 246, 0.16);
  --grad: linear-gradient(135deg, #8b5cf6 0%, #c04df0 50%, #ec4899 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { display: block; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 26px; height: 26px; }

/* ---------- каркас ---------- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
#app::before {
  content: ""; position: absolute; inset: -20% -10% auto; height: 340px; pointer-events: none; z-index: 0;
  background: radial-gradient(60% 60% at 30% 30%, rgba(139, 92, 246, 0.22), transparent 70%),
              radial-gradient(50% 50% at 80% 20%, rgba(236, 72, 153, 0.16), transparent 70%);
  filter: blur(10px);
}
.view { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; flex-direction: column; animation: viewIn 0.28s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pad { padding: 0 16px; }
.with-fallback .scroll { padding-bottom: 84px; }

/* ---------- шапка ---------- */
.top { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; }
.brand { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.logo { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(192, 77, 240, 0.35); flex: none; }
.logo svg { width: 22px; height: 22px; fill: #fff; stroke: none; }
.brand h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.2px; }
.brand p { margin: 1px 0 0; font-size: 12.5px; color: var(--text-2); }
.title { flex: 1; min-width: 0; }
.title h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.2px; }
.title p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); transition: transform 0.15s var(--ease), background 0.2s; }
.icon-btn:active { transform: scale(0.94); background: var(--surface-2); }
.badge { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--grad); font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.badge.pulse::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; border: 2px solid var(--accent-2); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5); } }
.text-btn { font-size: 14px; font-weight: 600; color: var(--accent); padding: 8px 4px; }
.text-btn.muted { color: var(--text-2); }

/* ---------- загрузка ---------- */
.drop { margin: 6px 16px 4px; padding: 18px; border-radius: var(--r-lg); background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(135deg, rgba(139, 92, 246, 0.55), rgba(236, 72, 153, 0.45)) border-box; border: 1.5px dashed transparent; display: flex; align-items: center; gap: 14px; width: calc(100% - 32px); text-align: left; transition: transform 0.15s var(--ease); }
.drop:active { transform: scale(0.985); }
.drop .ic { width: 48px; height: 48px; border-radius: 15px; background: var(--grad); display: grid; place-items: center; flex: none; box-shadow: 0 8px 22px rgba(192, 77, 240, 0.3); }
.drop .ic svg { stroke: #fff; width: 24px; height: 24px; }
.drop b { display: block; font-size: 16px; font-weight: 650; }
.drop span { display: block; margin-top: 2px; font-size: 13px; color: var(--text-2); }
.hint-line { margin: 8px 18px 0; font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; align-items: flex-start; }
.hint-line svg { margin-top: 1px; color: var(--text-2); }

.uploads { margin: 12px 16px 0; display: flex; flex-direction: column; gap: 8px; }
.up { padding: 11px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.up .meta { flex: 1; min-width: 0; }
.up .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.up.err .sub { color: var(--err); }
.progress { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 7px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: inherit; transition: width 0.35s var(--ease); }
.progress.indet > i { width: 35% !important; animation: indet 1.2s infinite var(--ease); }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ---------- медиатека ---------- */
.section-h { display: flex; align-items: center; justify-content: space-between; margin: 22px 16px 10px; }
.section-h h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-2); }
.section-h h3 small { font-weight: 600; color: var(--text-3); margin-left: 6px; letter-spacing: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 0 16px 24px; }
.card { position: relative; border-radius: var(--r); overflow: hidden; background: var(--surface); border: 1px solid var(--line); text-align: left; transition: transform 0.18s var(--ease), border-color 0.2s, box-shadow 0.2s; }
.card:active { transform: scale(0.97); }
.card .poster { position: relative; aspect-ratio: 3 / 4; background: var(--surface-2); overflow: hidden; }
.card .poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease), filter 0.3s; }
.card .poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.55)); }
.card .dur { position: absolute; left: 8px; bottom: 8px; z-index: 1; font-size: 12px; font-weight: 700; padding: 3px 7px; border-radius: 8px; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.card .tags { position: absolute; left: 8px; top: 8px; z-index: 1; display: flex; gap: 4px; }
.tag { font-size: 10px; font-weight: 800; letter-spacing: 0.4px; padding: 3px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tag.hdr { background: linear-gradient(135deg, rgba(251, 191, 36, 0.9), rgba(245, 158, 11, 0.9)); color: #1a1205; }
.card .check { position: absolute; right: 8px; top: 8px; z-index: 1; width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85); background: rgba(0, 0, 0, 0.25); display: grid; place-items: center; transition: all 0.2s var(--ease); }
.card .check svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 3; opacity: 0; transform: scale(0.6); transition: all 0.2s var(--ease); }
.card.on { border-color: transparent; box-shadow: 0 0 0 2px var(--accent), 0 10px 26px rgba(139, 92, 246, 0.25); }
.card.on .check { background: var(--grad); border-color: transparent; }
.card.on .check svg { opacity: 1; transform: none; }
.card.on .poster img { transform: scale(1.04); }
.card .info { padding: 9px 10px 10px; }
.card .info .name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .info .sub { margin-top: 2px; font-size: 11.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.card .more { position: absolute; right: 4px; bottom: 6px; width: 30px; height: 30px; display: grid; place-items: center; color: var(--text-3); border-radius: 9px; }
.card .more:active { background: var(--surface-3); }

.empty { margin: 34px 24px; text-align: center; color: var(--text-2); }
.empty .art { width: 112px; height: 112px; margin: 0 auto 16px; border-radius: 32px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; position: relative; }
.empty .art::before { content: ""; position: absolute; inset: 18px; border-radius: 24px; background: var(--grad); opacity: 0.18; filter: blur(14px); }
.empty .art svg { width: 48px; height: 48px; stroke: url(#gstroke); position: relative; }
.empty h4 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.empty p { margin: 0; font-size: 14px; }

/* ---------- редактор ---------- */
.editor .top { padding: 8px 16px 6px; }
.editor .top .icon-btn { width: 36px; height: 36px; border-radius: 12px; }
.editor .title h2 { font-size: 17px; }
.editor .title p { font-size: 12px; margin-top: 1px; }
.stage { position: relative; flex: none; height: clamp(190px, calc(var(--tg-viewport-stable-height, 100vh) * 0.4), 540px); margin: 2px 16px 0; border-radius: var(--r-lg); background: #000; overflow: hidden; display: grid; place-items: center; touch-action: none; }
.stage .backdrop { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(28px) brightness(0.45) saturate(1.2); transform: scale(1.1); opacity: 0.9; }
.frame { position: relative; height: 100%; max-width: 100%; overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06); }
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.frame .before { clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0); }
.split { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px; margin-left: -1px; background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); pointer-events: none; }
.split::after { content: ""; position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(255, 255, 255, 0.95) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 7l-5 5 5 5M15 7l5 5-5 5'/%3E%3C/svg%3E") center / 20px no-repeat; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); }
.lbl { position: absolute; top: 10px; z-index: 2; font-size: 10.5px; font-weight: 800; letter-spacing: 0.8px; padding: 4px 8px; border-radius: 7px; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: none; transition: opacity 0.2s; }
.lbl.l { left: 10px; }
.lbl.r { right: 10px; }
.stage .tools { position: absolute; right: 8px; bottom: 8px; z-index: 3; display: flex; flex-direction: column; gap: 7px; }
.glass { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(20, 20, 30, 0.55); border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: transform 0.15s var(--ease), background 0.2s; }
.glass:active { transform: scale(0.92); background: rgba(40, 40, 55, 0.7); }
.glass.on { background: var(--grad); border-color: transparent; }
.stage .loader { position: absolute; left: 12px; bottom: 12px; z-index: 3; display: flex; align-items: center; gap: 7px; padding: 6px 10px 6px 8px; border-radius: 10px; background: rgba(10, 10, 16, 0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 12px; font-weight: 600; color: var(--text-2); opacity: 0; transform: translateY(4px); transition: all 0.2s var(--ease); pointer-events: none; }
.stage .loader.on { opacity: 1; transform: none; }
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.18); border-top-color: var(--accent-2); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage .err-msg { position: absolute; left: 12px; right: 60px; bottom: 12px; z-index: 3; font-size: 12.5px; color: #fff; background: rgba(127, 29, 29, 0.75); padding: 7px 10px; border-radius: 10px; }
.shimmer { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.06) 50%, transparent 70%) var(--surface-2); background-size: 250% 100%; animation: sh 1.3s infinite linear; }
@keyframes sh { from { background-position: 120% 0; } to { background-position: -120% 0; } }

.timeline { display: flex; align-items: center; gap: 10px; margin: 8px 16px 0; flex: none; }
.vids { display: flex; gap: 6px; flex: none; max-width: 40%; overflow-x: auto; scrollbar-width: none; }
.vids::-webkit-scrollbar { display: none; }
.vid-dot { width: 30px; height: 36px; border-radius: 9px; overflow: hidden; flex: none; border: 2px solid transparent; opacity: 0.55; transition: all 0.2s; }
.vid-dot img { width: 100%; height: 100%; object-fit: cover; }
.vid-dot.on { border-color: var(--accent); opacity: 1; }
.strip { position: relative; flex: 1; height: 36px; border-radius: 10px; overflow: hidden; background: var(--surface-2) center / 100% 100% no-repeat; touch-action: pan-y; cursor: pointer; }
.strip::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent 20%, transparent 80%, rgba(0, 0, 0, 0.35)); }
.playhead { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.5); z-index: 1; }
.tlabel { font-size: 12.5px; font-weight: 700; color: var(--text-2); min-width: 38px; text-align: right; }

.tabs { display: flex; gap: 6px; padding: 10px 16px 4px; overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); white-space: nowrap; transition: all 0.2s var(--ease); }
.tab svg { width: 17px; height: 17px; }
.tab .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); margin-left: -2px; }
.tab.on { color: #fff; background: var(--accent-soft); border-color: rgba(139, 92, 246, 0.55); }

.panel { padding: 4px 16px 28px; }
.presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.preset { position: relative; padding: 13px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-align: left; display: flex; gap: 11px; align-items: center; transition: all 0.2s var(--ease); }
.preset:active { transform: scale(0.97); }
.preset .em { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; background: var(--surface-3); flex: none; }
.preset b { display: block; font-size: 14.5px; font-weight: 650; }
.preset span { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.preset.on { background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, var(--grad) border-box; border: 1.5px solid transparent; }
.preset.on .em { background: var(--grad); }

.ctrl { padding: 11px 0 9px; border-bottom: 1px solid var(--line); }
.ctrl:last-child { border-bottom: 0; }
.ctrl .row { display: flex; align-items: center; gap: 10px; }
.ctrl .lab { flex: 1; min-width: 0; }
.ctrl .lab b { display: block; font-size: 14.5px; font-weight: 600; }
.ctrl .lab small { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.val { min-width: 52px; padding: 5px 9px; border-radius: 9px; background: var(--surface-2); font-size: 13px; font-weight: 700; text-align: center; color: var(--text-2); transition: all 0.2s; }
.val.changed { color: #fff; background: var(--accent-soft); }

.slider { position: relative; height: 32px; margin-top: 3px; touch-action: pan-y; cursor: pointer; }
.slider .track { position: absolute; left: 0; right: 0; top: 50%; height: 5px; margin-top: -2.5px; border-radius: 3px; background: var(--surface-3); }
.slider .fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--grad); }
.slider .zero { position: absolute; top: -4px; width: 2px; height: 13px; margin-left: -1px; border-radius: 1px; background: var(--text-3); }
.slider .thumb { position: absolute; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 0 4px rgba(139, 92, 246, 0); transition: box-shadow 0.2s, transform 0.15s var(--ease); }
.slider.drag .thumb { transform: scale(1.12); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 0 7px rgba(139, 92, 246, 0.25); }

.switch { position: relative; width: 50px; height: 30px; border-radius: 15px; background: var(--surface-3); flex: none; transition: background 0.25s var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); transition: transform 0.25s var(--ease); }
.switch.on { background: var(--grad); }
.switch.on::after { transform: translateX(20px); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { padding: 8px 13px; border-radius: 11px; font-size: 13.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); transition: all 0.18s var(--ease); }
.chip:active { transform: scale(0.95); }
.chip.on { color: #fff; background: var(--accent-soft); border-color: rgba(139, 92, 246, 0.7); }
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-top: 10px; }
.look { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; font-weight: 600; color: var(--text-2); transition: all 0.18s var(--ease); }
.look i { width: 46px; height: 46px; border-radius: 12px; display: block; }
.look.on { color: #fff; border-color: rgba(139, 92, 246, 0.7); background: var(--accent-soft); }
.looks-h { margin: 14px 0 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-3); }
.mix-note { display: block; margin-top: 3px; font-size: 12px; color: #c4b5fd; }
.preset.mine { cursor: pointer; padding-right: 36px; }
.preset .t { min-width: 0; }
.preset .t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset .x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: var(--text-3); }
.preset .x:active { background: var(--surface-3); }
.save-preset { display: flex; gap: 8px; margin-top: 10px; }
.save-preset input { flex: 1; min-width: 0; height: 44px; padding: 0 13px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; outline: none; user-select: text; -webkit-user-select: text; }
.save-preset input:focus { border-color: rgba(139, 92, 246, 0.7); }
.save-preset input::placeholder { color: var(--text-3); }
.save-preset .btn { flex: none; padding: 0 14px; height: 44px; }
.group-note { margin: 2px 0 6px; padding: 11px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); display: flex; gap: 10px; }
.group-note svg { color: var(--accent); margin-top: 1px; }

/* ---------- экспорт ---------- */
.exp { padding: 4px 16px 28px; }
.sum { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.sum .thumbs { display: flex; flex: none; }
.sum .thumbs img { width: 40px; height: 54px; object-fit: cover; border-radius: 9px; border: 2px solid var(--surface); margin-left: -14px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); }
.sum .thumbs img:first-child { margin-left: 0; }
.sum b { font-size: 15px; font-weight: 650; }
.sum p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.block { margin-top: 20px; }
.block > h4 { margin: 0 0 9px; font-size: 13px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-2); }
.block > p.h { margin: 8px 2px 0; font-size: 12.5px; color: var(--text-3); }
.copies { display: flex; gap: 8px; align-items: stretch; }
.copies .c { flex: 1; height: 50px; border-radius: 14px; font-size: 18px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); transition: all 0.18s var(--ease); }
.copies .c.on { background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, var(--grad) border-box; border: 1.5px solid transparent; }
.stepper { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.stepper button { width: 42px; height: 38px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; }
.stepper button:active { background: var(--surface-3); }
.stepper .n { font-size: 15px; font-weight: 650; }
.seg { display: flex; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); gap: 4px; }
.seg button { flex: 1; padding: 10px 6px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--text-2); transition: all 0.2s var(--ease); }
.seg button.on { background: var(--surface-3); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-align: left; transition: all 0.18s var(--ease); }
.opt .t { flex: 1; min-width: 0; }
.opt b { display: block; font-size: 14.5px; font-weight: 600; }
.opt span { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.opt .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text-3); flex: none; position: relative; transition: all 0.2s; }
.opt.on { border-color: rgba(139, 92, 246, 0.6); background: var(--accent-soft); }
.opt.on .radio { border-color: transparent; background: var(--grad); }
.opt.on .radio::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.deliver { margin-top: 22px; padding: 14px; border-radius: var(--r); background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(236, 72, 153, 0.1)); border: 1px solid rgba(139, 92, 246, 0.25); display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--text-2); }
.deliver b { color: var(--text); font-size: 14px; display: block; margin-bottom: 2px; }
.deliver svg { color: var(--accent-2); }

/* ---------- задания ---------- */
.jobs { padding: 4px 16px 28px; display: flex; flex-direction: column; gap: 12px; }
.job { padding: 14px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.job .h { display: flex; gap: 10px; align-items: flex-start; }
.job .h .t { flex: 1; min-width: 0; }
.job .h b { display: block; font-size: 15px; font-weight: 650; }
.job .h span { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state { font-size: 11px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; padding: 5px 8px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); flex: none; }
.state.running { background: var(--accent-soft); color: #c4b5fd; }
.state.done { background: rgba(52, 211, 153, 0.14); color: var(--ok); }
.state.cancelled, .state.failed { background: rgba(248, 113, 113, 0.12); color: var(--err); }
.job .bar { height: 8px; border-radius: 5px; background: var(--surface-3); margin-top: 14px; overflow: hidden; }
.job .bar i { display: block; height: 100%; background: var(--grad); border-radius: inherit; transition: width 0.6s var(--ease); position: relative; overflow: hidden; }
.job .bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent); animation: shine 1.6s infinite; }
.job.done .bar i::after, .job.cancelled .bar i::after { display: none; }
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.job .stats { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.dots i { width: 12px; height: 12px; border-radius: 4px; background: var(--surface-3); }
.dots i.running { background: var(--accent); animation: blink 1s infinite alternate; }
.dots i.done { background: var(--grad); }
.dots i.failed { background: var(--err); }
.dots i.cancelled { background: #3a2a30; }
@keyframes blink { from { opacity: 0.45; } to { opacity: 1; } }
.job .acts { display: flex; gap: 8px; margin-top: 12px; }
.btn { flex: 1; height: 42px; border-radius: 12px; font-size: 14px; font-weight: 650; display: flex; align-items: center; justify-content: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--line); transition: transform 0.15s var(--ease); }
.btn:active { transform: scale(0.97); }
.btn.danger { color: var(--err); }
.btn.primary { background: var(--grad); border: 0; color: #fff; }
.files { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.file .t { flex: 1; min-width: 0; }
.file b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file span { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.file .mini { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); }
.file .mini:active { background: var(--surface-3); }
.more-files { font-size: 13px; font-weight: 600; color: var(--accent); padding: 8px 2px 0; }
.note { margin-top: 10px; font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }

/* ---------- окна, тосты ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.modal video { max-width: 100%; max-height: calc(100% - 80px); border-radius: 16px; background: #000; box-shadow: var(--shadow); }
.modal .frame { border-radius: 14px; box-shadow: var(--shadow); touch-action: none; }
.modal .full-wrap { position: relative; }
.modal .full-wrap .lbl { top: 10px; }
.modal .close { position: absolute; top: 14px; right: 14px; }
.modal .cap { margin-top: 12px; font-size: 13px; color: var(--text-2); text-align: center; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(18px + var(--safe-b)); z-index: 60; padding: 13px 15px; border-radius: 14px; background: rgba(30, 30, 44, 0.96); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; display: flex; gap: 10px; align-items: center; animation: toastIn 0.3s var(--ease); }
.toast.err { border-color: rgba(248, 113, 113, 0.4); }
.toast.ok svg { color: var(--ok); }
.toast.err svg { color: var(--err); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }
.with-fallback .toast { bottom: calc(86px + var(--safe-b)); }

.fallback-main { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 40; height: 54px; border-radius: 15px; background: var(--grad); color: #fff; font-size: 16px; font-weight: 700; box-shadow: 0 10px 30px rgba(192, 77, 240, 0.35); }
.fallback-main:disabled { opacity: 0.5; }

.gate { margin: auto; padding: 32px 26px; text-align: center; max-width: 360px; }
.gate .logo { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 18px; }
.gate .logo svg { width: 34px; height: 34px; }
.gate h2 { margin: 0 0 8px; font-size: 22px; }
.gate p { margin: 0 0 22px; color: var(--text-2); font-size: 14.5px; }
.gate a { display: inline-flex; align-items: center; gap: 8px; padding: 13px 20px; border-radius: 14px; background: var(--grad); color: #fff; font-weight: 700; text-decoration: none; }
.boot { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--text-3); font-size: 13px; }
.boot .logo { width: 56px; height: 56px; border-radius: 18px; animation: breathe 1.6s infinite var(--ease); }
@keyframes breathe { 50% { transform: scale(0.92); box-shadow: 0 2px 30px rgba(192, 77, 240, 0.55); } }

@media (min-width: 560px) {
  .presets { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
