/* ============================================================
   ALTER — Telegram Mini App
   Светлая тема «Слоновая кость»: тёплый светлый фон, графитовый текст,
   бронзовый акцент. Видео и превью роликов — в тёмных зонах (конец файла).
   Без неона, свечения и тяжёлых градиентов.
   ============================================================ */

/* Текст — Golos Text (сделан для русского интерфейса), заголовки — книжный Literata. Оба OFL, из своей библиотеки. */
@font-face { font-family: "Golos Text"; src: url("/fontlib/golos-text/golos-text-400.ttf") format("truetype"); font-weight: 300 500; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url("/fontlib/golos-text/golos-text-600.ttf") format("truetype"); font-weight: 600 650; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url("/fontlib/golos-text/golos-text-800.ttf") format("truetype"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "Literata"; src: url("/fontlib/literata/literata-700.ttf") format("truetype"); font-weight: 500 900; font-display: swap; }

:root {
  /* Имена переменных исторические: --deep-graphite — фон, --graphite — карточки, --ivory — основной текст */
  --deep-graphite: #F4EFE7;   /* главный фон — слоновая кость */
  --graphite: #FFFDF9;        /* карточки */
  --graphite-2: #EFE8DD;      /* поля, нажатые состояния */
  --graphite-3: #E2D8C8;
  --bronze: #8C6236;          /* основной акцент */
  --bronze-warm: #7E5730;     /* акцентный текст и значки */
  --bronze-dim: rgba(140, 98, 54, 0.10);
  --ivory: #1B1915;           /* основной текст — графит */
  --stone: #6E675D;           /* вторичный текст */
  --line: rgba(27, 25, 21, 0.09);
  --line-strong: rgba(27, 25, 21, 0.17);
  --danger: #A84E36;          /* терракотовый — только для ошибок */
  --on-accent: #FFFDF9;       /* текст на бронзе */
  --ink: #1B1915;             /* тёмные акцентные карточки */
  --gold: #D2AE74;            /* золото на тёмном */

  --font: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Literata", Georgia, "Times New Roman", serif;
  --radius: 16px;
  --radius-lg: 18px;
  --radius-sm: 12px;
  --gutter: 16px;
  --tabbar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { background: var(--deep-graphite); }
body {
  background: var(--deep-graphite);
  color: var(--ivory);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100vh);
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { display: block; max-width: 100%; }
a { color: var(--bronze-warm); }
:focus-visible { outline: 2px solid var(--bronze-warm); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------------- каркас ---------------- */
.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  min-height: 100vh;
}
.app.no-tabbar { padding-bottom: calc(var(--safe-bottom) + 132px); }
.screen { animation: enter .28s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  height: 56px;
  margin: 0 calc(var(--gutter) * -1) 4px;
  padding: 0 var(--gutter);
  position: sticky; top: 0; z-index: 5;
  background: var(--deep-graphite);
}
.topbar .wordmark { text-align: center; font-size: 13px; }
.icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border-radius: 12px; border: 0; background: transparent; color: var(--ivory);
}
.icon-btn:active { background: var(--graphite-2); }
.icon-btn svg { width: 22px; height: 22px; }

.wordmark {
  font-weight: 600;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  padding-left: 0.38em; /* компенсация трекинга, чтобы слово было по центру */
  color: var(--ivory);
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.25; }
h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--stone); }
.small { font-size: 13px; }
.center { text-align: center; }
.section { margin-top: 24px; }
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------------- splash ---------------- */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: var(--deep-graphite);
  transition: opacity .35s var(--ease), visibility .35s;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-mark { width: 84px; animation: breathe 1.6s ease-in-out infinite; }
.splash-word { font-size: 18px; }
@keyframes breathe { 50% { opacity: .55; } }

/* ---------------- главный экран ---------------- */
.brand {
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 0 22px;
}
.brand-mark { width: 92px; margin-bottom: 20px; }
.brand-word { font-size: 30px; }
.brand-slogan { margin-top: 6px; color: var(--stone); font-size: 14px; }

.upload-card {
  background: var(--graphite);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  text-align: center;
}
.upload-card .upload-icon {
  width: 52px; height: 52px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 14px; border: 1px solid var(--line-strong); color: var(--bronze-warm);
}
.upload-card .upload-icon svg { width: 24px; height: 24px; }
.upload-card h2 { font-size: 19px; }
.upload-card p { margin: 6px 0 18px; color: var(--stone); font-size: 14px; }
.upload-card.dragover { border-color: var(--bronze); background: var(--graphite-2); }
.upload-hint { margin-top: 12px; font-size: 12px; color: var(--stone); }

/* ---------------- кнопки ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; padding: 0 20px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-size: 15px; font-weight: 600; letter-spacing: 0.005em;
  transition: transform .12s var(--ease), background-color .2s, opacity .2s;
  user-select: none;
}
.btn:active { transform: scale(.985); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--bronze); color: var(--on-accent); }
.btn-primary:active { background: #74512C; }
.btn-secondary { background: var(--graphite); color: var(--ivory); border-color: var(--line-strong); }
.btn-secondary:active { background: var(--graphite-2); }
.btn-ghost { background: transparent; color: var(--stone); min-height: 44px; font-weight: 500; }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(194, 122, 98, .35); }
.btn[disabled], .btn.loading { opacity: .5; pointer-events: none; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; width: auto; border-radius: var(--radius-sm); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.sticky-action {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  padding: 10px var(--gutter) calc(12px + var(--safe-bottom));
  background: var(--deep-graphite);
  border-top: 1px solid var(--line);
}
.sticky-action .inner { max-width: 520px; margin: 0 auto; }
.sticky-action .hint { text-align: center; font-size: 12px; color: var(--stone); margin-bottom: 8px; }
.sticky-action .hint.warn { color: var(--danger); }

/* ---------------- карточки и списки ---------------- */
.card {
  background: var(--graphite);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.card.flush { padding: 0; overflow: hidden; }
.list { background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.list-row:first-child { border-top: 0; }
.list-row .label { flex: 1; min-width: 0; }
.list-row .label .title { font-weight: 500; }
.list-row .label .sub { font-size: 13px; color: var(--stone); margin-top: 2px; }
.list-row.column { flex-direction: column; align-items: stretch; }
.list-row.tap { cursor: pointer; }
.list-row.tap:active { background: var(--graphite-2); }
.chevron { color: var(--stone); width: 18px; height: 18px; flex: none; }

/* ---------------- переключатели ---------------- */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;
}
.segmented button {
  min-height: 48px; border-radius: 14px;
  background: var(--graphite); border: 1px solid var(--line-strong); color: var(--ivory);
  font-weight: 600; font-size: 15px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.segmented.compact button { min-height: 38px; font-size: 13px; font-weight: 500; border-radius: 11px; }
.segmented button[aria-pressed="true"] { background: var(--bronze); border-color: var(--bronze); color: var(--on-accent); }
.segmented button:disabled { opacity: .4; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--graphite-2); border: 1px solid var(--line-strong); color: var(--ivory);
  font-size: 14px; font-weight: 500;
}
.chip[aria-pressed="true"] { border-color: var(--bronze); color: var(--bronze-warm); background: var(--bronze-dim); }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--graphite-3); transition: background-color .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 1px 3px rgba(27, 25, 21, .25); transition: transform .2s var(--ease);
}
.switch input:checked + .track { background: var(--bronze); }
.switch input:checked + .track::after { transform: translateX(20px); }

.field {
  width: 100%; min-height: 48px; padding: 12px 14px;
  background: var(--graphite-2); border: 1px solid var(--line-strong); border-radius: 14px;
  color: var(--ivory); resize: vertical;
}
.field::placeholder { color: var(--stone); }
.field:focus { outline: none; border-color: var(--bronze); }

/* ---------------- видео и превью ---------------- */
.media {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  background: #000; border: 1px solid var(--line);
}
.media video, .media img { width: 100%; max-height: 52vh; object-fit: contain; background: #000; }
.media-meta { display: flex; align-items: center; gap: 12px; padding: 14px 4px 0; }
.media-meta .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta .sub { font-size: 13px; color: var(--stone); }

.banner {
  border-radius: var(--radius); padding: 14px;
  background: var(--bronze-dim); border: 1px solid rgba(166, 120, 73, .35);
}
.banner .text { font-size: 14px; }
.banner .actions { display: flex; gap: 8px; margin-top: 12px; }
.banner.neutral { background: var(--graphite-2); border-color: var(--line); }
.banner.error { background: rgba(194, 122, 98, .08); border-color: rgba(194, 122, 98, .35); color: var(--ivory); }

/* ---------------- таймлайн ручной обрезки ---------------- */
.timeline { position: relative; height: 56px; margin: 14px 0 8px; user-select: none; touch-action: none; }
.timeline .strip {
  position: absolute; inset: 0; border-radius: 10px; overflow: hidden;
  background: var(--graphite-2) center/100% 100% no-repeat;
}
.timeline .shade { position: absolute; top: 0; bottom: 0; background: rgba(244, 239, 231, .72); }
.timeline .window {
  position: absolute; top: 0; bottom: 0; border: 2px solid var(--bronze); border-radius: 10px; pointer-events: none;
}
.timeline .handle {
  position: absolute; top: -4px; bottom: -4px; width: 22px; margin-left: -11px;
  display: grid; place-items: center; cursor: ew-resize; z-index: 2;
}
.timeline .handle::before {
  content: ""; width: 10px; height: 100%; border-radius: 6px; background: var(--bronze);
}
.timeline .handle::after {
  content: ""; position: absolute; width: 2px; height: 18px; border-radius: 2px; background: var(--ivory);
}
.time-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.time-inputs label { font-size: 12px; color: var(--stone); display: block; margin-bottom: 4px; }
.time-inputs .field { text-align: center; font-variant-numeric: tabular-nums; }

/* ---------------- прогресс ---------------- */
.progress-screen { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 28px; }
.ring { position: relative; width: 196px; height: 196px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .bg { stroke: var(--graphite-3); }
.ring .fg { stroke: var(--bronze); stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .big { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ring .big small { font-size: 16px; color: var(--stone); font-weight: 500; }
.ring .pct { font-size: 13px; color: var(--stone); margin-top: 2px; font-variant-numeric: tabular-nums; }
.progress-title { margin-top: 26px; }
.progress-caption { margin: 8px auto 0; max-width: 300px; color: var(--stone); font-size: 14px; }
.stages { width: 100%; margin-top: 26px; text-align: left; }
.stage { display: flex; align-items: center; gap: 12px; padding: 9px 4px; color: var(--stone); font-size: 14px; }
.stage .dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center; border: 1.5px solid var(--graphite-3);
}
.stage .dot svg { width: 13px; height: 13px; }
.stage.done { color: var(--ivory); }
.stage.done .dot { background: var(--bronze); border-color: var(--bronze); color: var(--on-accent); }
.stage.active { color: var(--ivory); font-weight: 500; }
.stage.active .dot { border-color: var(--bronze); }
.stage.active .dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bronze); animation: breathe 1.2s infinite; }
.stage.failed { color: var(--danger); }
.stage.failed .dot { border-color: var(--danger); }

.bar { height: 6px; border-radius: 999px; background: var(--graphite-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--bronze); width: 0; transition: width .25s linear; }

/* ---------------- результат ---------------- */
.done-mark {
  width: 96px; height: 96px; border-radius: 50%; margin: 20px auto 18px;
  display: grid; place-items: center; border: 2px solid var(--bronze); color: var(--bronze-warm);
}
.done-mark svg { width: 42px; height: 42px; }
.done-mark.error { border-color: var(--danger); color: var(--danger); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: left; min-height: 92px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
}
.tile:active { background: var(--graphite-2); }
.tile svg { width: 22px; height: 22px; color: var(--bronze-warm); }
.tile .t { font-weight: 600; font-size: 14px; }
.tile .s { font-size: 12px; color: var(--stone); }

/* ---------------- сетки вариантов и обложек ---------------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.thumb {
  position: relative; border-radius: 14px; overflow: hidden; background: var(--graphite-2);
  border: 1px solid var(--line); aspect-ratio: 9 / 16; padding: 0; width: 100%;
}
.thumb.landscape { aspect-ratio: 16 / 9; }
.thumb.square { aspect-ratio: 1; }
.thumb.portrait45 { aspect-ratio: 4 / 5; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge-l, .thumb .badge-r {
  position: absolute; bottom: 8px; padding: 3px 7px; border-radius: 8px;
  background: rgba(14, 14, 13, .72); font-size: 11px; font-weight: 500; color: var(--ivory);
  font-variant-numeric: tabular-nums;
}
.thumb .badge-l { left: 8px; }
.thumb .badge-r { right: 8px; }
.thumb .badge-top {
  position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 8px;
  background: var(--bronze); color: var(--on-accent); font-size: 11px; font-weight: 600;
}
.thumb.failed { display: grid; place-items: center; color: var(--stone); font-size: 13px; }
.thumb .play {
  position: absolute; inset: 0; margin: auto; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(14, 14, 13, .55); color: var(--ivory);
}
.thumb .play svg { width: 18px; height: 18px; margin-left: 2px; }

/* ---------------- история ---------------- */
.project-card {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left;
  padding: 12px; background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius);
}
.project-card:active { background: var(--graphite-2); }
.project-card + .project-card { margin-top: 10px; }
.project-card .pv {
  width: 64px; height: 64px; border-radius: 12px; flex: none; overflow: hidden;
  background: var(--graphite-2); display: grid; place-items: center; color: var(--stone);
}
.project-card .pv img { width: 100%; height: 100%; object-fit: cover; }
.project-card .pv svg { width: 22px; height: 22px; }
.project-card .info { flex: 1; min-width: 0; }
.project-card .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-card .meta { font-size: 13px; color: var(--stone); margin-top: 3px; }
.status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  color: var(--stone); margin-top: 6px;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.done { color: var(--bronze-warm); }
.status.processing, .status.queued { color: var(--ivory); }
.status.processing::before { animation: breathe 1.2s infinite; }
.status.error { color: var(--danger); }

.empty { text-align: center; color: var(--stone); padding: 36px 16px; font-size: 14px; }
.empty svg { width: 28px; height: 28px; margin: 0 auto 10px; display: block; color: var(--graphite-3); }

/* ---------------- заголовки ---------------- */
.title-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
.title-item:first-child { border-top: 0; }
.title-item .txt { flex: 1; font-size: 15px; }

/* ---------------- профиль ---------------- */
.avatar {
  width: 64px; height: 64px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--graphite-2); border: 1px solid var(--line-strong);
  font-size: 24px; font-weight: 600; color: var(--bronze-warm);
}
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--stone); }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--bronze-warm); background: var(--bronze-dim);
}

/* ---------------- помощь ---------------- */
.help-list { background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.help-item + .help-item { border-top: 1px solid var(--line); }
.help-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 14px 16px; cursor: pointer; list-style: none; font-weight: 500;
}
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary .chevron { transition: transform .2s var(--ease); }
.help-item[open] summary { color: var(--bronze-warm); }
.help-item[open] summary .chevron { transform: rotate(90deg); color: var(--bronze-warm); }
.help-body { padding: 0 16px 16px; color: var(--ivory); font-size: 14px; }
.help-body p { margin: 0 0 10px; color: var(--stone); }
.help-body ol, .help-body ul { margin: 0 0 10px; padding-left: 20px; }
.help-body li { margin-bottom: 6px; }
.help-body li::marker { color: var(--bronze); }

/* ---------------- нижняя навигация ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: rgba(255, 253, 249, .96); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tabbar .inner { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 520px; }
.tabbar button {
  height: var(--tabbar-h); border: 0; background: transparent; color: var(--stone);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 11px; font-weight: 500; position: relative;
}
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button[aria-current="page"] { color: var(--bronze-warm); }
.tabbar button[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--bronze);
}

/* ---------------- шторка ---------------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30; background: rgba(27, 25, 21, .42);
  animation: fade .2s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  max-width: 520px; margin: 0 auto; max-height: 92vh; overflow-y: auto;
  background: var(--graphite); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 10px var(--gutter) calc(18px + var(--safe-bottom));
  animation: rise .28s var(--ease);
}
.sheet .grabber { width: 38px; height: 4px; border-radius: 4px; background: var(--graphite-3); margin: 0 auto 14px; }
.sheet .media video, .sheet .media img { max-height: 58vh; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* ---------------- уведомления ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); z-index: 60;
  transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--graphite-2); color: var(--ivory); border: 1px solid var(--line-strong);
  padding: 12px 16px; border-radius: 14px; font-size: 14px; text-align: center;
  animation: rise .25s var(--ease);
}
.toast.error { border-color: rgba(194, 122, 98, .5); }

/* ---------------- загрузка файла ---------------- */
.upload-progress { padding: 48px 0 0; text-align: center; }
.upload-progress .file { margin: 16px 0 22px; color: var(--stone); font-size: 14px; word-break: break-word; }
.upload-progress .bar { height: 8px; }
.upload-progress .pct { margin-top: 10px; font-variant-numeric: tabular-nums; color: var(--stone); font-size: 13px; }

.skeleton { background: var(--graphite); border-radius: var(--radius); height: 72px; animation: breathe 1.4s infinite; }
.skeleton + .skeleton { margin-top: 10px; }
.noscript { padding: 24px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   Часть 2: Уникализатор 2.0, Автомонтажёр, Клипмейкер, субтитры, бренд
   ============================================================ */
.page-head { padding: 22px 0 16px; }
.page-head p { margin: 6px 0 0; font-size: 14px; }
.section-kicker { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--bronze-warm); margin: 6px 0 12px; }
.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.clamp2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* «Дополнительно» — свёрнуто по умолчанию */
.advanced { background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.advanced > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; padding: 0 16px; font-weight: 600; font-size: 15px;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary .chevron { width: 18px; height: 18px; color: var(--stone); transition: transform .2s var(--ease); }
.advanced[open] > summary .chevron { transform: rotate(90deg); }
.advanced-body { padding: 0 12px 12px; }
.advanced-body > .list { border-radius: var(--radius); }
.chip.static { cursor: default; }

/* страница проекта */
.hub-head { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
.hub-head h2 { font-size: 18px; }
.hub-thumb {
  position: relative; width: 96px; aspect-ratio: 9 / 16; max-height: 150px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: var(--graphite-2); padding: 0; color: var(--stone);
  display: grid; place-items: center;
}
.hub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hub-thumb .play, .edit-thumb .play {
  position: absolute; width: 32px; height: 32px; border-radius: 50%; background: rgba(14, 14, 13, .72);
  display: grid; place-items: center; color: var(--ivory);
}
.hub-thumb .play svg, .edit-thumb .play svg { width: 14px; height: 14px; margin-left: 2px; }
.tiles .tile { text-align: left; color: var(--ivory); }
.intel .title { font-weight: 600; }

/* описание варианта: ключ — значение */
.kv { display: grid; gap: 6px; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv-row .k { color: var(--stone); flex-shrink: 0; }
.kv-row .v { text-align: right; }

.command { display: flex; gap: 8px; align-items: center; }
.command .field { flex: 1; min-width: 0; min-height: 44px; }
.command .btn { flex-shrink: 0; width: auto; }
.cover-preview { width: 120px; border-radius: 12px; border: 1px solid var(--line); display: block; margin: 6px 0; }

/* выбор и сравнение */
.thumb.picked { border-color: var(--bronze); box-shadow: inset 0 0 0 2px var(--bronze); }
.compare { display: grid; gap: 10px; align-items: start; }
.compare-col { min-width: 0; }
.compare-col .thumb video { width: 100%; height: 100%; object-fit: cover; }
.compare-col .kv-row { flex-direction: column; gap: 0; font-size: 12px; }
.compare-col .kv-row .v { text-align: left; }
.compare-col .row .btn { width: auto; padding: 0 10px; }

/* ролики автомонтажа */
.edit-card { display: grid; grid-template-columns: 72px 1fr 32px; gap: 12px; align-items: center;
  background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px; }
.edit-thumb { position: relative; width: 72px; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; padding: 0;
  border: 1px solid var(--line); background: var(--graphite-2); display: grid; place-items: center; color: var(--stone); }
.edit-thumb img { width: 100%; height: 100%; object-fit: cover; }
.edit-info { min-width: 0; cursor: pointer; }
.edit-info .name { font-weight: 600; margin-bottom: 4px; }
.check { display: grid; place-items: center; cursor: pointer; }
.check input, .consent input { width: 20px; height: 20px; accent-color: var(--bronze); }
.consent { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.consent input { flex-shrink: 0; margin-top: 1px; }

/* клипы */
.clip-card { display: grid; grid-template-columns: 1fr 32px; gap: 8px; align-items: start;
  background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; }
.clip-main { min-width: 0; cursor: pointer; }
.clip-main > * + * { margin-top: 6px; }
.clip-time { font-variant-numeric: tabular-nums; color: var(--bronze-warm); font-size: 13px; font-weight: 600; }
.clip-title { font-weight: 600; }
.clip-reason { color: var(--ivory); opacity: .85; }
.score { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--stone); font-variant-numeric: tabular-nums; }
.score-bar { flex: 1; height: 4px; border-radius: 999px; background: var(--graphite-3); overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--bronze); }
.transcript-box { background: var(--graphite-2); border-radius: 12px; padding: 10px 12px; max-height: 30vh; overflow: auto; color: var(--stone); }

/* редактор субтитров */
.sub-media { position: relative; }
.sub-overlay {
  position: absolute; left: 8%; right: 8%; bottom: 28%; padding: 6px 10px; border-radius: 10px;
  background: rgba(14, 14, 13, .72); border: 1px dashed rgba(195, 154, 107, .55); color: var(--ivory);
  font: 600 15px/1.3 var(--font); text-align: center; cursor: text;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.toolbar .btn { width: auto; }
.seg-list { display: grid; gap: 6px; }
.seg {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 10px; align-items: start; text-align: left;
  background: var(--graphite); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--ivory); font: inherit;
}
.seg:active { background: var(--graphite-2); }
.seg-time { font-variant-numeric: tabular-nums; color: var(--stone); font-size: 12px; padding-top: 2px; }
.seg-text { font-size: 14px; line-height: 1.4; }
.seg.has-issues { border-color: rgba(194, 122, 98, .45); }
.seg-flag { min-width: 20px; height: 20px; border-radius: 10px; background: rgba(194, 122, 98, .2); color: var(--danger);
  font-size: 12px; display: grid; place-items: center; padding: 0 6px; }
.issues { display: grid; gap: 6px; }
.issue { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--graphite-2); border-radius: 10px; padding: 8px 10px; }
.issue .btn { width: auto; flex-shrink: 0; }

/* «Ещё», операции, бренд */
.row-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--graphite-2); display: grid; place-items: center; color: var(--bronze-warm); flex-shrink: 0; }
.row-icon svg { width: 20px; height: 20px; }
button.list-row { width: 100%; background: transparent; border-left: 0; border-right: 0; border-bottom: 0; color: var(--ivory); font: inherit; text-align: left; }
.list > button.list-row:first-child { border-top: 0; }
.op-job { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--line); }
.op-job .btn { width: auto; flex-shrink: 0; }
.color-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.color-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--graphite); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 6px; cursor: pointer; }
.color-pick input { width: 40px; height: 40px; border: 0; padding: 0; background: transparent; border-radius: 50%; cursor: pointer; }
.logo-preview { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: var(--graphite-2); border: 1px solid var(--line); flex-shrink: 0; }
.logo-preview.empty { display: grid; place-items: center; color: var(--stone); }
@media (max-width: 360px) { .tabbar button { font-size: 10px; } }

/* ============================================================
   «Что изменить», шрифты, звуки, баннер, карусели
   ============================================================ */
.tabbar button { font-size: 10.5px; letter-spacing: -0.01em; }
.tabbar button svg { width: 21px; height: 21px; }

.font-pick { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%;
  margin-top: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--graphite-2); color: var(--ivory); text-align: left; font: inherit; }
.font-pick-name { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-pick .chevron { width: 16px; height: 16px; color: var(--stone); }
.font-list { max-height: 52vh; overflow-y: auto; display: grid; gap: 4px; margin-top: 4px; }
.font-row { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; width: 100%;
  min-height: 52px; padding: 6px 4px 6px 12px; border-radius: 12px; border: 0; background: transparent; color: var(--ivory);
  text-align: left; font: inherit; cursor: pointer; }
.font-row:active, .font-row:focus-visible { background: var(--graphite-2); outline: none; }
.font-name { font-size: 21px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-meta { font-size: 11px; color: var(--stone); }
.font-row svg { width: 18px; height: 18px; color: var(--bronze-warm); }
.icon-btn.star svg { color: var(--graphite-3); }
.icon-btn.star[aria-pressed="true"] svg { color: var(--bronze-warm); fill: var(--bronze-warm); }

.range { flex: 1; accent-color: var(--bronze); min-width: 0; }
.banner-thumb { width: 64px; height: 64px; padding: 4px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: repeating-conic-gradient(#E2D8C8 0 25%, #F4EFE7 0 50%) 0 0 / 14px 14px; }
.banner-thumb[aria-pressed="true"] { border-color: var(--bronze); box-shadow: inset 0 0 0 2px var(--bronze); }
.banner-thumb img { width: 100%; height: 100%; object-fit: contain; }
/* Логотип — на шахматке: видно, что прозрачность сохранена, а не «чёрный квадрат» */
.logo-preview { background: repeating-conic-gradient(#E2D8C8 0 25%, #F4EFE7 0 50%) 0 0 / 14px 14px; }

.slide-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.slide-thumb { position: relative; padding: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line);
  background: var(--graphite-2); aspect-ratio: 4 / 5; }
.slide-thumb.square { aspect-ratio: 1; }
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide-thumb .badge-l { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(14, 14, 13, .78); color: var(--ivory); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 360px) { .tabbar button { font-size: 9.5px; } }

/* Черновик монтажа (480p) — пометка в списке роликов */
.badge-draft { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; vertical-align: 2px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--on-accent); background: var(--bronze-warm); }
.fb-done { align-items: flex-start; gap: 10px; }
.fb-done svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--bronze-warm); }

/* ============================================================
   Экраны разделов: шапка, видео, шаги, карточки выбора, тонкие настройки
   ============================================================ */
.s-head { margin: 4px 0 18px; }
.s-kicker { font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--bronze-warm); }
.s-title { margin: 8px 0 0; font-size: 30px; line-height: 1.08; font-weight: 800; letter-spacing: -.02em; color: var(--ivory); }
.s-sub { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--stone); max-width: 34ch; }

.vstrip { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: var(--radius-lg);
  background: var(--graphite); border: 1px solid var(--line); }
.vstrip-thumb { position: relative; flex: none; width: 56px; height: 72px; border-radius: 12px; overflow: hidden; padding: 0;
  border: 1px solid var(--line-strong); background: var(--graphite-3); }
.vstrip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vstrip-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(14, 14, 13, .35); color: var(--ivory); }
.vstrip-play svg { width: 20px; height: 20px; }
.vstrip-info { flex: 1; min-width: 0; }
.vstrip-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vstrip-meta { margin-top: 3px; font-size: 12px; color: var(--stone); }

.step { margin-top: 26px; }
.step-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.step-n { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--bronze-warm); font-variant-numeric: tabular-nums; }
.step-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.step-hint { margin-top: 8px; font-size: 12px; color: var(--stone); line-height: 1.45; }

.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 15px 16px; text-align: left;
  border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--graphite); color: var(--ivory);
  transition: border-color .2s var(--ease), background .2s var(--ease); }
.choice[aria-checked="true"] { border-color: var(--bronze); background: linear-gradient(0deg, var(--bronze-dim), var(--bronze-dim)), var(--graphite); }
.choice-dot { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.choice[aria-checked="true"] .choice-dot { border: 6px solid var(--bronze-warm); }
.choice-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.choice-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.choice-badge { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bronze-warm);
  padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(195, 154, 107, .35); }
.choice-desc { font-size: 13px; color: var(--stone); line-height: 1.4; }

.fine, .linkrow { display: block; margin-top: 26px; border-radius: var(--radius-lg); background: var(--graphite); border: 1px solid var(--line); }
.linkrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; color: var(--ivory); margin-top: 12px; }
.fine > summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; }
.fine > summary::-webkit-details-marker { display: none; }
.fine-icon { flex: none; width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--graphite-2); color: var(--bronze-warm); }
.fine-icon svg { width: 18px; height: 18px; }
.fine-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fine-title { font-weight: 700; }
.fine-sub { font-size: 12px; color: var(--stone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fine > summary .chevron, .linkrow .chevron { width: 16px; height: 16px; color: var(--stone); transition: transform .2s var(--ease); }
.fine[open] > summary .chevron { transform: rotate(90deg); }
.fine-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.fine-body > .section:first-child, .fine-body > .fine-block:first-child { margin-top: 14px; }
.fine-block { margin-top: 18px; }
.fine-block > .fine-label { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.fine-block > .fine-note { font-size: 12px; color: var(--stone); margin: -4px 0 10px; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.swatch { padding: 0; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--ivory); text-align: left; overflow: hidden; }
.swatch[aria-pressed="true"] { border-color: var(--bronze-warm); box-shadow: 0 0 0 1px var(--bronze-warm); }
.swatch-art { aspect-ratio: 4 / 5; padding: 10px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.swatch-art i { display: block; height: 5px; border-radius: 3px; }
.swatch-name { display: block; padding: 8px 10px; font-size: 12px; font-weight: 600; background: var(--graphite); }

/* ============================================================
   Тёмные зоны на светлой теме: видео, превью роликов, плашки поверх кадра.
   Внутри — прежняя тёмная палитра, чтобы надписи на видео оставались читаемыми.
   ============================================================ */
.on-dark, .media, .thumb, .hub-thumb, .edit-thumb, .vstrip-thumb, .slide-thumb, .sub-media,
.pv-montage, .pv-box, .pv-fan {
  --deep-graphite: #0E0E0D; --graphite: #171715; --graphite-2: #1F1F1C; --graphite-3: #2A2A26;
  --bronze: #A67849; --bronze-warm: #C39A6B; --bronze-dim: rgba(166, 120, 73, 0.14);
  --ivory: #E9E2D7; --stone: #A39C91; --line: rgba(233, 226, 215, 0.08); --line-strong: rgba(233, 226, 215, 0.16);
  --on-accent: #16120C;
  color: var(--ivory);
}
