@font-face { font-family: "ER Display"; src: url("/static/fonts/Inter_800ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
/* шрифты субтитров — те же файлы, что в рендере, чтобы превью не врало */
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter_800ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/static/fonts/Montserrat_800ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Rubik"; src: url("/static/fonts/Rubik_800ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("/static/fonts/Unbounded_800ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Russo One"; src: url("/static/fonts/RussoOne_400Regular.ttf") format("truetype"); font-weight: 400 800; font-display: swap; }

:root {
  --paper: #F7F5F0; --card: #FFFFFF; --ink: #16151D; --mute: #6E6A7A; --line: #E6E2DA;
  --sun: #FFD83D; --mint: #19B38A; --danger: #D63B2F; --wash: #EFEAFF;
  --r: 18px; --tab-h: 72px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #141318; --card: #1E1D24; --ink: #F3F1EC; --mute: #A09CAA; --line: #2C2A33; --wash: #26233A; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, .brand { font-family: "ER Display", system-ui, sans-serif; letter-spacing: -0.02em; }
h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 6px; }
h2 { font-size: 19px; margin: 24px 0 10px; }
p { margin: 0 0 10px; }
.mute { color: var(--mute); }
.small { font-size: 14px; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible, label:focus-within { outline: 3px solid var(--sun); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 10px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); }
.brand { font-size: 20px; }
.brand .mark { background: var(--sun); color: #16151D; padding: 0 6px; border-radius: 6px; margin-right: 2px; }
.pill { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 14px; font-weight: 600; }

.screen { max-width: 540px; margin: 0 auto; padding: 4px 18px calc(var(--tab-h) + 24px); }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tab-h); display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); z-index: 5; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--mute); border-radius: 12px; }
.tabs button i { font-style: normal; font-size: 20px; line-height: 1; }
.tabs button.on { color: var(--ink); font-weight: 700; }
.tabs button.on i { background: var(--sun); color: #16151D; border-radius: 999px; padding: 3px 10px; }

.cta { display: flex; justify-content: center; align-items: center; gap: 10px; width: 100%; padding: 17px 20px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 17px; }
.cta:disabled { opacity: .45; cursor: default; }
.cta.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.cta.danger { background: var(--danger); color: #fff; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* превью телефона: главный элемент экрана монтажа */
.phone { position: relative; width: 210px; aspect-ratio: 9 / 16; margin: 10px auto 0; border-radius: 22px; overflow: hidden;
  background: linear-gradient(160deg, #2b2f3a, #141620 70%), #1b1d26; box-shadow: 0 18px 40px -22px rgba(0,0,0,.6); }
.phone .face { position: absolute; left: 50%; top: 42%; width: 92px; height: 112px; transform: translate(-50%, -50%);
  border-radius: 46px 46px 40px 40px; background: radial-gradient(circle at 40% 35%, #d8b59b, #a67b5c); }
.phone .body { position: absolute; left: 50%; bottom: -6px; width: 170px; height: 46%; transform: translateX(-50%);
  border-radius: 60px 60px 0 0; background: #3b3f4d; }
.phone .title { position: absolute; left: 14px; right: 14px; top: 10%; text-align: center; font-weight: 800; line-height: 1.15; padding: 6px 8px; border-radius: 6px; }
.phone .caps { position: absolute; left: 10px; right: 10px; top: 66%; text-align: center; font-weight: 800; line-height: 1.1;
  text-shadow: 0 0 2px #000, 0 0 6px #000; }
.phone .caps .hi { display: inline-block; transform: scale(1.08); }
.phone .tag { position: absolute; right: 8px; top: 8px; font-size: 11px; background: rgba(0,0,0,.55); color: #fff; padding: 3px 8px; border-radius: 999px; }
.phone .zoom { position: absolute; inset: 0; animation: zoom 6s ease-in-out infinite alternate; }
@keyframes zoom { from { transform: scale(1); } to { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .phone .zoom { animation: none; } }

.levels { display: flex; gap: 8px; margin: 18px 0 6px; }
.levels button { flex: 1; padding: 12px 8px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); text-align: center; }
.levels button b { display: block; font-size: 15px; }
.levels button span { display: block; font-size: 12px; color: var(--mute); margin-top: 2px; }
.levels button.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.presets { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.presets button { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); font-weight: 600; }
.presets button.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 12px 0; }
.card.warn { border-color: #F2B8B0; background: #FFF4F2; color: #4A1A14; }
@media (prefers-color-scheme: dark) { .card.warn { background: #3A1F1B; color: #FFD9D3; border-color: #7A3A31; } }

textarea, input[type=text], input[type=number] { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; resize: vertical; }
label.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--ink); }

.drop { display: block; border: 2px dashed var(--line); border-radius: var(--r); padding: 20px; text-align: center; background: var(--card); margin: 14px 0; }
.drop input { display: none; }
.drop.has { border-style: solid; border-color: var(--mint); }
.files { text-align: left; font-size: 14px; margin-top: 8px; }
.files div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px dashed var(--line); }

.list .item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); text-align: left; width: 100%; }
.list .item:first-child { border-top: 0; }
.thumb { flex: 0 0 56px; width: 56px; height: 100px; border-radius: 10px; background: #2b2f3a center/cover no-repeat; display: grid; place-items: center; color: #fff; font-size: 22px; }
.item .t { font-weight: 700; }
.item .s { font-size: 13px; color: var(--mute); }
.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--wash); }
.status.ready { background: #DDF5EC; color: #0C6B52; }
.status.failed { background: #FBE1DD; color: #8E2419; }
.status.busy::after { content: "…"; }

video { width: 100%; max-height: 70vh; border-radius: var(--r); background: #000; display: block; }
.copies { display: flex; gap: 8px; }
.copies button { flex: 1; padding: 12px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); font-weight: 700; font-size: 18px; }
.copies button.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.phrase { padding: 6px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.phrase.cut { color: var(--mute); }
.phrase .why { font-size: 12px; }
.phrase s { opacity: .6; }
.phrase b { display: inline-block; min-width: 24px; }
details summary { cursor: pointer; font-weight: 700; margin: 16px 0 6px; }

.pack { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); width: 100%; text-align: left; }
.pack:first-child { border-top: 0; }
.pack .price { font-weight: 800; font-size: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.stat .n { font-family: "ER Display", system-ui, sans-serif; font-size: 34px; line-height: 1; }
.stat .l { font-size: 13px; color: var(--mute); margin-top: 4px; }
.field { margin: 10px 0; }
.field label { display: block; font-size: 13px; color: var(--mute); margin-bottom: 4px; }
select { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }
input[type=color] { width: 100%; height: 42px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); padding: 2px; }
.progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; width: 40%; background: var(--mint); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .progress i { animation: none; width: 100%; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 14px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 14px; max-width: 90vw; transition: .2s; z-index: 9; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }
