/* MakeMyReels — дизайн-система.
   Минимализм, пастельные, но не блеклые тона из палитр автора (Docks + Awsmcolor).
   Цвета — только через токены; тёмная тема переопределяет их целиком. */

@font-face { font-family: "Noto Sans"; src: url("../fonts/noto-sans-cyrillic-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-display: swap; unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/noto-sans-cyrillic-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/noto-sans-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F4F4F6;
  --surface: #FFFFFF;
  --surface-2: #EEF0F4;
  --text: #1F2A40;
  --muted: #5B6478;
  --border: #E1E4EB;
  --primary: #3D619B;
  --on-primary: #FFFFFF;
  --primary-soft: #E4EBF6;
  --accent: #53D3D1;
  --warm: #FEB249;
  --warm-soft: #FFF1DB;
  --danger: #D23F40;
  --danger-soft: #FBECEB;
  --ok: #2F8F6B;
  --ring: #3D619B;
  --shadow: 0 1px 2px rgba(31, 42, 64, .06), 0 8px 24px rgba(31, 42, 64, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1B2D; --surface: #172437; --surface-2: #1F2E45; --text: #E9E9EB; --muted: #A3ADBF;
    --border: #2A3A55; --primary: #53D3D1; --on-primary: #0B1626; --primary-soft: #16394A;
    --warm-soft: #3A2E1A; --danger: #F07374; --danger-soft: #3A2026; --ok: #5CC8A0; --ring: #53D3D1;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1B2D; --surface: #172437; --surface-2: #1F2E45; --text: #E9E9EB; --muted: #A3ADBF;
  --border: #2A3A55; --primary: #53D3D1; --on-primary: #0B1626; --primary-soft: #16394A;
  --warm-soft: #3A2E1A; --danger: #F07374; --danger-soft: #3A2026; --ok: #5CC8A0; --ring: #53D3D1;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 "Noto Sans", system-ui, sans-serif;
  transition: background-color .25s var(--ease), color .25s var(--ease); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 750; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ── каркас ── */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .inner { max-width: 1440px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.brand .mark svg { width: 16px; height: 16px; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); text-decoration: none; }
.spacer { flex: 1; }
.container { max-width: 1440px; margin: 0 auto; padding: 32px 24px 64px; }
.narrow { max-width: none; }

/* ── кнопки ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; font: 650 15px/1 "Noto Sans", sans-serif; cursor: pointer;
  background: var(--primary); color: var(--on-primary); transition: transform .15s var(--ease), filter .2s, background-color .2s; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* ── карточки и формы ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card + .card { margin-top: 16px; }
.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field label { font-weight: 650; font-size: 15px; }
.field .hint { color: var(--muted); font-size: 14px; }
input[type=text], input[type=password], input[type=email], textarea { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 16px/1.4 "Noto Sans", sans-serif;
  transition: border-color .2s, box-shadow .2s; }
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 22%, transparent); }
.alert { border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-weight: 600; font-size: 15px; display: flex; gap: 10px; align-items: flex-start; }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--primary-soft); color: var(--primary); }
.alert.warn { background: var(--warm-soft); color: var(--text); }

/* ── вход ── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { margin-bottom: 22px; font-size: 20px; }

/* ── шаги ── */
.stepper { display: flex; gap: 8px; margin: 8px 0 28px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--muted); font-weight: 650; font-size: 14px; }
.step .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 13px; }
.step.is-active { color: var(--text); border-color: var(--primary); }
.step.is-active .num { background: var(--primary); color: var(--on-primary); }
.step.is-done .num { background: var(--primary-soft); color: var(--primary); }

/* ── палитры ── */
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.palette { position: relative; cursor: pointer; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface);
  padding: 12px; transition: border-color .2s, transform .2s var(--ease), box-shadow .2s; }
.palette:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.palette input { position: absolute; opacity: 0; pointer-events: none; }
.palette:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.palette:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }
.palette .meta { margin-top: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.palette .name { font-weight: 700; }
.palette .check { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--primary);
  color: var(--on-primary); opacity: 0; transform: scale(.6); transition: .2s var(--ease); flex: none; }
.palette:has(input:checked) .check { opacity: 1; transform: none; }
.palette .check svg { width: 14px; height: 14px; }
.swatches { display: flex; gap: 4px; margin-top: 8px; }
.swatches i { flex: 1; height: 10px; border-radius: 4px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 14%, transparent); }

/* макет вертикального ролика: сверху анимация, снизу автор, субтитр */
.mock { --m-bg: #050B2F; --m-surface: #10194F; --m-text: #E4EEFF; --m-accent: #3E7BEE; --m-accent2: #FFD0AE;
  --m-sub: #fff; --m-hl: #3E7BEE; --m-outline: #050B2F;
  aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; position: relative; background: #2a2f38; }
.mock .top { position: absolute; inset: 0 0 50% 0; background: linear-gradient(180deg, var(--m-bg), var(--m-surface)); display: grid; place-items: center; }
.mock .panel { width: 70%; padding: 9% 8%; border-radius: 10px; background: var(--m-surface); border: 1px solid color-mix(in srgb, var(--m-text) 25%, transparent); }
.mock .panel b { display: block; height: 7px; width: 55%; border-radius: 4px; background: var(--m-text); opacity: .9; }
.mock .panel em { display: block; height: 14px; width: 80%; margin-top: 8%; border-radius: 4px; background: var(--m-accent); }
.mock .panel s { display: block; height: 6px; width: 40%; margin-top: 8%; border-radius: 4px; background: var(--m-accent2); }
.mock .cam { position: absolute; inset: 50% 0 0 0; overflow: hidden; background: linear-gradient(180deg, color-mix(in srgb, var(--m-accent) 55%, var(--m-bg)), color-mix(in srgb, var(--m-accent) 30%, var(--m-bg))); }
.mock .cam .avatar { position: absolute; left: 50%; bottom: 0; height: 67%; width: auto; aspect-ratio: 1; transform: translateX(-50%); fill: #fff; opacity: .5; }
.mock .m-edge { position: absolute; left: 0; right: 0; top: 50%; height: 3px; transform: translateY(-50%);
  background: linear-gradient(90deg, var(--m-surface), var(--m-accent), var(--m-accent2)); }
.mock .sub { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; font: 800 11px/1.2 "Noto Sans", sans-serif; color: var(--m-sub);
  text-shadow: 0 0 3px var(--m-outline), 0 1px 2px var(--m-outline); }
.mock .sub span { color: var(--m-hl); }

/* своя палитра */
.custom { display: none; margin-top: 20px; }
.custom.is-open { display: grid; grid-template-columns: 1fr 200px; gap: 24px; align-items: start; }
.colors { display: grid; gap: 10px; }
.color-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.color-row input[type=color] { width: 44px; height: 36px; border: none; padding: 0; background: none; cursor: pointer; border-radius: 8px; }
.color-row .lbl { flex: 1; font-weight: 600; font-size: 15px; }
.color-row code { color: var(--muted); font-size: 13px; }
.group-title { margin: 14px 0 4px; font-weight: 700; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }

/* ── главная ── */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; margin-bottom: 28px; }
.empty { text-align: center; padding: 56px 24px; }
.empty .ill { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); }
.empty .ill svg { width: 30px; height: 30px; }
.style-chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-weight: 600; font-size: 14px; color: var(--text); }
.style-chip:hover { text-decoration: none; background: var(--surface-2); }
.style-chip .dots { display: flex; }
.style-chip .dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -6px; }
.style-chip .dots i:first-child { margin-left: 0; }
.flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-top: 26px; text-align: left; }
.flow-item { position: relative; overflow: hidden; padding: 20px 18px 22px; border-radius: 16px; background: var(--surface-2);
  border: 1px solid var(--border); min-height: 168px; transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + .15s); }
.flow-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.flow-item .n { position: absolute; right: 10px; top: -14px; font-size: 96px; font-weight: 800; line-height: 1; letter-spacing: -.04em;
  color: var(--primary); opacity: .12; pointer-events: none; user-select: none; }
.flow-item .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px;
  background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.flow-item .ic svg { width: 20px; height: 20px; }
.flow-item b { display: block; font-size: 16px; margin-bottom: 4px; }
.flow-item p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
@media (max-width: 1000px) { .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .flow { grid-template-columns: 1fr; } .flow-item { min-height: 0; } }

/* ── админка ── */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; color: var(--muted); font-weight: 650; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.tag.on { background: var(--primary-soft); color: var(--primary); }
.tag.off { background: var(--danger-soft); color: var(--danger); }
.issued { display: grid; gap: 6px; }
.issued code { font: 700 18px/1.3 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.table-wrap { overflow-x: auto; }

@media (max-width: 760px) {
  .nav { display: none; }
  .hero { grid-template-columns: 1fr; }
  .custom.is-open { grid-template-columns: 1fr; }
  .custom .mock { max-width: 180px; }
  .grid-2 { grid-template-columns: 1fr; }
  .palettes { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .palette { padding: 8px; }
  .container { padding-top: 24px; }
}

/* иконка темы: в светлой — луна, в тёмной — солнце */
.theme-light-icon { display: none; }
:root[data-theme="dark"] .theme-light-icon { display: contents; }
:root[data-theme="dark"] .theme-dark-icon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-light-icon { display: contents; }
  :root:not([data-theme="light"]) .theme-dark-icon { display: none; }
}

/* ── движение ── */
:root { --glow-a: #3D619B; --glow-b: #2E7FA3; --glow-c: #4A6FB0; }
:root[data-theme="dark"] { --glow-a: #53D3D1; --glow-b: #8FE3C9; --glow-c: #6CC4E0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glow-a: #53D3D1; --glow-b: #8FE3C9; --glow-c: #6CC4E0; } }

/* плавный переход между страницами (браузеры с View Transitions; остальные — как обычно) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .18s ease both; }
::view-transition-new(root) { animation: vt-in .32s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }

/* мягкое появление блоков по очереди */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
main.container > * { animation: rise .5s var(--ease) both; }
main.container > *:nth-child(2) { animation-delay: .06s; }
main.container > *:nth-child(3) { animation-delay: .12s; }
main.container > *:nth-child(4) { animation-delay: .18s; }
main.container > *:nth-child(5) { animation-delay: .24s; }
main.container > *:nth-child(n+6) { animation-delay: .3s; }
.auth-card { animation: rise .55s var(--ease) both; }
.palettes .palette { animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms + .1s); }

/* «Загрузить ролик»: медленное мягкое переливание градиента */
.btn.glow { background: linear-gradient(115deg, var(--glow-a) 0%, var(--glow-b) 30%, var(--glow-c) 55%, var(--glow-b) 80%, var(--glow-a) 100%);
  background-size: 300% 100%; animation: flow 14s ease-in-out infinite;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--glow-a) 30%, transparent); }
.btn.glow:hover { box-shadow: 0 10px 28px color-mix(in srgb, var(--glow-a) 40%, transparent); transform: translateY(-1px); }
@keyframes flow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* выбор палитры — лёгкий «щелчок» */
.palette:has(input:checked) .mock { animation: pop .35s var(--ease); }
@keyframes pop { 50% { transform: scale(.97); } }

/* шаги мастера: следующий блок въезжает */
[data-step]:not([hidden]) { animation: rise .4s var(--ease) both; }

/* ── подложка под субтитры: макет «автор на весь экран» ── */
.mock.full .cam { inset: 0; }
.mock.full .cam .avatar { height: 62%; }
.mock .underlay { position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none; }
.mock .underlay.dark { height: 32%; background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,.1) 15%, rgba(0,0,0,.35) 45%, rgba(0,0,0,.68) 75%, rgba(0,0,0,.88) 100%); }
.mock .underlay.light { height: 50%; background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,.12) 18%, rgba(255,255,255,.36) 36%, rgba(255,255,255,.6) 55%, rgba(255,255,255,.78) 72%, rgba(255,255,255,.8) 100%); }
.mock .underlay.light ~ .sub { color: #1F2A40; text-shadow: none; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(150px, 210px)); justify-content: center; gap: 20px; }
.wide-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 760px) { .wide-grid { grid-template-columns: 1fr; } .choices { grid-template-columns: repeat(3, 1fr); gap: 10px; } }
.palettes { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .palettes { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .palettes { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .palettes { grid-template-columns: repeat(2, 1fr); } }

/* ── загрузка ── */
.upload-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.drop { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 56px 24px; border-radius: 14px; cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); background: color-mix(in srgb, var(--primary-soft) 45%, transparent);
  transition: background-color .2s, border-color .2s, transform .2s var(--ease); }
.drop:hover, .drop.is-over { background: var(--primary-soft); border-color: var(--primary); }
.drop.is-over { transform: scale(1.01); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 3px; }
.drop-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.drop-ic svg { width: 28px; height: 28px; }
.drop-title { font-size: 18px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--muted); }
.picked { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; align-items: start; animation: rise .4s var(--ease) both; }
.picked video { width: 150px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 12px; background: #000; }
.picked-info b { font-size: 17px; word-break: break-all; }
.checks { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 6px; font-size: 15px; }
.checks li { display: flex; gap: 8px; align-items: baseline; }
.checks li::before { content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%; transform: translateY(3px);
  background: var(--surface-2) center / 12px no-repeat; }
.checks li.ok::before { background-color: var(--primary-soft); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232F8F6B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
.checks li.bad { color: var(--danger); font-weight: 600; }
.checks li.bad::before { background-color: var(--danger-soft); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D23F40' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E"); }
.checks li.unk { color: var(--muted); }
.toggle { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; margin-bottom: 16px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--primary); margin-top: 2px; flex: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tips h3 { margin-bottom: 10px; }
.tips ul { padding-left: 18px; margin: 0 0 12px; display: grid; gap: 8px; font-size: 14px; }

/* прогресс */
.progress-wrap { display: grid; gap: 10px; animation: rise .4s var(--ease) both; }
.progress-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar.big { height: 14px; margin: 18px 0; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .6s var(--ease);
  background: linear-gradient(90deg, var(--glow-a), var(--glow-b), var(--glow-c)); background-size: 200% 100%; animation: flow 6s ease-in-out infinite; }
.progress-wrap .btn { justify-self: start; }

/* статус ролика */
.clip-title { word-break: break-word; }
.status-row { display: flex; gap: 18px; align-items: center; }
.status-row h2 { margin: 0 0 2px; }
.status-row p { margin: 0; }
.pulse { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); position: relative; }
.pulse svg { width: 26px; height: 26px; }
.pulse::after { content: ""; position: absolute; inset: -6px; border-radius: 22px; border: 2px solid var(--primary); opacity: 0; animation: ring 2.2s ease-out infinite; }
.pulse.ok::after { display: none; }
@keyframes ring { 0% { opacity: .5; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.15); } }
.stages { list-style: none; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; font-size: 14px; }
.stages li { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); transition: background-color .3s, color .3s; }
.stages li.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.stages li.is-done { color: var(--text); }
.stages li.is-done::before { content: "✓ "; color: var(--ok); font-weight: 800; }
.player { margin-top: 20px; display: flex; justify-content: center; }
.player video { width: min(100%, 360px); aspect-ratio: 9 / 16; border-radius: 14px; background: #000; }

/* список роликов */
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.video-card { display: grid; gap: 6px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  color: var(--text); box-shadow: var(--shadow); transition: transform .2s var(--ease), border-color .2s; animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.video-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); text-decoration: none; }
.video-card b { word-break: break-word; }
.status-tag { justify-self: start; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.status-tag.ready { background: var(--primary-soft); color: var(--primary); }
.status-tag.failed { background: var(--danger-soft); color: var(--danger); }
.status-tag.queued, .status-tag.processing { background: var(--warm-soft); color: var(--text); }

@media (max-width: 900px) { .upload-layout { grid-template-columns: 1fr; } .stages { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .picked { grid-template-columns: 1fr; } .picked video { width: 120px; } }

/* ── шаги ролика: полоса со стрелками на всю ширину ── */
.journey { margin: 4px 0 26px; }
.journey-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.journey ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 4px; }
.journey li { position: relative; height: 54px; display: flex; align-items: center; gap: 10px; padding: 0 26px 0 30px; font-weight: 700; font-size: 15px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%, 18px 50%); transition: background-color .4s var(--ease), color .4s; }
.journey li:first-child { padding-left: 18px; border-radius: 14px 0 0 14px; clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%); }
.journey li:last-child { border-radius: 0 14px 14px 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 18px 50%); }
.journey .dot { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; background: var(--surface); color: var(--muted); }
.journey .dot svg { width: 14px; height: 14px; }
.journey li.is-done { background: var(--primary-soft); color: var(--primary); }
.journey li.is-done .dot { background: var(--primary); color: var(--on-primary); }
.journey li.is-active { color: #fff; background: linear-gradient(115deg, var(--glow-a), var(--glow-b), var(--glow-c), var(--glow-a)); background-size: 300% 100%; animation: flow 14s ease-in-out infinite; }
:root[data-theme="dark"] .journey li.is-active { color: var(--on-primary); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .journey li.is-active { color: var(--on-primary); } }
.journey li.is-active .dot { background: rgba(255,255,255,.25); color: inherit; }
.journey a { color: inherit; display: contents; }
@media (max-width: 760px) {
  .journey li { height: 44px; padding: 0 16px 0 22px; justify-content: center; }
  .journey li:first-child { padding-left: 10px; }
  .journey li .lbl { display: none; }
  .journey li.is-active .lbl { display: inline; }
  .journey li.is-active { grid-column: span 2; }
  .journey ol { grid-template-columns: repeat(calc(var(--n, 5) + 1), minmax(0, 1fr)); }
}

/* ── редактор таймлайна ── */
:root { --wave: #3D619B; --cut: #E5484D; --cut-pause: #E5484D; --cut-filler: #F08A3C; --cut-dup: #B0469B; --head: #E5484D; }
:root[data-theme="dark"] { --wave: #53D3D1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --wave: #53D3D1; } }
kbd { font: 700 12px/1 ui-monospace, Menlo, monospace; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.editor { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.ed-side { display: grid; gap: 18px; align-content: start; }
.ed-side h2 { margin: 0; }
.how { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.how b { color: var(--text); }
.analyze { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--primary-soft); }
.analyze .btn { justify-self: stretch; min-height: 42px; padding-top: 8px; padding-bottom: 8px; }
.an-progress { display: grid; gap: 8px; }
.an-sum { font-size: 14px; }
.an-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 4px; font-size: 14px; }
.an-nums span { white-space: nowrap; }
.an-nums b { font-size: 17px; margin-right: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--border); }
.lg.keep { background: var(--surface-2); }
.lg.manual { background: var(--cut); } .lg.pause { background: var(--cut-pause); opacity: .65; } .lg.filler { background: var(--cut-filler); } .lg.dup { background: var(--cut-dup); }
.sel { display: grid; gap: 8px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); animation: rise .3s var(--ease) both; }
.sel-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sel-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nudge { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.nudge .btn { min-width: 36px; padding: 6px 0; }
.total { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.total div { display: grid; }
.total b { font-size: 22px; }
.total .arrow { color: var(--muted); }
.total .arrow svg { width: 20px; height: 20px; }
.total .saved { margin-left: auto; }
.btn.wide { width: 100%; }
.btn.glow-soft { background: linear-gradient(115deg, var(--glow-a), var(--glow-b), var(--glow-c), var(--glow-a)); background-size: 300% 100%; animation: flow 14s ease-in-out infinite; }

.ed-preview { display: grid; justify-items: center; gap: 16px; padding: 32px 18px; }
.pv-frame { height: clamp(280px, calc(100vh - 600px), 560px); aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; background: #000; box-shadow: var(--shadow); }
.pv-frame > video { width: 100%; height: 100%; object-fit: cover; display: block; }
.transport { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.transport .play { width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: var(--on-primary); border: none; }
.transport .play svg { width: 22px; height: 22px; }
.i-pause { display: none; }
.is-playing .i-pause { display: block; } .is-playing .i-play { display: none; }
.tc { font: 600 15px/1 ui-monospace, "SF Mono", Menlo, monospace; min-width: 120px; text-align: center; color: var(--muted); }
.tc.small { min-width: 0; font-size: 13px; }
.small-toggle { margin: 0; font-size: 14px; align-items: center; }
.small-toggle input { margin-top: 0; }

.ed-timeline { grid-column: 1 / -1; padding: 14px 0 10px; overflow: clip; }
.tl-tools { display: flex; align-items: center; gap: 6px; padding: 0 16px 12px; flex-wrap: wrap; }
.tl-tools .sep { width: 1px; height: 26px; background: var(--border); margin: 0 4px; }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 10px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2);
  scrollbar-width: thin; touch-action: pan-x; }
.tl-inner { position: relative; height: 142px; user-select: none; -webkit-user-select: none; cursor: text; }
.tl-ruler { position: relative; height: 26px; border-bottom: 1px solid var(--border); background: var(--surface); }
.tl-ruler .tick { position: absolute; top: 4px; transform: translateX(-50%); font: 600 11px/1 ui-monospace, Menlo, monospace; color: var(--muted); padding-top: 10px; }
.tl-ruler .tick::before { content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: 8px; background: var(--muted); opacity: .6; }
.tl-ruler i { position: absolute; bottom: 0; width: 1px; height: 4px; background: var(--muted); opacity: .35; }
.tl-media { position: relative; height: 92px; }
.tl-thumbs { position: absolute; top: 2px; height: 52px; border-radius: 8px; opacity: .95; }
.tl-wave { position: absolute; top: 56px; height: 36px; }
.tl-segs { position: absolute; inset: 0; }
.seg { position: absolute; top: 0; bottom: 0; border-radius: 6px; border: 1px solid transparent; transition: background-color .15s, box-shadow .15s; cursor: pointer; }
.seg:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.seg.cut { --c: var(--cut); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 52%, transparent) 0 6px, color-mix(in srgb, var(--c) 34%, transparent) 6px 12px);
  border-color: var(--c); }
.seg.cut.pause { --c: var(--cut-pause); } .seg.cut.filler { --c: var(--cut-filler); } .seg.cut.dup { --c: var(--cut-dup); }
.seg.is-sel { box-shadow: 0 0 0 3px var(--primary) inset; z-index: 2; }
.seg .tag { position: absolute; left: 4px; top: 4px; padding: 1px 6px; border-radius: 6px; background: var(--c); color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.edge { position: absolute; top: 0; bottom: 0; width: 12px; margin-left: -6px; z-index: 3; cursor: ew-resize; display: grid; place-items: center; outline: none; }
.edge::before { content: ""; width: 4px; height: 30px; border-radius: 3px; background: var(--text); opacity: .45; transition: opacity .15s, background-color .15s, height .15s; }
.edge:hover::before, .edge:focus-visible::before { opacity: 1; background: var(--primary); height: 46px; }
.tl-words { position: relative; height: 24px; background: var(--surface); border-top: 1px solid var(--border); overflow: hidden; }
.word { position: absolute; top: 4px; height: 18px; padding: 0 2px; font-size: 11px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: clip;
  color: var(--text); border-left: 1px solid color-mix(in srgb, var(--muted) 35%, transparent); }
.word.cut { color: var(--cut); text-decoration: line-through; }
.word.tiny { border-left-color: color-mix(in srgb, var(--muted) 55%, transparent); }
.word.tiny.cut { border-left-color: var(--cut); }
.words-empty { position: absolute; left: 16px; top: 5px; font-size: 12px; color: var(--muted); }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--head); z-index: 5; pointer-events: none; }
.tl-head span { position: absolute; top: 0; left: -6px; width: 14px; height: 14px; border-radius: 3px 3px 7px 7px; background: var(--head); }
.tl-foot { display: flex; gap: 12px 24px; align-items: center; flex-wrap: wrap; padding: 10px 16px 0; }
.tl-hint { margin: 0; flex: 1 1 420px; }
.ed-side .lead { margin: -8px 0 0; }

@media (max-width: 980px) { .editor { grid-template-columns: 1fr; } .ed-preview { order: -1; } .pv-frame { height: min(56vh, 520px); } }

/* ── страница ролика: слева описание, справа видео ── */
.split-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; }
.phone-skel { height: min(60vh, 560px); aspect-ratio: 9 / 16; border-radius: 16px; position: relative; overflow: hidden;
  background: linear-gradient(110deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 60%, var(--surface)) 50%, var(--surface-2) 70%); background-size: 250% 100%;
  animation: flow 3s linear infinite; display: grid; place-items: center; color: var(--muted); }
.phone-skel svg { width: 34px; height: 34px; opacity: .6; }
@media (max-width: 900px) { .split-layout { grid-template-columns: 1fr; } .phone-skel { justify-self: center; } }
.editor-page .hero { margin-bottom: 16px; }
.editor-page .hero h1 { font-size: 26px; margin: 0; }
.hero-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.hero-actions .total b { font-size: 20px; }
.saved-line { min-height: 18px; margin: -10px 0 6px; text-align: right; }
@media (max-width: 760px) { .hero-actions { justify-content: flex-start; } }

/* редактор во весь экран: верхний ряд по высоте окна, таймлайн виден сразу */
.editor { --ed-top: clamp(340px, calc(100vh - 520px), 660px); }
.ed-side { height: var(--ed-top); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.ed-preview { height: var(--ed-top); align-content: center; }
.pv-frame { height: calc(var(--ed-top) - 190px); }
.journey.compact { margin-bottom: 14px; }
.journey.compact .journey-head { display: none; }
.journey.compact li { height: 42px; font-size: 14px; }
.journey.compact li::after { content: none; }
.editor-page .hero { margin-bottom: 4px; }
.tl-tools { padding-bottom: 8px; }
.tl-foot { padding-top: 8px; }
@media (max-width: 980px) { .ed-side, .ed-preview { height: auto; } .pv-frame { height: min(56vh, 520px); } }
.editor > .card { margin-top: 0; }

/* страницу нельзя увести вбок (широкий монитор → половина экрана, трекпад) */
html, body { overflow-x: clip; }

/* сохранение — под заголовком, зелёным */
.meta-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.saved { font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; transition: color .2s; }
.saved:empty { display: none; }
.saved[data-state="ok"] { color: var(--ok); }
.saved[data-state="ok"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.saved[data-state="saving"] { color: var(--muted); }
.saved[data-state="err"] { color: var(--danger); }

/* выбранный кусок — одна строка */
.sel-actions { flex-wrap: nowrap; gap: 10px; }
.sel-actions > .btn { flex: none; min-width: 92px; }
.nudge { white-space: nowrap; gap: 3px; }
.nudge .nb { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 700 16px/1 "Noto Sans", sans-serif; cursor: pointer; display: inline-grid; place-items: center; transition: background-color .15s; }
.nudge .nb:first-of-type { margin-left: 4px; }
.nudge .nb:hover { background: var(--surface-2); }

/* режимы мыши */
.modes { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.mode { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: none; border-radius: 9px; background: transparent;
  color: var(--muted); font: 650 14px/1 "Noto Sans", sans-serif; cursor: pointer; transition: background-color .2s, color .2s, box-shadow .2s; }
.mode svg { width: 17px; height: 17px; }
.mode.is-on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.editor[data-mode="hand"] .tl-media, .editor[data-mode="hand"] .tl-words { cursor: grab; }
.editor.is-panning .tl-media, .editor.is-panning .tl-words { cursor: grabbing; }
.editor[data-mode="blade"] .tl-media, .editor[data-mode="blade"] .tl-words { cursor: crosshair; }
.tl-ruler { cursor: pointer; }
.tl-ghost { position: absolute; top: 26px; bottom: 0; width: 0; border-left: 2px dashed var(--primary); pointer-events: none; z-index: 4; display: none; }
.editor[data-mode="blade"] .tl-ghost:not([hidden]) { display: block; }

/* ── выбор цвета (свой компонент) ── */
.color-row { cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.color-row:hover, .color-row.is-open { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.color-row.is-open { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.swatch-btn { width: 40px; height: 32px; border-radius: 9px; border: none; cursor: pointer; flex: none;
  background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.1); }
.cp { position: absolute; z-index: 50; width: 264px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(15, 27, 45, .22); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; animation: rise .22s var(--ease) both; }
.cp-sv { position: relative; height: 150px; border-radius: 10px; cursor: crosshair; touch-action: none; outline-offset: 2px; }
.cp-knob, .cp-hknob { position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 2px 6px rgba(0,0,0,.3);
  transform: translate(-50%, -50%); pointer-events: none; }
.cp-hue { position: relative; height: 14px; border-radius: 999px; cursor: pointer; touch-action: none; outline-offset: 3px;
  background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.cp-hknob { top: 50%; }
.cp-row { display: flex; gap: 8px; align-items: center; }
.cp-prev { width: 36px; height: 36px; border-radius: 10px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.cp-hex { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: 700 15px/1 ui-monospace, Menlo, monospace; text-transform: uppercase; }
.cp-hex:focus { outline: none; border-color: var(--ring); }
.cp-drop { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.cp-drop svg { width: 18px; height: 18px; }
.cp-sw-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: -6px; }
.cp-sw { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; max-height: 96px; overflow-y: auto; padding: 2px; }
.cp-sw button { aspect-ratio: 1; min-width: 0; padding: 0; border-radius: 6px; border: none; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .12s; }
.cp-sw button:hover { transform: scale(1.15); }
.cp-done { justify-self: end; }

/* элементы сетки могут сжиматься меньше содержимого — иначе широкий таймлайн распирает страницу при сужении окна */
.editor > *, .split-layout > *, .upload-layout > *, .ed-timeline, .tl-scroll { min-width: 0; }

/* ── «О ваших роликах»: соцсети ── */
.wide-grid { align-items: start; }
.field .label { font-weight: 650; font-size: 15px; }
.socials { display: grid; gap: 8px; }
.social { display: grid; grid-template-columns: 150px auto minmax(0, 1fr); align-items: center; height: 46px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.social:focus-within { border-color: var(--ring); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 18%, transparent); }
.social:has(input[type=radio]:checked) { border-color: color-mix(in srgb, var(--primary) 60%, var(--border)); }
.social-pick { display: flex; align-items: center; gap: 9px; height: 100%; padding: 0 12px; background: var(--surface-2); cursor: pointer;
  border-right: 1px solid var(--border); font-weight: 650; font-size: 14px; }
.social-pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); flex: none; }
.net { width: 22px; height: 22px; border-radius: 6px; flex: none; display: grid; place-items: center; }
.net svg { width: 14px; height: 14px; }
.net-telegram { background: linear-gradient(180deg, #37AEE2, #1E96C8); }
.net-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.net-tiktok { background: #111; }
.net-tiktok svg { filter: drop-shadow(1px 1px 0 #FE2C55) drop-shadow(-1px -1px 0 #25F4EE); }
.social .at { padding: 0 2px 0 12px; color: var(--muted); font-weight: 700; }
.social input[type=text] { border: none; min-height: 0; height: 100%; padding: 0 12px 0 2px; border-radius: 0; box-shadow: none !important; background: transparent; }
@media (max-width: 520px) { .social { grid-template-columns: 120px auto minmax(0, 1fr); } }

/* ── шаг «Анимации» ── */
.stage-frame { position: relative; overflow: hidden; background: #000; }
.stage-frame #stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.ae-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ae-actions .btn { min-height: 42px; padding: 8px 10px; }
.ae-list { display: grid; gap: 10px; }
.ae-empty { padding: 18px; border-radius: 14px; border: 1px dashed var(--border); color: var(--muted); font-size: 14px; text-align: center; }
.am { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.am.is-open { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.am-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.am-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--primary); color: var(--on-primary); flex: none; }
.am-head b { font-size: 14px; font-variant-numeric: tabular-nums; }
.am-type { flex: 1; text-align: right; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-del { width: 28px; height: 28px; border-radius: 8px; border: none; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; flex: none; }
.am-del:hover { background: var(--danger-soft); color: var(--danger); }
.am-body { display: grid; gap: 12px; padding: 4px 12px 14px; border-top: 1px solid var(--border); padding-top: 12px; animation: rise .25s var(--ease) both; }
.am-row { display: flex; align-items: center; gap: 10px; }
.am-l { width: 82px; flex: none; font-size: 13px; font-weight: 650; color: var(--muted); }
.am-row input[type=range] { flex: 1; accent-color: var(--primary); }
.scrub { -webkit-appearance: none; appearance: none; width: min(100%, 420px); height: 18px; margin: 0; padding: 0; display: block; background: transparent; border: 0; outline: 0; cursor: pointer; }
.scrub::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--border); border: 0; }
.scrub::-moz-range-track { height: 4px; border-radius: 4px; background: var(--border); border: 0; }
.scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.scrub::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.scrub:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
#zm-body { display: flex; flex-direction: column; gap: 10px; }
#zm-body[hidden] { display: none; }
.zm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.zm-list { display: flex; flex-direction: column; gap: 6px; }
.zm-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.zm-row .zm-t { border: none; background: none; color: var(--accent); font: 700 13px/1 "Noto Sans", sans-serif; font-variant-numeric: tabular-nums; cursor: pointer; padding: 4px 2px; min-width: 70px; text-align: left; }
.zm-row .seg2 { order: 5; flex: 1 1 100%; display: flex; }
.zm-row .seg2 button { flex: 1; height: 26px; padding: 0 6px; font-size: 12px; }
.zm-row .zm-d { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.zm-row .zm-d button, .zm-row .zm-x { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); cursor: pointer; font: 700 14px/1 "Noto Sans", sans-serif; display: inline-flex; align-items: center; justify-content: center; }
.zm-row .zm-d span { width: 40px; text-align: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.zm-row .zm-x svg { width: 14px; height: 14px; }
.am-dur { width: 44px; text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.am-time { display: flex; align-items: center; gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.seg2 { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg2 button { height: 30px; padding: 0 12px; border: none; border-radius: 8px; background: transparent; color: var(--muted); font: 650 13px/1 "Noto Sans", sans-serif; cursor: pointer; }
.seg2 button.is-on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.af { display: grid; gap: 5px; }
.af > span { font-size: 13px; font-weight: 650; color: var(--muted); }
.af input, .af select { min-height: 38px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 15px/1.3 "Noto Sans", sans-serif; width: 100%; }
.af select { cursor: pointer; }
.af-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lane-head { display: flex; gap: 14px; align-items: baseline; padding: 0 16px 10px; flex-wrap: wrap; }
.lane { position: relative; margin: 0 16px; height: 86px; cursor: pointer; user-select: none; touch-action: none; }
.lane-ruler { position: relative; height: 22px; }
.lane-ruler span { position: absolute; top: 2px; transform: translateX(-50%); font: 600 11px/1 ui-monospace, Menlo, monospace; color: var(--muted); }
.lane-track { position: relative; height: 56px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.lb { position: absolute; top: 6px; bottom: 6px; border-radius: 9px; background: linear-gradient(115deg, var(--glow-a), var(--glow-c)); color: #fff;
  display: grid; place-items: center; font-weight: 800; cursor: grab; box-shadow: 0 2px 8px rgba(0,0,0,.2); min-width: 18px; }
.lb.up { background: linear-gradient(115deg, var(--glow-c), var(--glow-b)); }
.lb.is-sel { outline: 3px solid var(--text); outline-offset: 1px; }
.lane .tl-head { top: 18px; }

/* вид анимаций: шрифт и размер */
.look { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.look-row { display: grid; gap: 8px; }
.look-row:has(input[type=range]) { grid-template-columns: auto 1fr 48px; align-items: center; }
.look-l { font-size: 13px; font-weight: 700; color: var(--muted); }
.look input[type=range] { accent-color: var(--primary); width: 100%; }
.fontpick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.fp { display: grid; gap: 2px; justify-items: center; padding: 8px 4px 6px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.fp small { font: 600 10px/1.2 "Noto Sans", sans-serif; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fp:hover { transform: translateY(-1px); }
.fp.is-on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

/* выбор шаблона: карточки с живыми мини-превью */
.tp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tp { display: grid; gap: 3px; text-align: left; padding: 6px 6px 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; font-family: "Noto Sans", sans-serif; }
.tp:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tp.is-on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.tp b { font-size: 13px; padding: 0 2px; }
.tp small { font-size: 11px; color: var(--muted); line-height: 1.25; padding: 0 2px; }
.tp-thumb { position: relative; display: block; width: 100%; aspect-ratio: 1080 / 960; border-radius: 8px; overflow: hidden; background: #111; }
.tp-thumb .rs-panel { transform-origin: 0 0; }
.am-ai { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); color: var(--text); line-height: 1.45; }
.ae-actions { grid-template-columns: auto 1fr; }

/* карточки роликов: кадр, срок хранения, страницы */
.videos { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.video-card { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 12px; align-items: start; }
.vc-thumb { position: relative; width: 96px; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.vc-thumb svg { width: 26px; height: 26px; opacity: .5; }
.vc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vc-body { display: grid; gap: 6px; min-width: 0; }
.expire { display: inline-flex; align-items: center; gap: 5px; justify-self: start; font-size: 12px; font-weight: 700; color: var(--muted); padding: 3px 9px; border-radius: 999px; background: var(--surface-2); }
.expire svg { width: 13px; height: 13px; }
.expire.warn { background: var(--warm-soft); color: #9A6100; }
.expire.danger { background: var(--danger-soft); color: var(--danger); }
:root[data-theme="dark"] .expire.warn { color: var(--warm); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .expire.warn { color: var(--warm); } }
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pg { min-width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: var(--text); border: 1px solid var(--border); background: var(--surface); }
.pg:hover { text-decoration: none; background: var(--surface-2); }
.pg.is-on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.keep-note { text-align: center; margin-top: 18px; }
.look-title { font-size: 15px; }

/* «О чём вы снимаете»: до 2000 знаков, высота не больше 260 px */
.about-box { resize: none; max-height: 260px; overflow-y: auto; }
.about-hint { display: flex; justify-content: space-between; gap: 12px; }
.about-hint .counter { flex: none; font-variant-numeric: tabular-nums; }
.about-hint .counter.near { color: var(--danger); font-weight: 700; }

.fontpick { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.fp { font-size: 20px; }
.look-inline { grid-template-columns: 92px 1fr; align-items: center; }
.look .seg2 { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.look .seg2 button { padding: 0 6px; }
/* «Мой стиль»: подложка с названием сети шире, буквы не у края */
.social { grid-template-columns: 172px auto minmax(0, 1fr); }
.social-pick { padding: 0 16px 0 14px; }
@media (max-width: 520px) { .social { grid-template-columns: 150px auto minmax(0, 1fr); } }
.look .seg2 button { white-space: nowrap; font-size: 12px; }

/* карточка ролика: без значка на кадре, срок удаления — внизу карточки */
.video-card { align-items: stretch; }
.vc-body { display: flex; flex-direction: column; gap: 6px; }
.vc-body .status-tag { align-self: flex-start; }
.vc-body .expire { margin-top: auto; align-self: flex-start; }
.tp.is-off { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
/* переключатель рамок соцсетей — ярлычки, прижатые к правому краю видео, текст повёрнут на 90° */
.pv-wrap { position: relative; }
.ui-pick { position: absolute; left: 100%; top: 18px; display: flex; flex-direction: column; gap: 3px; }
.ui-pick button { writing-mode: vertical-rl; padding: 9px 6px; border: 1px solid var(--border); border-left: none; border-radius: 0 10px 10px 0;
  background: var(--surface-2); color: var(--muted); font: 700 11px/1 "Noto Sans", sans-serif; letter-spacing: .03em; cursor: pointer; transition: background-color .15s, color .15s, padding .15s; }
.ui-pick button:hover { color: var(--text); }
.ui-pick button.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); padding-right: 9px; }

/* ── шаг «Субтитры» ── */
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.tab { height: 38px; border: none; border-radius: 9px; background: transparent; color: var(--muted); font: 700 15px/1 "Noto Sans", sans-serif; cursor: pointer; }
.tab.is-on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
[data-pane] { display: grid; gap: 14px; }
[data-pane][hidden] { display: none !important; }
.sub-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ps { display: grid; gap: 4px; padding: 8px 8px 10px; text-align: left; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  font-family: "Noto Sans", sans-serif; transition: border-color .15s, box-shadow .15s, transform .15s; }
.ps:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ps.is-on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.ps b { font-size: 13px; } .ps small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.ps-sample { display: block; padding: 14px 6px; border-radius: 8px; text-align: center; font-size: 15px; line-height: 1.15; color: var(--tx);
  background: radial-gradient(circle at 30% 20%, #5b6a7d, #2a3442); text-shadow: 0 1px 2px rgba(0,0,0,.8); white-space: nowrap; overflow: hidden; }
.ps-sample .on { color: var(--hl); }
.ps-sample[data-anim="box"] .on { background: var(--hl); color: #fff; border-radius: 5px; padding: 0 4px; text-shadow: none; }
.ps-sample[data-anim="neon"] .on { text-shadow: 0 0 8px var(--hl), 0 0 16px var(--hl); }
.ps-sample[data-anim="pop"] .on { display: inline-block; transform: scale(1.12); }
.ps-sample[data-anim="none"] .on { color: inherit; }
.ps-sample[data-anim="fade"] span:last-child { opacity: .35; }
.ps-sample[data-anim="karaoke"] .on { background: linear-gradient(90deg, var(--hl) 55%, var(--tx) 55%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.my-tpls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.my-tpls:empty { display: none; }
.tpl { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 650; cursor: pointer; }
.tpl.is-on { border-color: var(--primary); color: var(--primary); }
.tpl button { width: 22px; height: 22px; border-radius: 50%; border: none; background: transparent; color: var(--muted); cursor: pointer; }
.tpl button:hover { background: var(--danger-soft); color: var(--danger); }
.anim-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.anim-pick button { padding: 7px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 13px/1 "Noto Sans", sans-serif; cursor: pointer; }
.anim-pick button.is-on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.look .color-row { padding: 6px 8px; }
.look .swatch-btn { width: 34px; height: 28px; }
.cues { display: grid; gap: 6px; }
.cue { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 4px; border-radius: 10px; transition: background-color .15s; }
.cue.is-now { background: var(--primary-soft); }
.cue-t { border: none; background: transparent; font: 700 12px/1 ui-monospace, Menlo, monospace; color: var(--muted); cursor: pointer; padding: 6px 4px; }
.cue input { min-height: 36px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 14px/1.3 "Noto Sans", sans-serif; width: 100%; }
.lc { position: absolute; top: 10px; bottom: 10px; border-radius: 5px; background: color-mix(in srgb, var(--primary) 45%, transparent); cursor: pointer; }
.lc.is-now { background: var(--primary); }
.ps-sample { font-size: 17px; }
.cue textarea { min-height: 52px; max-height: 120px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 500 14px/1.35 "Noto Sans", sans-serif; width: 100%; resize: vertical; }
.cue { align-items: start; }
.cue-t { padding-top: 10px; }
.cut-btn { margin-top: 10px; font-size: 14px; }
.mode-pick button { height: 38px; font-size: 14px; }
.thesis-box { display: grid; gap: 8px; }
.thesis-box[hidden] { display: none; }

/* ── подсказки «?» ── */
.q { position: relative; display: inline-flex; vertical-align: middle; margin-left: 4px; }
.q-btn { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font: 800 12px/1 "Noto Sans", sans-serif; cursor: help; display: grid; place-items: center; padding: 0; transition: background-color .15s, color .15s, border-color .15s; }
.q-btn:hover, .q.is-open .q-btn { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.q-tip { position: absolute; left: 50%; bottom: calc(100% + 10px); z-index: 40; width: max-content; max-width: 280px; padding: 10px 12px; border-radius: 12px;
  background: var(--text); color: var(--bg); font: 500 13px/1.45 "Noto Sans", sans-serif; text-transform: none; letter-spacing: 0; text-align: left; white-space: normal;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); opacity: 0; visibility: hidden; transform: translate(-50%, 6px); transition: opacity .18s, transform .18s var(--ease), visibility .18s; pointer-events: none; }
.q-tip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--text); }
.q:hover .q-tip, .q:focus-within .q-tip, .q.is-open .q-tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.q.right .q-tip { left: 0; transform: translate(0, 6px); }
.q.right:hover .q-tip, .q.right:focus-within .q-tip, .q.right.is-open .q-tip { transform: translate(0, 0); }
.q.right .q-tip::after { left: 14px; }
.tpl-row { display: inline-flex; align-items: center; gap: 4px; }
.ed-side .q-tip { max-width: 240px; }
.ed-side .q:first-child .q-tip, .ed-side h2 .q .q-tip { left: 0; transform: translate(-20%, 6px); }

/* ── справка ── */
.help-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; margin-bottom: 24px; }
.help-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 28px; }
.help-steps a { display: grid; gap: 4px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: transform .2s var(--ease), border-color .2s; }
.help-steps a:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.help-steps b { font-size: 24px; color: var(--primary); }
.help-steps span { font-weight: 700; font-size: 14px; }
.acc { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); margin-bottom: 10px; overflow: hidden; box-shadow: var(--shadow); }
.acc summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 18px 20px; font-weight: 750; font-size: 17px; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary .n { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 15px; flex: none; }
.acc summary .chev { margin-left: auto; width: 22px; height: 22px; color: var(--muted); transition: transform .3s var(--ease); }
.acc[open] summary .chev { transform: rotate(180deg); }
.acc .acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--ease); }
.acc[open] .acc-body { grid-template-rows: 1fr; }
.acc .acc-in { overflow: hidden; }
.acc .acc-in > div { padding: 0 20px 20px 66px; color: var(--text); line-height: 1.6; }
.acc .acc-in p { margin: 0 0 10px; }
.acc .acc-in ul, .acc .acc-in ol { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 6px; }
.acc .tip { margin-top: 6px; padding: 10px 14px; border-radius: 12px; background: var(--warm-soft); font-size: 14px; }
@media (max-width: 900px) { .help-steps { grid-template-columns: repeat(3, 1fr); } .acc .acc-in > div { padding-left: 20px; } }
.help-link { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 650; font-size: 15px; }
.help-link:hover, .help-link.is-on { background: var(--surface-2); text-decoration: none; }
.help-link svg { width: 18px; height: 18px; }
@media (max-width: 600px) { .help-link span { display: none; } }
.acc { scroll-margin-top: 90px; }
/* в прокручиваемых боковых панелях подсказки открываются вниз — сверху их обрезает край панели */
.ed-side .q-tip { bottom: auto; top: calc(100% + 10px); }
.ed-side .q-tip::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--text); }
.tg-btn { background: linear-gradient(180deg, #37AEE2, #1E96C8); color: #fff; box-shadow: 0 6px 18px rgba(30,150,200,.3); }
.tg-btn svg { width: 18px; height: 18px; }

/* ── шаг «Готово» ── */
.cover-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 40px; height: 24px; border-radius: 12px; background: var(--border); position: relative; transition: background-color .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }
#cv-body { display: grid; gap: 10px; }
#cv-body[hidden] { display: none; }
.frames { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.fr { display: grid; gap: 3px; padding: 3px; border-radius: 9px; border: 2px solid transparent; background: var(--surface); cursor: pointer; font: 600 10px/1 ui-monospace, Menlo, monospace; color: var(--muted); }
.fr canvas { width: 100%; aspect-ratio: 9 / 16; height: auto; border-radius: 6px; background: var(--surface-2); display: block; }
.fr.is-on { border-color: var(--primary); color: var(--primary); }
.cv-colors { display: grid; gap: 6px; }
.render-box .btn { min-height: 46px; }
.done { display: grid; gap: 10px; animation: rise .4s var(--ease) both; }
.done[hidden] { display: none; }
.done-ok { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ok); }
.done-ok svg { width: 20px; height: 20px; }
.muted-on { opacity: .75; font-weight: 600; }
.final-video { display: block; height: calc(var(--ed-top) - 190px); aspect-ratio: 9 / 16; border-radius: 16px; background: #000; }
.ed-preview .pv-frame[hidden], .final-video[hidden] { display: none !important; }
#sfx-body { display: grid; gap: 10px; }
#sfx-body[hidden] { display: none; }
.sfx-try { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-btn { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 12px/1 "Noto Sans", sans-serif; cursor: pointer; }
.chip-btn:hover { background: var(--primary-soft); color: var(--primary); }

/* меню «⋯» на карточке ролика */
.vc-wrap { position: relative; animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
.vc-wrap .video-card { animation: none; height: 100%; padding-right: 44px; }
.vc-menu { position: absolute; top: 8px; right: 8px; }
.vc-menu summary { list-style: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--muted);
  font-size: 20px; line-height: 1; letter-spacing: 1px; }
.vc-menu summary::-webkit-details-marker { display: none; }
.vc-menu summary:hover, .vc-menu[open] summary { background: var(--surface-2); color: var(--text); }
.vc-pop { position: absolute; right: 0; top: 36px; z-index: 20; min-width: 190px; padding: 6px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: 0 14px 34px rgba(0,0,0,.18); animation: rise .18s var(--ease) both; }
.vc-del { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border: none; border-radius: 8px; background: transparent;
  color: var(--danger); font: 650 14px/1 "Noto Sans", sans-serif; cursor: pointer; text-align: left; }
.vc-del:hover { background: var(--danger-soft); }
.vc-del svg { width: 16px; height: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.grid-3 .field { margin: 0; }
@media (max-width: 800px) { .grid-3 { grid-template-columns: 1fr; } }
input:disabled { opacity: .65; }
h1 > svg, h2 > svg, h3 > svg { width: 22px; height: 22px; vertical-align: -3px; margin-right: 4px; }
/* редакторы на всю высоту экрана: под шапкой, шагами и заголовком; снизу — только дорожка (где она есть) */
.anim-editor { --ed-top: clamp(420px, calc(100vh - 420px), 1000px); }
#fe.anim-editor { --ed-top: clamp(460px, calc(100vh - 270px), 1200px); }
.editor-page { margin-bottom: -40px; }
.sfx-packs { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.sfx-packs button { height: auto !important; padding: 7px 4px !important; display: grid; gap: 2px; line-height: 1.1; }
.sfx-packs small { font-size: 10px; font-weight: 500; color: var(--muted); }
/* своя обложка */
#cv-frame-box, #cv-upload-box { display: grid; gap: 8px; }
#cv-frame-box[hidden], #cv-upload-box[hidden] { display: none; }
.cover-drop { position: relative; display: grid; justify-items: center; gap: 6px; padding: 22px 14px; border-radius: 14px; cursor: pointer; text-align: center; overflow: hidden;
  border: 2px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); background: color-mix(in srgb, var(--primary-soft) 45%, transparent); transition: background-color .2s, border-color .2s; }
.cover-drop:hover, .cover-drop.is-over { background: var(--primary-soft); border-color: var(--primary); }
.cover-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cover-drop:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }
.cover-drop .cd-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.cover-drop .cd-ic svg { width: 22px; height: 22px; }
.cover-drop .cd-title { font-weight: 750; font-size: 15px; }
.cover-drop .cd-hint { font-size: 12px; color: var(--muted); }
.cover-drop.has { grid-template-columns: 64px 1fr; justify-items: start; text-align: left; padding: 10px; }
.cover-drop.has .cd-ic { display: none; }
.cover-drop img { grid-row: span 2; width: 64px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; }
.cover-rec { font-size: 13px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; background: var(--warm-soft); }
.motif-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.motif-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--primary); }
.mchip svg { width: 18px; height: 18px; }
/* боковые панели: ничего не шире панели */
.ed-side, .ed-side > *, .look, .look > *, .look-row > *, #cv-body > *, #sfx-body > * { min-width: 0; }
.ed-side { overflow-x: hidden; }
.look .seg2 button { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cover-drop.has > span { min-width: 0; }
.cover-head { flex-wrap: wrap; }
.sfx-packs { grid-auto-flow: row !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.sfx-packs button { white-space: normal !important; text-overflow: clip !important; }
.sfx-packs small { white-space: normal; }
.sfx-try { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sfx-try-l { grid-column: 1 / -1; }
.sfx-try .chip-btn { padding: 6px 2px; text-align: center; }

/* палитры: плитки цветов всегда по нижнему краю карточки и по центру */
.palette { display: flex; flex-direction: column; }
.palette .swatches { margin-top: auto; padding-top: 10px; justify-content: center; }
.th-ic { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 6px; background: var(--primary); color: var(--on-primary); vertical-align: -5px; }
.th-ic svg { width: 13px; height: 13px; fill: currentColor; }
/* кнопки-переключатели: значок и текст ровно по центру */
.seg2 button { display: inline-flex; align-items: center; justify-content: center; }
.th-ic { vertical-align: middle; flex: none; }
#word-anim[hidden] { display: none; }
