/* rendx web UI — "Liquid Glass" style, dark and light themes. */

:root {
  --tint: #0A84FF;
  --ok: #34C759;
  --radius-card: 26px;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
  --ease: 0.35s ease;
  --spring: cubic-bezier(0.32, 0.72, 0, 1); /* iOS sheet / segmented curve */
}

/* Style "restrained glass" (iOS 26): content sits on calm matte surfaces; glass is kept only for
   the chrome floating over it (the header buttons, the tab bar, the editor dock, toasts). */
:root[data-theme="dark"] {
  --bg: #17212B;
  --surface: #243242;
  --surface-2: #2F3E4F;
  --text: #F4F4F5;
  --label: #C3CBD3;
  --muted: #95A0AC;
  --divider: #314052;
  --seg-track: rgba(8, 13, 19, 0.35);
  --switch-off: #3A4756;
  --sel-ring: #F4F4F5;
  --tab-inactive: #95A0AC;
  --link: #F4F4F5;
  --text-shadow: none;
  --primary: #F4F4F5;
  --on-primary: #17212B;
  --danger: #FF6B60;
  --glass-bg: rgba(36, 48, 61, 0.66);
  --glass-solid: #222D39;
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --lens-bg: #F4F4F5;
  --lens-border: transparent;
  --lens-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  --on-lens: #17212B;
  --preview-bg: #111920;
  --silhouette: #26313D;
}

:root[data-theme="light"] {
  --bg: #F2F2F7;
  --surface: #FFFFFF;
  --surface-2: #E9E9EE;
  --text: #17212B;
  --label: #3C4652;
  --muted: #6B7581;
  --divider: #E4E4E9;
  --seg-track: rgba(118, 118, 128, 0.12);
  --switch-off: rgba(120, 120, 128, 0.3);
  --sel-ring: #17212B;
  --tab-inactive: #6B7581;
  --link: var(--tint);
  --text-shadow: none;
  --primary: #17212B;
  --on-primary: #FFFFFF;
  --danger: #E5483D;
  --glass-bg: rgba(255, 255, 255, 0.74);
  --glass-solid: #FFFFFF;
  --glass-border: rgba(23, 33, 43, 0.07);
  --glass-shadow: 0 8px 24px rgba(23, 33, 43, 0.1);
  --lens-bg: #17212B;
  --lens-border: transparent;
  --lens-shadow: 0 1px 4px rgba(23, 33, 43, 0.2);
  --on-lens: #FFFFFF;
  --preview-bg: #1E2935;
  --silhouette: #2C3846;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  transition: background var(--ease), color var(--ease);
}
button { font: inherit; color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; }
/* The ring is for keyboard users only: taps and clicks (and focus moved by the app after them) show none. */
* { -webkit-tap-highlight-color: transparent; }
:focus:not(:focus-visible), :root:not(.kbd) :focus-visible { outline: none; }

/* ---------- wallpaper ---------- */
.wallpaper { display: none; } /* the flat background of style D */
.wallpaper-off { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; transition: background var(--ease), opacity var(--ease); }
.b1 { left: -120px; top: -80px; width: 360px; height: 360px; background: var(--b1); opacity: var(--b1o); filter: blur(70px); }
.b2 { right: -140px; top: 18vh; width: 400px; height: 400px; background: var(--b2); opacity: var(--b2o); filter: blur(80px); }
.b3 { left: -160px; top: 46vh; width: 420px; height: 420px; background: var(--b3); opacity: var(--b3o); filter: blur(80px); }
.b4 { right: -100px; top: 70vh; width: 340px; height: 340px; background: var(--b4); opacity: var(--b4o); filter: blur(80px); }
.b5 { left: 30%; top: 86vh; width: 320px; height: 320px; background: var(--b5); opacity: var(--b5o); filter: blur(80px); }

/* ---------- layout ---------- */
.page {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px calc(112px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.loading { text-align: center; color: var(--muted); margin-top: 40vh; }

/* ---------- materials ---------- */
/* .glass on content = a matte surface; the chrome floating over content keeps real glass */
.glass {
  background: var(--surface); border: 1px solid transparent; box-shadow: none;
  transition: background var(--ease), border-color var(--ease);
}
.card .glass, .list .glass, .modal-card .glass, .file-chip .glass, .speed .glass { background: var(--surface-2); }
.header .glass, .tabbar.glass, .ed-dock .glass, .ed-toast.glass, .ed-remind.glass, .ed-mute.glass, .wiz-pip.glass, .ed-big-close.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
  border-color: var(--glass-border);
  box-shadow: var(--glass-shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .header .glass, .tabbar.glass, .ed-dock .glass, .ed-toast.glass, .ed-remind.glass, .ed-mute.glass, .wiz-pip.glass, .ed-big-close.glass { background: var(--glass-solid); }
}
.lens {
  background: var(--lens-bg); border: 1px solid var(--lens-border); box-shadow: var(--lens-shadow);
  transition: background var(--ease), border-color var(--ease), box-shadow var(--ease);
}
/* outside a selection pill a lens is a quiet secondary plate (the history button, empty-state icons) */
.lens:not(.seg-thumb) { background: var(--surface-2); border-color: transparent; box-shadow: none; color: var(--text); }
/* the main action: a solid light pill (dark in the light theme) */
.tint {
  background: var(--primary); color: var(--on-primary);
  border: 1px solid transparent; box-shadow: none;
}
.card { border-radius: var(--radius-card); }

/* ---------- typography ---------- */
.h1 { margin: 0; padding: 0 4px; font-size: 34px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; text-shadow: var(--text-shadow); }
.sub { margin: 2px 0 0; padding: 0 4px; font-size: 16px; font-weight: 500; color: var(--label); text-shadow: var(--text-shadow); }
.caps { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--label); }
.section-label { padding-left: 16px; text-shadow: var(--text-shadow); }
.muted { color: var(--muted); }
.note { margin: 0; padding: 0 8px; text-align: center; font-size: 13px; line-height: 1.45; color: var(--label); text-shadow: var(--text-shadow); }

/* ---------- header ---------- */
.header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; text-shadow: var(--text-shadow); }
.brand.logo { height: 40px; width: auto; display: block; user-select: none; -webkit-user-drag: none; }
.icon-btn { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.pill-btn { height: 46px; padding: 0 18px; border-radius: 999px; display: flex; align-items: center; gap: 7px; font-size: 16px; font-weight: 600; cursor: pointer; }

/* ---------- buttons ---------- */
.btn {
  height: 56px; padding: 0 22px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 17px; font-weight: 600; cursor: pointer;
}
.btn.small { height: 44px; font-size: 15px; padding: 0 16px; }
.btn.grow { flex: 1; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- segmented controls ---------- */
.segmented { position: relative; border-radius: 999px; padding: 5px; display: grid; gap: 4px; }
.segmented > button { height: 40px; border-radius: 999px; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; }
.chips { position: relative; display: flex; gap: 2px; background: var(--seg-track); border-radius: 999px; padding: 3px; }
.chips > button { height: 32px; min-width: 38px; padding: 0 11px; border-radius: 999px; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; }
.chips.big > button { height: 36px; padding: 0 14px; font-size: 15px; }
.segmented > button, .chips > button, .tabbar > button { position: relative; z-index: 1; transition: color 0.3s ease; }
.segmented > button { color: var(--muted); }
.segmented > button[aria-pressed="true"], .segmented > button[aria-current="step"], .chips > button[aria-pressed="true"] { color: var(--on-lens); }

/* Selection pill shared by segmented controls, chips and the tab bar; app.js
   sizes and positions it under the selected button, CSS animates the slide. */
.seg-thumb {
  position: absolute; left: 0; top: 0; z-index: 0; border-radius: 999px; pointer-events: none;
  transition: transform 0.45s var(--spring), width 0.45s var(--spring), height 0.45s var(--spring),
    opacity 0.2s ease, background var(--ease), border-color var(--ease), box-shadow var(--ease);
}

/* ---------- grouped lists ---------- */
.list { border-radius: var(--radius-card); overflow: hidden; }
.list-row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; min-height: 56px; border: 0; background: transparent; text-align: left;
  font-size: 17px; font-weight: 500; text-decoration: none; color: var(--text);
}
.list-row + .list-row { border-top: 1px solid var(--divider); }
button.list-row, a.list-row { cursor: pointer; }
.list-row .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-row .title { font-size: 17px; font-weight: 600; }
.list-row .hint { font-size: 14px; line-height: 1.35; color: var(--muted); font-weight: 400; }
.list-row .value { font-weight: 600; text-align: right; }
/* summary (label: value): the label keeps one line, a long value wraps (or stacks its items) on the right */
.summary-row { align-items: flex-start; }
.summary-row .label { flex: none; white-space: nowrap; }
.summary-row .value { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; overflow-wrap: anywhere; }
.app-icon { width: 34px; height: 34px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; color: #FFFFFF; }
.chevron { opacity: 0.6; flex: none; }

/* Inline dropdown: the options unfold under their row (grid 0fr -> 1fr animates the height). */
.dropdown { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.45s var(--spring); }
.dropdown[data-open="true"] { grid-template-rows: 1fr; }
.dropdown > div {
  min-height: 0; overflow: hidden;
  /* the options sit in a darker well, sunk into the card, so they read apart from the rows around */
  background: rgba(0, 0, 0, 0.28); box-shadow: inset 0 6px 10px -8px rgba(0, 0, 0, 0.6);
}
:root[data-theme="light"] .dropdown > div { background: rgba(120, 120, 128, 0.12); box-shadow: inset 0 6px 10px -8px rgba(0, 0, 0, 0.18); }
.dropdown > div > .list-row { border-top: 1px solid var(--divider); }
.dropdown + .list-row { border-top: 1px solid var(--divider); } /* the row after a (folded) dropdown */
.chevron.disclosure { transition: transform 0.45s var(--spring); }
[aria-expanded="true"] > .chevron.disclosure { transform: rotate(90deg); }
.font-option .grow { font-size: 20px; }
.font-option:disabled { cursor: default; opacity: 0.5; }
.soon { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--seg-track); color: var(--muted); flex: none; }

/* ---------- switch ---------- */
.switch {
  width: 51px; height: 31px; flex: none; border-radius: 999px; border: 0; padding: 2px;
  display: flex; justify-content: flex-start; cursor: pointer; background: var(--switch-off);
  transition: background 0.3s ease;
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch:disabled { opacity: 0.45; cursor: not-allowed; }
.switch > span {
  width: 27px; height: 27px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.35s var(--spring);
}
.switch[aria-checked="true"] > span { transform: translateX(20px); }

/* ---------- upload ---------- */
.upload { border-radius: 30px; padding: 26px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; cursor: pointer; width: 100%; }
.upload .circle { width: 68px; height: 68px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.upload .title { font-size: 19px; font-weight: 600; }
.file-chip { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-card); }

/* ---------- preview ---------- */
/* a 9:16 frame like the video; text sizes are shares of its width (cqw), so any copy scales alike. No side
   padding: cqw counts the content box, so it stays the whole frame width; subtitles wrap at 75% like the video */
.preview-frame { align-self: center; border-radius: 30px; padding: 6px; }
.preview {
  position: relative; height: min(52vh, 480px); aspect-ratio: 9 / 16; border-radius: 24px; overflow: hidden; background: var(--preview-bg);
  container-type: inline-size; display: flex; flex-direction: column; align-items: center; padding: 16% 0 26%;
}
.preview .head { position: absolute; left: 50%; top: 24%; width: 40%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; background: var(--silhouette); }
.preview .body { position: absolute; left: 50%; top: 52%; width: 84%; height: 60%; transform: translateX(-50%); border-radius: 50% 50% 0 0; background: var(--silhouette); }
/* lines wrap where the video wraps them: at 55% of the frame (settings._BRANDLY_COLUMN); shadow or halo per word: app.js textShade */
.preview .subs { position: relative; max-width: 55cqw; text-align: center; line-height: 0.95; }
.preview .small { font-weight: 500; color: #FFFFFF; }
.preview .accent { text-transform: uppercase; margin-top: 0.5cqw; }
.preview .subs.minimal { white-space: nowrap; max-width: none; }

/* the mini copy of the preview: like the editor's mini player, it sticks to the top right corner once the
   preview is scrolled away (no room taken) */
.wiz-pip-dock { position: sticky; top: calc(12px + env(safe-area-inset-top)); z-index: 6; height: 0; margin-top: -16px; align-self: flex-end; }
.wiz-pip {
  position: absolute; right: 0; top: 0; width: 104px; aspect-ratio: 9 / 16; padding: 0; overflow: hidden; cursor: pointer;
  border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.14); background: var(--preview-bg); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: scale(0.85); transform-origin: top right; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s var(--spring);
}
.wiz-pip.on { opacity: 1; transform: none; pointer-events: auto; }
.wiz-pip .preview { width: 100%; height: 100%; border-radius: 0; pointer-events: none; }
/* the mini copy tapped: the preview big over the blurred screen, like the editor's big view */
.preview.wiz-big-frame { width: 100%; height: 100%; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 20px 60px rgba(0, 0, 0, 0.5); }

/* ---------- fonts & colors ---------- */
.swatches { border-radius: 999px; padding: 8px; display: flex; justify-content: space-between; }
.swatch { width: 52px; height: 52px; border-radius: 50%; padding: 5px; background: transparent; border: 2px solid transparent; cursor: pointer; transition: border-color 0.25s ease; }
.swatch[aria-pressed="true"] { border-color: var(--sel-ring); }
.swatch > span { display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6); }
/* inside a text style panel: smaller, wrapping swatches */
/* the native color input behind "Свой цвет": rendered (so it can open) but invisible */
.color-picker { position: fixed; left: 0; top: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.swatches.compact { border-radius: 0; padding: 4px 10px 12px; gap: 4px; }
/* one row of ready colors spread over the width; colors that do not fit wrap below and are clipped */
.swatch-fit { flex: 1; min-width: 0; height: 46px; overflow: hidden; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 4px; }
.swatches.compact .swatch { width: 46px; height: 46px; padding: 4px; }
.swatches.compact .swatch > span { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.6); }
.panel-label { padding: 14px 16px 6px; border-top: 1px solid var(--divider); }
/* a text style's look: its font and color on a dark chip, like over video */
.style-sample {
  width: 44px; height: 44px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; background: #1C1C1E; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ---------- speed slider ---------- */
.speed { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.speed-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; font-weight: 500; }
.speed-head output { font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.speed .hint { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.speed-ticks { position: relative; height: 18px; }
.speed-ticks span { position: absolute; top: 0; transform: translateX(-50%); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.speed-ticks span.on { color: var(--text); font-weight: 700; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; }
.range:focus-visible { outline: none; }
.range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--tint) var(--fill), var(--seg-track) var(--fill));
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--tint), 0 2px 8px rgba(0, 0, 0, 0.3); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--seg-track); }
.range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--tint); }
.range::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #FFFFFF; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }

/* ---------- jobs ---------- */
.job { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
/* a finished video's details, in a modal over the list */
.modal {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.modal-scrim {
  position: absolute; inset: 0; border: 0; background: rgba(0, 0, 0, 0.45); cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.modal-card {
  position: relative; width: min(448px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 16px 10px; background: var(--surface);
}
html:has(.modal) { overflow: hidden; }
.modal { animation: modal-in 0.2s ease; }
.modal-card { animation: modal-card-in 0.35s var(--spring); }
@keyframes modal-in { from { opacity: 0; } }
@keyframes modal-card-in { from { transform: scale(0.94); } }
@media (prefers-reduced-motion: reduce) { .modal, .modal-card { animation: none; } }
/* the title centered between equal side columns, the right one holding the close button */
.modal-head { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 8px; }
.modal-head .job-title { grid-column: 2; text-align: center; font-size: 18px; }
.modal-head + .panel-label { border-top: 0; }
.job-info .panel-label { padding: 14px 4px 6px; }
.job-info .list-row { padding: 10px 4px; min-height: 0; font-size: 15px; align-items: flex-start; }
.job-info .list-row .grow { flex: none; }
.job-info .list-row .value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.job-info .note { padding: 6px 4px 4px; text-align: left; }
.dot { display: inline-block; width: 11px; height: 11px; margin-right: 6px; border-radius: 50%; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.4); }
.job-title { font-size: 16px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job { padding: 10px; gap: 10px; border-radius: 24px; }
.job-top { display: flex; gap: 14px; align-items: center; min-width: 0; }
.job-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.job-meta .job-title { font-size: 17px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.job-sub { font-size: 14px; color: var(--muted); }
.job-sub .state { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; background: var(--muted); }
.job-sub .state.ok { background: #34C759; }
.job-sub .state.bad { background: var(--danger); }
.job-sub .state.work { background: var(--tint); animation: job-pulse 1.4s ease-in-out infinite; }
@keyframes job-pulse { 50% { opacity: 0.35; } }
.job-note { margin: 0; padding: 0 4px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.job-acts { display: flex; gap: 8px; align-items: center; }
.job-acts .btn { height: 48px; }
.job-acts .icon-btn { width: 48px; height: 48px; flex: none; text-decoration: none; color: var(--text); }
.job .progress { margin: 2px 4px 4px; }
.thumb { position: relative; width: 92px; height: 132px; border-radius: 16px; overflow: hidden; flex: none; background: var(--preview-bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .head { position: absolute; left: 50%; top: 30px; width: 36px; height: 36px; margin-left: -18px; border-radius: 50%; background: var(--silhouette); }
.thumb .body { position: absolute; left: 50%; top: 72px; width: 70px; height: 70px; margin-left: -35px; border-radius: 35px 35px 0 0; background: var(--silhouette); }
.thumb .dur { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 7px; background: rgba(0, 0, 0, 0.55); color: #FFFFFF; font-size: 12px; font-weight: 600; }
/* «Ещё» of a video: an action sheet from the bottom */
.sheet-modal { align-items: flex-end; }
.sheet { position: relative; width: min(448px, 100%); display: flex; flex-direction: column; gap: 8px; animation: sheet-in 0.35s var(--spring); }
.sheet .list { background: var(--surface); }
.sheet .list-row { justify-content: center; font-weight: 500; }
.sheet .list-row.danger { color: var(--danger); }
.sheet .sheet-title { padding: 12px 16px; text-align: center; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--divider); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .cancel { font-weight: 600; }
@keyframes sheet-in { from { transform: translateY(40%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.progress { height: 6px; border-radius: 3px; background: var(--seg-track); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 3px; background: var(--tint); transition: width 0.4s ease; }
a.btn { text-decoration: none; color: inherit; }
a.btn.tint { color: var(--on-primary); }

/* ---------- packages ---------- */
.pack {
  width: 100%; padding: 16px 18px; cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pack .grow { display: flex; flex-direction: column; gap: 3px; }
.pack[aria-checked="true"] { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ---------- stat tiles, bars ---------- */
.stat { border-radius: var(--radius-card); padding: 16px 18px; }
.stat .num { font-size: 30px; font-weight: 700; }
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.bars div { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.bars i { display: block; width: 100%; height: 44px; border-radius: 8px; background: var(--seg-track); }
.bars i { position: relative; overflow: hidden; }
.bars i b { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 8px; background: var(--tint, #0A84FF); }
.bars .bar-num { min-height: 14px; font-weight: 600; color: var(--text, inherit); font-variant-numeric: tabular-nums; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.code { font-size: 15px; padding: 12px 14px; border-radius: 16px; background: var(--seg-track); word-break: break-all; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: min(448px, calc(100% - 28px)); height: 66px; border-radius: 999px; padding: 5px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px;
}
.tabbar > button {
  border-radius: 999px; border: 1px solid transparent; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10px; font-weight: 600; color: var(--tab-inactive);
}
.tabbar > button[aria-current="page"] { color: var(--on-lens); }
.tabbar > .seg-thumb { background: var(--lens-bg); border-color: transparent; box-shadow: var(--lens-shadow); }

/* ---------- page transitions (View Transitions API, driven by update() in app.js) ---------- */
.header { view-transition-name: header; }
.tabbar { view-transition-name: tabbar; }
.screen { view-transition-name: screen; }

::view-transition-group(*) { animation-duration: 0.45s; animation-timing-function: var(--spring); }
::view-transition-old(*), ::view-transition-new(*) { animation-duration: 0.3s; }

/* Navigation (step push / tab switch). Like iOS, every page keeps its own scroll
   position: the old page leaves from exactly where it was scrolled (--vt-dy undoes
   the jump to the new page's scroll offset), the new one arrives already in place.
   Groups don't morph, so nothing slides vertically. */
:root[data-vt="forward"]::view-transition-group(*),
:root[data-vt="back"]::view-transition-group(*),
:root[data-vt="tab"]::view-transition-group(*) { animation: none; }
/* The tab bar is fixed and stays live, so its pill slides instead of a stale copy fading. */
:root[data-vt]::view-transition-old(tabbar) { animation: none; opacity: 0; }
:root[data-vt]::view-transition-new(tabbar) { animation: none; }

/* Push: the new page slides in from the trailing edge over the old one, which drifts back and fades. */
:root[data-vt="forward"]::view-transition-old(screen) { animation: 0.5s var(--spring) both vt-push-out; }
:root[data-vt="forward"]::view-transition-new(screen) { animation: 0.5s var(--spring) both vt-push-in; }
:root[data-vt="back"]::view-transition-old(screen) { animation: 0.5s var(--spring) both vt-pop-out; }
:root[data-vt="back"]::view-transition-new(screen) { animation: 0.5s var(--spring) both vt-pop-in; }

/* Tabs: a pure opacity cross-fade in place. */
:root[data-vt="tab"]::view-transition-old(screen) { animation: 0.3s ease both vt-fade-out; }
:root[data-vt="tab"]::view-transition-new(screen) { animation: 0.3s ease both vt-fade-in; }

/* The header scrolls with the page: the old copy leaves with it, the new one fades in. */
:root[data-vt="forward"]::view-transition-old(header),
:root[data-vt="back"]::view-transition-old(header),
:root[data-vt="tab"]::view-transition-old(header) { animation: 0.3s ease both vt-fade-out; }
:root[data-vt="forward"]::view-transition-new(header),
:root[data-vt="back"]::view-transition-new(header),
:root[data-vt="tab"]::view-transition-new(header) { animation: 0.3s ease both vt-fade-in; }

@keyframes vt-push-out { from { transform: translateY(var(--vt-dy, 0px)); } to { transform: translate(-30%, var(--vt-dy, 0px)); opacity: 0; } }
@keyframes vt-push-in { from { transform: translateX(100%); } }
@keyframes vt-pop-out { from { transform: translateY(var(--vt-dy, 0px)); } to { transform: translate(100%, var(--vt-dy, 0px)); opacity: 0; } }
@keyframes vt-pop-in { from { transform: translateX(-30%); opacity: 0; } }
@keyframes vt-fade-out { from { transform: translateY(var(--vt-dy, 0px)); } to { transform: translateY(var(--vt-dy, 0px)); opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- editor of a finished video ---------- */
.screen.editor { gap: 12px; margin-bottom: -84px; --ed-radius: 8px; } /* no tab bar under the editor: the dock takes its place */
.ed-head { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.ed-title { font-size: 22px; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-clock { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--label); text-shadow: var(--text-shadow); }
.ed-player { position: relative; align-self: center; height: min(44vh, 500px); aspect-ratio: 9 / 16; }
.ed-player video { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 24px; background: #000; }
/* a still of the edit drawn by the server, over the video until it plays */
.ed-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 24px; background: #000; }
/* the subtitles of the edit, drawn by the server over the copy of the video without text */
.ed-overlay { background: transparent; pointer-events: none; }
.ed-overlay[hidden] { display: none; }
.ed-badge {
  position: absolute; left: 10px; top: 10px; padding: 3px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); color: #FFFFFF; font-size: 12px; font-weight: 700;
}
.ed-mute { position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #FFFFFF; }

/* the mini player: sticks to the top right corner once the player is scrolled away (no room taken) */
.ed-pip-dock { position: sticky; top: calc(12px + env(safe-area-inset-top)); z-index: 6; height: 0; margin-top: -12px; align-self: flex-end; }
.ed-pip {
  position: absolute; right: 0; top: 0; width: 104px; aspect-ratio: 9 / 16; padding: 0; overflow: hidden; cursor: pointer;
  border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.14); background: #000; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: scale(0.85); transform-origin: top right; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s var(--spring);
}
.ed-pip.on { opacity: 1; transform: none; pointer-events: auto; }
/* its sound button, over its bottom right corner (shown with it) */
.ed-pip-dock { --pip-w: 104px; }
.ed-mute.ed-pip-mute { right: 6px; bottom: auto; top: calc(var(--pip-w) * 16 / 9 - 36px); width: 30px; height: 30px; z-index: 1;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.ed-pip.on + .ed-pip-mute { opacity: 1; pointer-events: auto; }
.ed-big-mute { right: 10px; bottom: 10px; width: 38px; height: 38px; }
.ed-player { cursor: pointer; overflow: hidden; border-radius: 24px; background: #000; } /* the video moves under cards */
.ed-player video { transform-origin: 50% 50%; }
.ed-card-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ed-card-layer[hidden] { display: none; }
.ed-mirror { display: block; width: 100%; height: 100%; }
/* the mini player shown big over the blurred editor */
.ed-big .modal-scrim { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.ed-big-card { position: relative; height: min(78vh, 760px); aspect-ratio: 9 / 16; max-width: 100%; animation: modal-card-in 0.35s var(--spring); }
/* opened out of a mini copy (app.js openBig/closeBig): the frame flies from it, the screen darkens alongside */
.ed-big.zooming .ed-big-card { animation: none; }
.ed-big.zooming .ed-big-close, .ed-big.zooming .ed-mute { animation: big-controls-in 0.38s ease both; }
.ed-big.closing { animation: big-out 0.3s ease forwards; pointer-events: none; }
.ed-big.closing .ed-big-close, .ed-big.closing .ed-mute { opacity: 0; transition: opacity 0.12s ease; }
@keyframes big-controls-in { 0%, 55% { opacity: 0; } }
@keyframes big-out { to { background: transparent; } }
.ed-big.closing .modal-scrim { animation: big-scrim-out 0.3s ease forwards; }
@keyframes big-scrim-out { to { opacity: 0; } }
.ed-big-frame { display: block; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 24px; overflow: hidden; background: #000; cursor: pointer; }
.ed-big-play {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); color: #FFFFFF; pointer-events: none;
}
.ed-big-play svg { fill: currentColor; margin-left: 3px; }
.ed-big-close { position: absolute; right: 10px; top: 10px; width: 38px; height: 38px; color: #FFFFFF; }

/* the reel: square scene blocks slide under a fixed playhead in the middle */
.ed-reel-row { display: flex; align-items: center; gap: 10px; }
.ed-play { flex: none; width: 52px; height: 52px; border-radius: var(--ed-radius); }
.ed-play svg.filled { fill: currentColor; }
.ed-strip {
  position: relative; flex: 1; min-width: 0; height: 84px; overflow: hidden;
  cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent);
}
.ed-strip:active { cursor: grabbing; }
.ed-reel { position: absolute; left: 50%; top: 16px; height: 52px; will-change: transform; }
.ed-block {
  position: absolute; top: 0; bottom: 0; border-radius: var(--ed-radius); background: var(--seg-track);
  border: 1px solid var(--divider); display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; color: var(--label); transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.ed-block.on { background: color-mix(in srgb, var(--tint) 22%, transparent); border: 1.5px solid var(--tint); color: var(--tint); }
.ed-block.outro { border: 1.5px dashed var(--divider); background: transparent; }
.ed-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: #FF9F0A; }
.ed-star { position: absolute; top: calc(100% + 3px); transform: translateX(-50%); color: #FFD60A; line-height: 0; }
.ed-star svg { fill: currentColor; }
/* the playhead: a caret over a thin line through the blocks */
.ed-playhead { position: absolute; left: 50%; top: 4px; height: 68px; width: 2px; margin-left: -1px; border-radius: 1px; background: #FF6B3D; pointer-events: none; }
.ed-playhead::before { content: ''; position: absolute; left: -5px; top: -4px; border: 6px solid transparent; border-top: 9px solid #FF6B3D; border-bottom: 0; }
.ed-meta { text-align: center; font-size: 14px; font-weight: 600; color: var(--label); text-shadow: var(--text-shadow); margin-top: -6px; }

/* where pictures (blue) and sounds (yellow) start, under the reel's blocks */
.ed-mark { position: absolute; bottom: -7px; width: 2px; height: 5px; margin-left: -1px; border-radius: 1px; }
.ed-mark.media, .ed-legend .media { background: #0A84FF; }
.ed-mark.sound, .ed-legend .sound { background: #FFD60A; }
.ed-legend { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; font-weight: 500; color: var(--muted); }
.ed-legend i { display: inline-block; width: 3px; height: 11px; border-radius: 1px; margin-left: 4px; }

/* the user's picture over the player, as the video will show it */
.ed-media-layer { position: absolute; inset: 0; border-radius: 24px; overflow: hidden; pointer-events: none; }
.ed-media-layer:not(.on) { display: none; }
.ed-media-layer > * { position: absolute; display: block; object-fit: cover; }
.ed-media-layer.full > * { inset: 0; width: 100%; height: 100%; }
.ed-media-layer.full > .back { filter: blur(8px) brightness(0.92); transform: scale(1.08); }
.ed-media-layer.full > .front { object-fit: contain; }
.ed-media-layer.window > .back, .ed-media-layer.half > .back { display: none; }
.ed-media-layer { container-type: size; }
/* rounded like the video's window: 8% of its width (37% of the frame) */
.ed-media-layer.window > .front { right: 6.4%; top: 3.6%; width: 37%; height: 31%; border-radius: 2.96cqw; }
.ed-media-layer.half > .front { left: 0; top: 0; width: 100%; height: 50%; }
.ed-sound-tag {
  position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: 999px; pointer-events: none;
  background: rgba(255, 214, 10, 0.92); color: #1C1C1E; font-size: 12px; font-weight: 700;
}
.ed-sound-tag[hidden] { display: none; }

/* Медиа and Звук: the current scene on a track of its own */
.ed-scene-row { display: flex; align-items: flex-end; gap: 10px; }
.ed-scene-row .ed-play { width: 48px; height: 48px; margin-bottom: 4px; } /* level with the lane (under the ticks) */
.ed-track { position: relative; flex: 1; min-width: 0; height: 74px; cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.ed-ticks { position: absolute; left: 0; right: 0; top: 0; height: 18px; }
.ed-ticks i { position: absolute; bottom: 0; width: 1px; height: 4px; background: var(--divider); }
.ed-ticks i.whole { height: 7px; background: var(--muted); }
.ed-ticks b { position: absolute; bottom: 8px; left: 0; transform: translateX(-50%); font-size: 10px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ed-lane { position: absolute; left: 0; right: 0; top: 22px; height: 48px; border-radius: var(--ed-radius); background: var(--seg-track); }
.ed-item {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 3px; min-width: 6px;
  border-radius: var(--ed-radius); font-size: 12px; font-weight: 700; white-space: nowrap; overflow: visible; cursor: grab;
}
.ed-item.media { background: color-mix(in srgb, #0A84FF 32%, transparent); border: 1px solid #0A84FF; color: #FFFFFF; }
.ed-item.media.cut-l { border-left-style: dashed; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ed-item.media.cut-r { border-right-style: dashed; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ed-item.sound { justify-content: flex-start; background: color-mix(in srgb, #FFD60A 18%, transparent); border-left: 3px solid #FFD60A; border-radius: 0 var(--ed-radius) var(--ed-radius) 0; color: #FFD60A; }
.ed-item.sound b { padding: 2px 5px; margin-left: -1px; align-self: flex-start; border-radius: 0 4px 4px 0; background: #FFD60A; color: #1C1C1E; font-size: 11px; }
.ed-item.on { box-shadow: 0 0 0 2px var(--text); z-index: 1; }
.ed-item svg { flex: none; }
/* a picture's edges: 5 px to see, 20 px to touch */
.ed-handle { position: absolute; top: -2px; bottom: -2px; width: 20px; cursor: ew-resize; }
.ed-handle::after { content: ''; position: absolute; top: 8px; bottom: 8px; width: 5px; border-radius: 3px; background: var(--text); }
.ed-handle.l { left: -10px; } .ed-handle.l::after { left: 7px; }
.ed-handle.r { right: -10px; } .ed-handle.r::after { right: 7px; }
/* the start of the next scene, shaded: what runs on into it is seen, it is edited from there */
.ed-peek {
  position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--muted); border-radius: 0 var(--ed-radius) var(--ed-radius) 0;
  background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(127, 127, 127, 0.14) 6px 12px); pointer-events: none;
}
.ed-peek b { position: absolute; right: 6px; bottom: 3px; font-size: 10px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.ed-item.later { opacity: 0.4; cursor: default; pointer-events: none; }
/* the part of a picture inside the next scene */
.ed-spill {
  position: absolute; top: 0; bottom: 0; right: 0; pointer-events: none; border-radius: 0 var(--ed-radius) var(--ed-radius) 0;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.28) 0 5px, transparent 5px 10px);
}
.ed-spill-note { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--ed-radius);
  background: rgba(255, 159, 10, 0.16); color: var(--text); font-size: 14px; line-height: 1.35; }
.ed-spill-note .grow { flex: 1; min-width: 0; }
.ed-spill-note svg { vertical-align: -4px; color: #FF9F0A; }
/* how a picture is shown: a picture of the frame for each mode */
.ed-modes { grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--seg-track); }
.ed-modes > button { height: auto; padding: 8px 4px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; }
.ed-modes > .seg-thumb { border-radius: 18px; }
.ed-mode-pic { width: 22px; height: 39px; }
.ed-mode-pic .frame { fill: #2C2C2E; stroke: var(--muted); stroke-width: 1.2; }
.ed-mode-pic .media { fill: #0A84FF; }
.ed-track-head { position: absolute; top: 14px; bottom: 0; width: 2px; margin-left: -1px; background: #FF6B3D; pointer-events: none; z-index: 2; }
.ed-track-head::before { content: ''; position: absolute; left: -5px; top: -4px; border: 6px solid transparent; border-top: 8px solid #FF6B3D; border-bottom: 0; }
.ed-add { align-self: flex-start; }
.ed-add.disabled, .ed-add:disabled { opacity: 0.45; pointer-events: none; }
.ed-sel-row { padding: 0; min-height: 0; }
.ed-sel-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: var(--ed-radius); }

/* the window of picking a sound */
.ed-sounds { max-height: 38vh; }
.ed-sound-row { padding: 0 8px 0 0; min-height: 0; }
.ed-sound-name { flex: 1; min-width: 0; }
.ed-sound-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 11px 12px 11px 16px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; cursor: pointer; text-align: left; }
.ed-sound-pick:disabled { opacity: 0.45; cursor: default; }
.ed-radio { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--divider); }
.ed-sound-row.on .ed-radio { border: 6px solid var(--tint); }
.ed-listen { width: 36px; height: 36px; flex: none; border: 0; background: var(--seg-track); color: var(--text); }
.ed-listen svg.filled, .ed-scene-row svg.filled { fill: currentColor; }
.ed-listen.on { background: var(--tint); color: #FFFFFF; }
.ed-summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.ed-summary b { color: var(--text); font-weight: 600; }
.ed-trim-video { width: 100%; max-height: 34vh; border-radius: var(--ed-radius); background: #000; }

/* the open tab's panel */
.ed-panel { display: flex; flex-direction: column; gap: 12px; }
/* the panel's blocks are as square as the reel's */
.ed-panel .card, .ed-panel .list { border-radius: var(--ed-radius); }
.ed-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ed-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.ed-card-title { font-size: 18px; font-weight: 700; }
.ed-words { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-word-modes { align-self: flex-start; }
.ed-word-emoji { width: 1.15em; height: 1.15em; margin-left: 5px; vertical-align: -0.2em; }
.ed-word-plus { display: inline-flex; margin-left: 5px; opacity: 0.45; vertical-align: -0.1em; }
.ed-word.has-emoji { border-color: var(--text); }
.ed-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.ed-emoji { aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; background: transparent; padding: 6px; cursor: pointer; }
.ed-emoji img { width: 100%; height: 100%; display: block; }
.ed-emoji.on { border-color: var(--text); background: var(--surface-2); }
.ed-word {
  padding: 8px 14px; border-radius: var(--ed-radius); border: 1px solid var(--divider); background: var(--seg-track); cursor: pointer;
  font-size: 17px; font-weight: 600; text-decoration-thickness: 2px; text-underline-offset: 5px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.ed-word.key { color: var(--tint); border-color: var(--tint); text-decoration: underline; background: color-mix(in srgb, var(--tint) 14%, transparent); }
.ed-flag { flex: none; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255, 159, 10, 0.22); color: #FF9F0A; }
.ed-apply { padding: 12px 16px 16px; border-top: 1px solid var(--divider); display: flex; flex-direction: column; gap: 10px; }
.ed-soon { align-items: center; text-align: center; padding: 26px 20px; }
.ed-back { font-weight: 700; }
.ed-sub { padding: 4px 16px 16px; border-top: 1px solid var(--divider); display: flex; flex-direction: column; gap: 12px; }
.ed-sub > :first-child { margin-top: 12px; }
.ed-label { font-size: 15px; font-weight: 600; color: var(--label); }
.ed-value { font-size: 15px; font-weight: 500; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.ed-hint { margin: 0; font-size: 14px; line-height: 1.4; color: var(--muted); }
.ed-hint svg { vertical-align: -3px; }
.ed-input {
  width: 100%; padding: 12px 14px; border-radius: var(--ed-radius); border: 1px solid var(--divider); background: var(--seg-track);
  font: inherit; font-size: 17px; color: var(--text); resize: vertical;
}
.ed-input.accent { color: var(--tint); font-weight: 700; }
.ed-chips { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.ed-link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer; font-size: 16px; font-weight: 700; color: var(--text); text-decoration: none; padding: 6px 0; }
.ed-media-row { display: flex; gap: 14px; align-items: flex-start; }
.ed-thumb { width: 110px; height: 110px; flex: none; object-fit: cover; border-radius: var(--ed-radius); background: #000; }
.ed-thumb.tall { width: 90px; height: 160px; }
.ed-error { margin: 0; font-size: 14px; line-height: 1.4; color: #FF6B60; text-align: center; }
.ed-ok { color: var(--ok); }

/* the dock: tabs, then undo / build / reset; it stays at the bottom of the screen */
.ed-dock {
  position: sticky; bottom: 0; z-index: 5; margin: 4px -16px 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(to bottom, transparent, var(--bg) 22%);
}
.ed-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* the reminder of a style not applied: a small pill over the dock, shown only while «Применить» is off screen */
.ed-remind {
  position: absolute; left: 50%; bottom: calc(100% - 2px); z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; cursor: pointer;
  background: color-mix(in srgb, var(--bg) 92%, transparent); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: opacity 0.25s ease, transform 0.3s var(--spring);
}
.ed-remind.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.ed-remind svg { flex: none; color: #FF9F0A; }
.ed-remind svg.down { color: var(--muted); transform: rotate(90deg); }
.ed-attention { animation: ed-attention 0.9s ease 0.35s; }
@keyframes ed-attention { 30% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--tint) 35%, transparent); } }
@media (prefers-reduced-motion: reduce) { .ed-remind { transition: none; } .ed-attention { animation: none; } }
.ed-tabs > button { height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; }
.ed-tabs > .seg-thumb { background: var(--lens-bg); border: 1px solid var(--lens-border); box-shadow: var(--lens-shadow); }
.ed-dock .icon-btn:disabled { opacity: 0.4; cursor: default; }

.ed-toast {
  position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom));
  width: max-content; max-width: min(420px, calc(100% - 32px)); padding: 10px 16px; border-radius: 16px;
  font-size: 14px; font-weight: 600; line-height: 1.35; text-align: center; animation: ed-toast-in 0.2s ease;
}
@keyframes ed-toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }
/* at the top of the screen, over the editor's title */
.ed-toast.top { top: calc(14px + env(safe-area-inset-top)); bottom: auto; animation-name: ed-toast-down;
  background: var(--glass-solid); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); } /* solid: the title is under it */
@keyframes ed-toast-down { from { opacity: 0; transform: translate(-50%, -6px); } }

/* windows over the editor */
.ed-modal { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px 16px; }
.ed-modal-title { font-size: 19px; font-weight: 700; }
.ed-changes { border: 1px solid var(--divider); max-height: 46vh; overflow-y: auto; }
.ed-changes .panel-label:first-child { border-top: 0; }
.ed-changes .list-row { min-height: 0; padding: 10px 16px; font-size: 16px; }

/* ---------- tokens ---------- */
.pack-badge {
  align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: var(--tint); color: #FFFFFF;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
}
.balance-history .list-row .grow { display: flex; flex-direction: column; gap: 2px; }
.balance-history .value { font-weight: 600; font-variant-numeric: tabular-nums; }
.balance-history .value.delta-plus { color: #34C759; }
.topup { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; }
.topup .note { padding: 0 4px; }

/* The subtitles being redrawn (after an edit, or on a first look at a scene): a small quiet spinner in
   a free corner of the player and of its copies (the badge is top left, the sound button bottom right). It fades in only if the wait lasts (see setWaiting). */
.ed-big-frame { position: relative; }
.ed-loading {
  position: absolute; top: 10px; right: 10px; z-index: 3; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(23, 33, 43, 0.5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.2s ease; pointer-events: none;
}
.ed-loading::after {
  content: ''; position: absolute; inset: 6px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85); border-right-color: transparent;
  animation: ed-spin 0.9s linear infinite;
}
.ed-pip .ed-loading { top: 6px; right: 6px; width: 18px; height: 18px; }
.ed-pip .ed-loading::after { inset: 4px; border-width: 1.5px; }
.ed-big-frame .ed-loading { top: 14px; right: auto; left: 14px; } /* the close button is top right */
.ed-waiting .ed-loading { opacity: 1; transition-delay: 0s; }
@keyframes ed-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ed-loading::after { animation-duration: 2.4s; } }
