/* Claude Convert — самописный CSS на переменных. Две темы свопом группы var'ов. */
:root {
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 14px;
  --maxw: 1180px;
}
[data-theme="warm"] {
  --bg: #efe7d6; --bg-2: #f6f0e3; --panel: #eae1d0; --panel-2: #f3ecde;
  --ink: #2a251e; --muted: #8c8270; --line: #ded3bd;
  --accent: #c0532b; --accent-ink: #fff;
  --btn: #1c1813; --btn-ink: #f6f0e3;
  --ok: #3f7d3a;
}
[data-theme="mono"] {
  --bg: #0e0e0e; --bg-2: #161616; --panel: #1a1a1a; --panel-2: #141414;
  --ink: #f1f0ec; --muted: #8f8f88; --line: #2a2a2a;
  --accent: #c8ff4a; --accent-ink: #0e0e0e;
  --btn: #c8ff4a; --btn-ink: #0e0e0e;
  --ok: #86e06b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* Атрибут hidden должен побеждать любые display-правила (видео/постер/оценка и т.п.) */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}

/* ── Header ── */
.site-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; }
.brand-mark circle { fill: var(--accent); }
.brand-mark path { fill: var(--accent-ink); }
.brand-word { font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand-word b { color: var(--accent); font-weight: 800; }
.head-nav { display: flex; align-items: center; gap: 22px; }
.nav-link { color: var(--ink); text-decoration: none; font-size: 14px; opacity: .8; }
.nav-link:hover { opacity: 1; }
.theme-toggle {
  display: flex; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; font-family: var(--mono); font-size: 12px;
}
.theme-toggle button {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 14px; border-radius: 999px; cursor: pointer;
}
.theme-toggle button.is-active { background: var(--btn); color: var(--btn-ink); font-weight: 600; }

/* ── Layout ── */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: clamp(28px, 6vw, 64px) clamp(16px, 4vw, 40px); flex: 1; }
.view { animation: fade .25s ease; }
/* Центрируем содержимое экранов — без «прижатости к левому краю» */
#view-upload { max-width: 640px; margin-inline: auto; }
#view-progress { max-width: 800px; margin-inline: auto; }
#view-result { max-width: 1060px; margin-inline: auto; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero-title { font-size: clamp(34px, 6vw, 60px); font-weight: 800; letter-spacing: -.03em; line-height: 1.04; }
.hero-title .accent { color: var(--accent); }
.hero-sub { color: var(--muted); font-size: clamp(15px, 2vw, 18px); margin-top: 16px; max-width: 620px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; margin-top: 36px; background: var(--panel); padding: 5px; border-radius: 12px; }
.tab { flex: 1; border: 0; background: transparent; color: var(--muted); font-family: var(--mono); font-size: 13px; padding: 11px; border-radius: 9px; cursor: pointer; }
.tab.is-active { background: var(--bg-2); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tab-hint { opacity: .6; }

/* ── Panel ── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); margin-top: 14px; }
.panel-lead { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.panel-lead i { font-style: italic; color: var(--ink); }

/* ── Вкладка «Вставить ссылку» ── */
.url-row { display: flex; gap: 8px; flex-wrap: wrap; }
.url-input { flex: 1; min-width: 180px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); border-radius: 11px; padding: 13px 14px; font-size: 14px; font-family: var(--mono); }
.url-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn-primary.url-go { width: auto; margin-top: 0; flex-shrink: 0; padding: 13px 22px; }
.url-note { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.url-note b { color: var(--ink); }
.url-note i { color: var(--ink); font-style: normal; background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.url-note code { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.url-note br { content: ""; display: block; margin-bottom: 6px; }
.url-warn { margin-top: 12px; font-size: 13px; line-height: 1.5; color: #b9791f; background: color-mix(in srgb, #b9791f 10%, transparent); border: 1px solid color-mix(in srgb, #b9791f 30%, transparent); border-radius: 10px; padding: 10px 12px; }
.url-warn code { font-family: var(--mono); font-size: 12px; }
[data-theme="mono"] .url-warn { color: #e0b85a; }
#url-error { margin-top: 12px; }

/* ── Dropzone ── */
.dropzone { display: block; border: 2px dashed var(--line); border-radius: 12px; background: var(--panel-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--bg-2); }
.dz-inner { padding: 48px 20px; text-align: center; }
.dz-icon { width: 30px; height: 30px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dz-text { margin-top: 14px; font-size: 16px; }
.dz-sub { margin-top: 6px; color: var(--muted); font-size: 14px; }
.dz-sub u { color: var(--ink); }
.dz-note { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ── Settings ── */
.settings { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 20px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-family: var(--mono); font-size: 13px; margin-bottom: 16px; max-width: 100%; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.file-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.setting-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.field select, .field input { background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); border-radius: 9px; padding: 10px 12px; font-size: 14px; font-family: var(--sans); }
.field select:focus, .field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ── Buttons ── */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 18px; background: var(--btn); color: var(--btn-ink); border: 0; border-radius: 11px; padding: 15px; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .08s, opacity .15s; }
.btn-primary:hover { opacity: .92; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.form-error { margin-top: 14px; color: #c0392b; font-size: 14px; }
[data-theme="mono"] .form-error { color: var(--accent); }

/* ── Progress ── */
.back { border: 0; background: transparent; color: var(--muted); font-family: var(--mono); font-size: 13px; cursor: pointer; margin-bottom: 18px; }
.back:hover { color: var(--ink); }
.result-title { font-size: clamp(28px, 5vw, 44px); font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* Анимированная галочка успеха (перезапускается при показе экрана) */
.done-check { width: clamp(38px, 7vw, 50px); height: clamp(38px, 7vw, 50px); flex-shrink: 0; animation: dc-pop .5s cubic-bezier(.2,.8,.2,1.2); }
.done-check svg { width: 100%; height: 100%; display: block; }
.dc-ring { fill: color-mix(in srgb, var(--ok) 14%, transparent); stroke: var(--ok); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; animation: dc-draw .5s ease forwards; }
.dc-tick { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: dc-draw .35s ease .42s forwards; }
@keyframes dc-draw { to { stroke-dashoffset: 0; } }
@keyframes dc-pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }

.render-from { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 760px; }

.render-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 24px; max-width: 760px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.04); }

/* Степпер */
.stepper { list-style: none; display: flex; align-items: center; padding: 24px clamp(18px, 4vw, 36px); background: var(--panel-2); border-bottom: 1px solid var(--line); }
.step { display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; }
.step-line { flex: 1; height: 2px; background: var(--line); margin: 0 8px; align-self: flex-start; margin-top: 17px; border-radius: 2px; transition: background .4s ease; position: relative; overflow: hidden; }
.step-line.done { background: var(--ok); }
.step-line.active::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: line-sweep 1.1s linear infinite; }
@keyframes line-sweep { from { transform: translateX(-100%); } to { transform: translateX(350%); } }
.step-dot { position: relative; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); border: 2px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 14px; font-weight: 600; transition: border-color .25s, background .25s, color .25s; }
.step-dot i { grid-area: 1 / 1; display: none; line-height: 1; }
.step .step-num { display: block; }
.step-name { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .01em; max-width: 90px; transition: color .25s; }
.step-check { color: var(--accent-ink); font-size: 16px; }
.step-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); border-top-color: var(--accent); animation: spin .8s linear infinite; }
/* активная фаза */
.step.active .step-dot { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-2)); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 14%, transparent); }
.step.active .step-num { display: none; }
.step.active .step-spin { display: block; }
.step.active .step-name { color: var(--ink); font-weight: 600; }
/* завершённая фаза */
.step.done .step-dot { background: var(--ok); border-color: var(--ok); }
.step.done .step-num { display: none; }
.step.done .step-check { display: block; }
.step.done .step-name { color: var(--ink); }

/* Тело: крупный процент + плёнка */
.render-body { display: flex; align-items: center; gap: clamp(18px, 4vw, 36px); padding: clamp(22px, 4vw, 34px) clamp(18px, 4vw, 36px); }
.render-pct { flex-shrink: 0; }
.pct-val { display: flex; align-items: baseline; line-height: .9; }
.pct-num { font-size: clamp(56px, 11vw, 88px); font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.pct-sign { font-size: clamp(24px, 5vw, 34px); font-weight: 700; color: var(--muted); margin-left: 2px; }
.pct-sub { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 6px; }
.render-main { flex: 1; min-width: 0; }

/* «Плёнка» — прогресс в виде киноплёнки */
.filmstrip { position: relative; height: 46px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line);
  /* перфорация сверху/снизу */
  background-image:
    repeating-linear-gradient(90deg, transparent 0 11px, color-mix(in srgb, var(--line) 70%, transparent) 11px 17px),
    repeating-linear-gradient(90deg, transparent 0 11px, color-mix(in srgb, var(--line) 70%, transparent) 11px 17px);
  background-position: 0 6px, 0 calc(100% - 6px);
  background-size: 17px 5px, 17px 5px;
  background-repeat: repeat-x;
  overflow: hidden; }
.film-track { position: absolute; left: 0; right: 0; top: 13px; bottom: 13px; }
.film-fill { height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, transparent), var(--accent));
  /* кадры внутри заполнения */
  background-blend-mode: normal;
  transition: width .35s cubic-bezier(.4,0,.2,1); position: relative; }
.film-fill::after { content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: repeating-linear-gradient(90deg, transparent 0 14px, rgba(0,0,0,.35) 14px 15px); }
.film-head { position: absolute; top: 4px; bottom: 4px; width: 2px; background: var(--ink); border-radius: 2px; left: 0;
  transition: left .35s cubic-bezier(.4,0,.2,1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); opacity: 0; }
.filmstrip.live .film-head { opacity: 1; animation: head-pulse 1s ease-in-out infinite; }
@keyframes head-pulse { 0%,100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ink) 4%, transparent); } }
/* «дышащая» заливка пока считается processing без точного % (probing) */
.filmstrip.indeterminate .film-fill { width: 100% !important;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
  background-size: 40% 100%; background-repeat: no-repeat; animation: indet 1.2s linear infinite; }
.filmstrip.indeterminate .film-fill::after { display: none; }
.filmstrip.indeterminate .film-head { display: none; }
@keyframes indet { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.render-status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.render-phase { font-weight: 600; font-size: 15px; }
.render-detail { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.status-pill { flex-shrink: 0; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; padding: 5px 11px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); }
.status-pill.running { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.status-pill.running::before { content: "● "; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* Подвал карточки */
.render-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px clamp(18px, 4vw, 36px); border-top: 1px solid var(--line); background: var(--panel-2); }
.render-specs { display: flex; flex-wrap: wrap; gap: 7px; }
.render-specs .spec { font-family: var(--mono); font-size: 12px; padding: 5px 10px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); }
.btn-ghost { border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); font-family: var(--mono); font-size: 13px; padding: 9px 16px; border-radius: 999px; cursor: pointer; transition: border-color .15s, color .15s; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.render-note { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 16px; max-width: 760px; }

/* ── Рефрейм: fit + кастомный размер ── */
.reframe-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.segmented.sm button { padding: 7px 14px; font-size: 13px; }
.custom-size { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.custom-size input { width: 84px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.custom-size input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ── Текст в сцене ── */
.text-edits { display: flex; flex-direction: column; gap: 8px; }
.text-row { display: flex; align-items: center; gap: 8px; }
.text-row .text-input { flex: 1; min-width: 0; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); border-radius: 9px; padding: 10px 12px; font-size: 14px; font-family: var(--sans); }
.text-row .text-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.text-row.hidden .text-input { text-decoration: line-through; opacity: .5; color: var(--muted); }
.text-hide { flex: 0 0 auto; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); font-family: var(--mono); font-size: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; transition: border-color .15s, color .15s; }
.text-hide:hover { border-color: var(--accent); color: var(--accent); }
.text-row.hidden .text-hide { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* ── Тег alpha в сегментах формата ── */
.seg-tag { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; padding: 1px 5px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); margin-left: 5px; vertical-align: middle; }
.segmented button.is-active .seg-tag { background: color-mix(in srgb, var(--btn-ink) 22%, transparent); color: var(--btn-ink); }

/* ── Скорость по таймлайну ── */
.speed-toggle { margin-bottom: 4px; }
#speed-editor { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
/* Превью кадра под курсором */
.speed-preview { position: relative; background: #0c0c0c; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; max-height: 34vh; display: grid; place-items: center; }
.speed-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.speed-preview-t { position: absolute; bottom: 10px; left: 12px; font-family: var(--mono); font-size: 12px; color: #fff; background: rgba(0,0,0,.55); padding: 3px 9px; border-radius: 999px; backdrop-filter: blur(2px); }
.speed-preview-note { position: absolute; bottom: 10px; right: 12px; font-family: var(--mono); font-size: 10px; color: #fff; opacity: .6; }
/* Таймлайн: дорожка сегментов + плейхед + невидимый range поверх */
.speed-timeline { position: relative; height: 46px; }
.stl-segs { position: absolute; inset: 0; display: flex; gap: 2px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.stl-seg { height: 100%; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); min-width: 0; overflow: hidden; white-space: nowrap; }
.stl-seg.is-slow { background: color-mix(in srgb, #3b82f6 22%, var(--panel-2)); color: color-mix(in srgb, #3b82f6 70%, var(--ink)); }
.stl-seg.is-fast { background: color-mix(in srgb, var(--accent) 22%, var(--panel-2)); color: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.stl-seg.is-norm { background: var(--panel-2); color: var(--muted); }
.stl-marks { position: absolute; inset: 0; pointer-events: none; }
.stl-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .55; transform: translateX(-1px); }
.stl-head { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); pointer-events: none; transform: translateX(-1px); border-radius: 2px; }
.stl-head::before { content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--accent); }
.stl-scrub { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
/* Строка «момент + добавить» */
.stl-add-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stl-cursor { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.stl-cursor b { color: var(--ink); }
.stl-add-btn { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); background: transparent; color: var(--accent); font-family: var(--mono); font-size: 13px; padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: background .12s; }
.stl-add-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
/* Список точек */
.speed-points { display: flex; flex-direction: column; gap: 8px; }
.speed-point { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.sp-at { flex: 0 0 auto; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.sp-at b { color: var(--ink); }
.sp-slider { flex: 1; min-width: 80px; accent-color: var(--accent); }
.sp-speed-wrap { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.sp-speed-input { width: 52px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 7px 8px; font-size: 14px; font-family: var(--mono); text-align: center; }
.sp-speed-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.sp-del { flex: 0 0 auto; width: 30px; height: 30px; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; transition: border-color .15s, color .15s; }
.sp-del:hover { border-color: var(--accent); color: var(--accent); }
.speed-empty { font-family: var(--mono); font-size: 12px; color: var(--muted); line-height: 1.5; padding: 2px 2px; }
.speed-summary { font-family: var(--mono); font-size: 13px; color: var(--muted); padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; }
.speed-summary b { color: var(--accent); }

/* ── Оценка размера и времени до рендера ── */
.estimate { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.estimate b { color: var(--ink); font-size: 15px; }
.est-ico { color: var(--accent); font-weight: 700; }
.est-lbl { opacity: .75; }
.est-sep { opacity: .35; }
.est-note { margin-left: auto; font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: .04em; }
.estimate + .btn-primary { margin-top: 12px; }

/* ── Result ── */
.result-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; margin-top: 24px; align-items: start; }
.player-col { min-width: 0; }
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; aspect-ratio: 16 / 9; max-height: 74vh; }
.player-wrap video, .player-wrap img { width: 100%; height: 100%; display: block; object-fit: contain; }
/* Шахматка под прозрачным видео — чтобы было видно, что фона нет */
.player-wrap.alpha { background: repeating-conic-gradient(#c9c3b2 0 25%, #e2dbc9 0 50%) 0 0 / 26px 26px; }
.mov-note { font-size: 13px; color: var(--muted); margin-top: 12px; line-height: 1.45; }
.mov-note b { color: var(--ink); }
.details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.details-head { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.details-list { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-family: var(--mono); font-size: 13px; }
.details-list dt { color: var(--muted); }
.details-list dd { text-align: right; }
.btn-download { margin-top: 22px; }

/* Секция «Нужен другой формат?» — карточки */
.formats-section { margin-top: 28px; }
.fs-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.fs-head span:first-child { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.fs-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.format-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fmt-card { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: border-color .15s, transform .08s; }
.fmt-card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.fmt-card.is-alpha { background: var(--panel-2); }
.fmt-top { display: flex; align-items: center; gap: 8px; }
.fmt-name { font-weight: 700; font-size: 16px; }
.fmt-tag { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.fmt-desc { font-size: 13px; color: var(--muted); line-height: 1.4; flex: 1; }
.fmt-desc small { color: var(--accent); font-size: 12px; }
.fmt-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.fmt-size { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.fmt-action { border: 0; background: var(--btn); color: var(--btn-ink); font-family: var(--mono); font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; transition: opacity .15s; white-space: nowrap; }
.fmt-action:hover { opacity: .9; }
.fmt-action:disabled { opacity: .6; cursor: default; }
.fmt-action.ghost { background: transparent; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); }
@media (max-width: 760px) { .format-cards { grid-template-columns: 1fr; } }

/* ── Footer ── */
.site-foot { border-top: 1px solid var(--line); padding: 26px clamp(16px, 4vw, 40px); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.foot-stat { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.foot-stat b { color: var(--ink); }
.foot-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ── Анализ (спиннер) ── */
.analyzing { display: flex; align-items: center; gap: 16px; padding: 32px 8px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.analyzing-title { font-weight: 600; }
.analyzing-sub { color: var(--muted); font-family: var(--mono); font-size: 13px; }

/* ── Баннер кадра-превью на экране настроек ── */
#scene-preview { margin-bottom: 16px; }
.scene-preview-main { position: relative; background: #0c0c0c; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; aspect-ratio: 16 / 9; max-height: 42vh; }
.scene-preview-main img { width: 100%; height: 100%; object-fit: contain; display: block; }
.scene-time { position: absolute; bottom: 10px; left: 12px; font-family: var(--mono); font-size: 12px; color: #fff; background: rgba(0,0,0,.55); padding: 3px 9px; border-radius: 999px; backdrop-filter: blur(2px); }
/* Миниатюры — во всю ширину, равными долями (без пустоты справа) */
.scene-thumbs { display: flex; gap: 8px; margin-top: 8px; }
.scene-thumb { position: relative; flex: 1; padding: 0; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: #0c0c0c; cursor: pointer; aspect-ratio: 16 / 9; transition: border-color .15s; }
.scene-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .65; transition: opacity .15s; }
.scene-thumb:hover img { opacity: 1; }
.scene-thumb.is-active { border-color: var(--accent); }
.scene-thumb.is-active img { opacity: 1; }
.scene-thumb-t { position: absolute; bottom: 3px; right: 4px; font-family: var(--mono); font-size: 9px; color: #fff; background: rgba(0,0,0,.6); padding: 1px 5px; border-radius: 5px; pointer-events: none; }

/* ── Чипы «обнаружено» ── */
.detected { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px; }
.chip-file { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; font-family: var(--mono); font-size: 13px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { font-family: var(--mono); font-size: 12px; padding: 5px 10px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); }
.chip-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.chip-warn { color: #b9791f; }
.chip-clear { margin-left: auto; border: 0; background: transparent; color: var(--accent); font-family: var(--mono); font-size: 12px; cursor: pointer; text-decoration: underline; }

/* ── Группы настроек + сегментные контролы ── */
.opt-group { margin-bottom: 18px; }
.opt-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.opt-hint { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.segmented { display: flex; width: 100%; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 4px; }
.segmented button { flex: 1; border: 0; background: transparent; color: var(--ink); font-family: var(--mono); font-size: 14px; padding: 10px 14px; border-radius: 8px; cursor: pointer; transition: background .12s; white-space: nowrap; }
.segmented button:hover { background: var(--bg-2); }
.segmented button.is-active { background: var(--btn); color: var(--btn-ink); font-weight: 600; }
/* sm — компактные группы (fit, fps, битрейт): по ширине контента, не на всю строку */
.segmented.sm { display: inline-flex; width: auto; flex-wrap: wrap; }
.segmented.sm button { flex: 0 0 auto; padding: 8px 14px; font-size: 13px; }

/* ── Визуальный выбор формата кадра ── */
.aspect-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.aspect-grid button { flex: 1 1 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 70px; padding: 10px 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); cursor: pointer; font-family: var(--mono); font-size: 12px; transition: border-color .15s, color .15s, background .15s; }
.aspect-grid button:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--ink); }
.aspect-grid button.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel-2)); color: var(--ink); }
.ar { display: block; border: 2px solid currentColor; border-radius: 3px; opacity: .85; }
.aspect-grid button.is-active .ar { color: var(--accent); opacity: 1; }
.ar-auto { width: 28px; height: 20px; border-style: dashed; }
.ar-custom { width: 28px; height: 20px; display: grid; place-items: center; font-size: 9px; }

/* ── Дополнительно ── */
.advanced { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.advanced summary { cursor: pointer; padding: 12px 0; font-family: var(--mono); font-size: 13px; color: var(--muted); list-style: none; user-select: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "+ "; color: var(--accent); }
.advanced[open] summary::before { content: "− "; }
.adv-body { padding: 6px 0 4px; display: flex; flex-direction: column; gap: 18px; }
.adv-group { display: flex; flex-direction: column; gap: 9px; }
.adv-group .adv-label { display: flex; align-items: baseline; gap: 8px; }
.adv-group .adv-label small { color: var(--muted); font-size: 12px; text-transform: none; letter-spacing: normal; }
.adv-toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.adv-toggle input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.adv-toggle-text { display: flex; flex-direction: column; gap: 2px; }
.adv-toggle-text small, .adv-field small { color: var(--muted); font-size: 13px; }
.adv-inline { display: flex; align-items: center; gap: 8px; padding-left: 28px; font-size: 14px; color: var(--muted); }
.adv-inline input { width: 64px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 7px 10px; font-size: 14px; }
.adv-field { display: flex; flex-direction: column; gap: 5px; }
.adv-label { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.adv-field input { max-width: 220px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); border-radius: 9px; padding: 10px 12px; font-size: 14px; }
.adv-inline input:focus, .adv-field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ── Как это работает ── */
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 48px; }
.how-step { display: flex; gap: 12px; align-items: flex-start; }
.how-num { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 14px; }
.how-step b { display: block; margin-bottom: 3px; }
.how-step small { color: var(--muted); font-size: 13px; line-height: 1.45; }

@media (max-width: 760px) {
  .result-grid { grid-template-columns: 1fr; }
  .head-nav { gap: 14px; }
  .nav-link { display: none; }
  .how { grid-template-columns: 1fr; gap: 14px; }
  .render-body { flex-direction: column; align-items: stretch; text-align: left; }
  .render-pct { display: flex; align-items: baseline; gap: 12px; }
  .pct-sub { margin-top: 0; align-self: center; }
  .step-name { font-size: 11px; }
}
