/* Video to Circle — мини-приложение.
   Цвета берутся у Telegram (--tg-theme-*), остальное выводится из них, так что
   приложение само подстраивается под светлую и тёмную темы клиента. */

/* ---------- шрифт: Inter, свой, без обращений к сторонним серверам ---------- */
@font-face { font-family: "VtcFont0"; font-weight: 700; font-display: swap; src: url(/static/fonts/label-inter.woff2) format("woff2"); }
@font-face { font-family: "VtcFont1"; font-weight: 700; font-display: swap; src: url(/static/fonts/label-playfair.woff2) format("woff2"); }
@font-face { font-family: "VtcFont2"; font-weight: 700; font-display: swap; src: url(/static/fonts/label-oswald.woff2) format("woff2"); }
@font-face { font-family: "VtcFont3"; font-weight: 700; font-display: swap; src: url(/static/fonts/label-pacifico.woff2) format("woff2"); }
@font-face { font-family: "VtcFont4"; font-weight: 700; font-display: swap; src: url(/static/fonts/label-mono.woff2) format("woff2"); }
@font-face { font-family: "VtcFont5"; font-weight: 700; font-display: swap; src: url(/static/fonts/label-caveat.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/inter-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/inter-cyrillic-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/inter-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/inter-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- переменные ---------- */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --bg: var(--tg-theme-bg-color, #0d1016);
  --text: var(--tg-theme-text-color, #eef2f7);
  --hint: var(--tg-theme-hint-color, #8a96a8);
  --accent: var(--tg-theme-button-color, #4c8dff);
  --on-accent: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, var(--accent));
  --danger: #ff5a6a;
  --ok: #2fcf94;
  --warn: #ffb648;

  /* Запасные значения для клиентов без color-mix(). */
  --card: rgba(128, 140, 160, 0.12);
  --card-2: rgba(128, 140, 160, 0.2);
  --line: rgba(128, 140, 160, 0.22);
  --track: rgba(128, 140, 160, 0.28);
  --accent-2: #9a6bff;
  --accent-soft: rgba(76, 141, 255, 0.16);
  --veil: rgba(0, 0, 0, 0.55);
  --glass: rgba(13, 16, 22, 0.78);

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --dock-h: 72px;
  --safe-t: max(env(safe-area-inset-top, 0px), var(--tg-safe-t, 0px));
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-b, 0px));
  --ease: cubic-bezier(0.22, 0.9, 0.28, 1);
}

@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --card: color-mix(in srgb, var(--text) 6%, var(--bg));
    --card-2: color-mix(in srgb, var(--text) 11%, var(--bg));
    --line: color-mix(in srgb, var(--text) 13%, transparent);
    --track: color-mix(in srgb, var(--text) 18%, var(--bg));
    --accent-2: color-mix(in srgb, var(--accent) 50%, #c26bff);
    --accent-soft: color-mix(in srgb, var(--accent) 17%, transparent);
    --veil: color-mix(in srgb, #000 58%, transparent);
    --glass: color-mix(in srgb, var(--bg) 76%, transparent);
  }
}

/* ---------- основа ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: var(--tg-vh, 100dvh);
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  font-feature-settings: "cv11", "ss03";
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
b, strong { font-weight: 650; }
code { font: 600 0.9em ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--card-2);
  padding: 1px 6px; border-radius: 6px; }
a { color: var(--link); }
[hidden] { display: none !important; }
.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.85;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; }
.muted { color: var(--hint); }
.grow { flex: 1; min-width: 0; }

/* мягкое свечение за интерфейсом */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.9;
  background:
    radial-gradient(70% 38% at 12% -4%, var(--accent-soft), transparent 70%),
    radial-gradient(60% 34% at 104% 6%, rgba(154, 107, 255, 0.13), transparent 70%); }

/* ---------- каркас ---------- */
.content {
  max-width: 560px; margin: 0 auto;
  padding: calc(var(--safe-t) + 14px) 14px calc(var(--dock-h) + var(--safe-b) + 34px);
}
.page-title { margin: 6px 4px 2px; font-size: 28px; line-height: 1.12; font-weight: 750; letter-spacing: -0.03em; }
.section-title { margin: 22px 6px 8px; font-size: 12px; font-weight: 650; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--hint); }
.boot { display: grid; place-items: center; min-height: 60dvh; }
.boot-mark { width: 54px; height: 54px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent));
  -webkit-mask: radial-gradient(farthest-side, transparent 62%, #000 64%);
  mask: radial-gradient(farthest-side, transparent 62%, #000 64%); animation: spin 0.9s linear infinite; }

/* ---------- карточки ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; position: relative; }
.card > * + * { margin-top: 12px; }
.card h2, .card h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.card p { margin: 0; }
.card .lead { color: var(--hint); font-size: 13.5px; }
.note, .lead { white-space: pre-line; }
#admin-stats .note { line-height: 1.55; }
.note { border-radius: var(--r-md); padding: 12px 14px; font-size: 13.5px; background: var(--accent-soft);
  border: 1px solid var(--line); }
.note.warn { background: rgba(255, 182, 72, 0.14); }
.note.bad { background: rgba(255, 90, 106, 0.14); }
.note.ok { background: rgba(47, 207, 148, 0.14); }

/* ---------- кнопки ---------- */
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 18px; border-radius: 14px; font-weight: 650; font-size: 15px; background: var(--card-2);
  border: 1px solid var(--line); transition: transform 0.15s var(--ease), filter 0.2s, background 0.2s; user-select: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn.primary { color: var(--on-accent); border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -10px var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); background: rgba(255, 90, 106, 0.1); border-color: rgba(255, 90, 106, 0.25); }
.btn.big { min-height: 52px; font-size: 16px; border-radius: 16px; }
.btn.sm { min-height: 36px; padding: 0 13px; font-size: 13.5px; border-radius: 11px; }
.btn.full { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 0; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--card-2); color: var(--text); transition: transform 0.15s var(--ease), background 0.2s; }
.icon-btn:active { transform: scale(0.9); }
.icon-btn .i { width: 19px; height: 19px; }

/* ---------- профиль-шапка и квота ---------- */
.hero { display: flex; align-items: center; gap: 13px; padding: 14px 16px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 750; font-size: 19px; color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.hero-name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 650; background: var(--card-2); color: var(--hint); }
.pill.pro { color: #2b1d00; background: linear-gradient(135deg, #ffd36a, #ffab3d); }
.pill .i { width: 14px; height: 14px; }
.quota-box { display: grid; justify-items: center; gap: 3px; flex: none; }
.quota-box small { font-size: 10px; color: var(--hint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.quota { --p: 0; width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--track) 0); position: relative; }
.quota::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg); }
.quota > * { position: relative; text-align: center; line-height: 1.05; }
.quota b { display: block; font-size: 16px; font-weight: 750; }
.quota small { display: block; font-size: 9.5px; color: var(--hint); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- превью-кружок ---------- */
.pv { position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  background: var(--card-2); isolation: isolate; }
.pv img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 0.28s; }
.pv img[src] { opacity: 1; }
.pv.loading::after { content: ""; position: absolute; inset: 0; border-radius: 50%; z-index: 2;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%) 0 0 / 220% 100%;
  animation: shimmer 1.1s linear infinite; }

/* ---------- создание кружка ---------- */
.stage { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.circle { position: relative; display: block; width: min(62vw, 232px); cursor: pointer; border-radius: 50%;
  transition: transform 0.25s var(--ease); }
.circle:active { transform: scale(0.97); }
.circle .pv { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent), 0 24px 48px -18px var(--accent); }
.circle-badge { position: absolute; right: 4%; bottom: 4%; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; color: var(--on-accent); border: 3px solid var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); z-index: 3; }
.circle-badge .i { width: 21px; height: 21px; }
.stage-title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.stage-sub { font-size: 13.5px; color: var(--hint); margin-top: 2px; word-break: break-word; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; padding: 4px 11px;
  border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); color: var(--hint); }
.tag .i { width: 13px; height: 13px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 99px; font-size: 13.5px;
  font-weight: 600; background: var(--card-2); border: 1px solid var(--line); transition: transform 0.15s var(--ease), background 0.2s; }
.chip:active { transform: scale(0.96); }
.chip .i { width: 16px; height: 16px; color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); }
.chip em { font-style: normal; color: var(--hint); font-weight: 500; }

/* прогресс конвертации */
.progress { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-md);
  background: var(--accent-soft); border: 1px solid var(--line); text-align: left; }
.ring { --p: 0; width: 52px; height: 52px; flex: none; border-radius: 50%; position: relative; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--track) 0); transition: background 0.3s; }
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--bg); }
.ring b { position: relative; font-size: 13px; font-weight: 750; }
.ring.spin { background: conic-gradient(from 0deg, var(--accent), var(--accent-2), transparent 70%); animation: spin 1s linear infinite; }
.ring.spin b { animation: spin 1s linear infinite reverse; }

/* ---------- нижний док ---------- */
.dock { position: fixed; z-index: 30; left: 50%; bottom: calc(10px + var(--safe-b)); width: min(calc(100% - 20px), 460px);
  transform: translateX(-50%); display: flex; gap: 2px; padding: 6px; border-radius: 26px;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.6); transition: transform 0.3s var(--ease), opacity 0.2s; }
body.kbd .dock { transform: translate(-50%, 160%); opacity: 0; pointer-events: none; }
.tab { flex: 1 1 0; min-width: 0; height: 48px; border-radius: 20px; display: flex; align-items: center;
  justify-content: center; color: var(--hint); transition: flex-grow 0.35s var(--ease), background 0.25s, color 0.25s; }
.tab .i { width: 22px; height: 22px; }
.tab .lbl { max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; font-size: 13.5px; font-weight: 650;
  transition: max-width 0.35s var(--ease), opacity 0.2s, margin 0.35s var(--ease); }
.tab.active { flex-grow: 2.5; color: var(--accent); background: var(--accent-soft); }
.tab.active .lbl { max-width: 110px; opacity: 1; margin-left: 7px; }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--hint); }
.input, select.input { width: 100%; min-height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card-2); outline: none; transition: border-color 0.2s, box-shadow 0.2s; appearance: none; -webkit-appearance: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--hint) 50%), linear-gradient(135deg, var(--hint) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; padding: 4px; border-radius: 16px; background: var(--card-2); gap: 4px; }
.seg button { flex: 1; min-height: 40px; border-radius: 12px; font-weight: 600; font-size: 14px; color: var(--hint);
  transition: background 0.25s var(--ease), color 0.25s, box-shadow 0.25s; }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: 0 2px 10px -3px rgba(0, 0, 0, 0.45); }
.seg button:disabled { opacity: 0.45; }

.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 11px 0; }
.kv > div + div { border-top: 1px solid var(--line); }
.kv span { color: var(--hint); font-size: 14px; }
.kv b { font-weight: 650; text-align: right; word-break: break-word; }

.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; text-align: left; width: 100%; }
.row + .row { border-top: 1px solid var(--line); }
.row .avatar { width: 40px; height: 40px; font-size: 16px; }
.row small { display: block; color: var(--hint); font-size: 12.5px; }

.price { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 14px 16px;
  border-radius: var(--r-md); background: var(--card-2); border: 1px solid var(--line); text-align: left;
  transition: transform 0.15s var(--ease), border-color 0.2s; }
.price:active { transform: scale(0.98); }
.price.best { border-color: var(--accent); background: var(--accent-soft); }
.price b { font-size: 16px; }
.price .stars { font-weight: 700; color: #ffb648; white-space: nowrap; }
.stack > * + * { margin-top: 10px; }

/* ---------- нижняя шторка ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: transparent; transition: background 0.3s; }
.sheet-wrap.open { background: var(--veil); }
.sheet { width: min(100%, 560px); max-height: calc(var(--tg-vh, 100dvh) - var(--safe-t) - 18px); display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-xl) var(--r-xl) 0 0;
  transform: translateY(105%); transition: transform 0.42s var(--ease), height 0.3s var(--ease);
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.6); overflow: hidden; }
.sheet-wrap.open .sheet { transform: translateY(var(--drag, 0px)); }
.sheet.dragging { transition: none; }
.sheet-grab { padding: 9px 0 4px; display: grid; place-items: center; touch-action: none; cursor: grab; flex: none; }
.sheet-grab::before { content: ""; width: 38px; height: 4.5px; border-radius: 9px; background: var(--track); }
#sheet-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.view { display: flex; flex-direction: column; min-height: 0; flex: 1; animation: view-in 0.34s var(--ease) both; }
.view.back { animation-name: view-back; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 4px 18px 10px; flex: none; }
.sheet-head h2 { margin: 0; font-size: 21px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; }
.sheet-head p { margin: 2px 0 0; font-size: 13px; color: var(--hint); }
.sheet-scroll { scrollbar-gutter: stable; overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 14px; flex: 1; min-height: 0;
  -webkit-overflow-scrolling: touch; }
.sheet-scroll > * + * { margin-top: 14px; }
.sheet-foot { flex: none; padding: 12px 18px calc(14px + var(--safe-b)); display: flex; gap: 10px;
  border-top: 1px solid var(--line); background: var(--bg); }
.sheet-foot .btn { flex: 1; padding: 0 12px; font-size: 14px; white-space: nowrap; }

/* категории эффектов */
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 2px 18px 12px; scrollbar-width: none; scroll-snap-type: x proximity;
  flex: none; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 99px;
  font-size: 13.5px; font-weight: 600; color: var(--hint); background: var(--card); border: 1px solid var(--line);
  scroll-snap-align: start; transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.15s var(--ease); }
.cat:active { transform: scale(0.95); }
.cat .i { width: 17px; height: 17px; }
.cat.active { color: var(--text); background: var(--accent-soft); border-color: var(--accent); }
.cat .dot { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--on-accent); background: var(--accent); }

/* плитки эффектов */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 10px; }
.tile { position: relative; animation: pop-in 0.34s var(--ease) both; }
.tile-main { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.thumb { position: relative; display: block; width: 100%; max-width: 98px; aspect-ratio: 1; border-radius: 50%;
  padding: 3px; background: var(--line); transition: background 0.25s, transform 0.2s var(--ease), box-shadow 0.25s; }
.thumb > .pv, .thumb > .art { border: 2px solid var(--bg); }
.tile-main:active .thumb { transform: scale(0.94); }
.tile.on .thumb { background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -10px var(--accent); }
.tile.locked .thumb { filter: saturate(0.5); opacity: 0.7; }
.tick { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  color: var(--on-accent); background: var(--accent); border: 3px solid var(--bg); transform: scale(0); transition: transform 0.3s var(--ease); z-index: 3; }
.tick .i { width: 13px; height: 13px; stroke-width: 3; }
.tile.on .tick { transform: scale(1); }
.lock { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card-2); border: 3px solid var(--bg); color: var(--hint); z-index: 3; }
.lock .i { width: 12px; height: 12px; }
.tile-name { font-size: 12.5px; font-weight: 600; line-height: 1.2; text-align: center; letter-spacing: -0.01em; }
.tile.on .tile-name { color: var(--accent); }
.tile-cog { position: absolute; top: -6px; left: calc(50% + 22px); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--line); color: var(--text); z-index: 4;
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.5); transition: transform 0.15s var(--ease); }
.tile-cog .i { width: 15px; height: 15px; }
.tile-cog:active { transform: scale(0.88); }

.art { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; font-size: 32px; line-height: 1;
  background: radial-gradient(circle at 30% 25%, var(--card-2), var(--card)); }
.art-big { border: 1px solid var(--line); }

/* экран параметров: картинка закреплена над прокручиваемыми настройками */
.pv-stage { display: grid; justify-items: center; gap: 8px; padding: 0 18px 12px; flex: none; border-bottom: 1px solid var(--line); }
.pv-stage .lead { margin: 0; font-size: 13px; }
.pv-big { width: min(36vw, 138px); border-radius: 50%; padding: 3px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 40px -20px var(--accent); }
.pv-big .pv { border: 3px solid var(--bg); }
.pv-stage .art-big { width: 84px; height: 84px; font-size: 38px; margin: 0; }
.ctl { padding: 14px; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--line); }
.ctl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ctl-label { font-weight: 650; font-size: 14px; }
.ctl-val { font-weight: 700; color: var(--accent); min-width: 3ch; text-align: right; font-feature-settings: "tnum"; }
.ctl-reset { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--hint);
  background: var(--card-2); margin-left: 8px; }
.ctl-reset .i { width: 14px; height: 14px; }
.ctl-right { display: flex; align-items: center; }
.slider-row { display: flex; align-items: center; gap: 10px; }
.step { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--card-2);
  transition: transform 0.15s var(--ease); }
.step:active { transform: scale(0.88); }
.step .i { width: 17px; height: 17px; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; background: transparent; --pct: 50%; margin: 0; touch-action: pan-y; }
.range:focus { outline: none; }
.range::-webkit-slider-runnable-track { height: 8px; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) var(--pct), var(--track) var(--pct)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: #fff;
  border: 0; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), 0 0 0 5px var(--accent-soft); transition: box-shadow 0.2s; }
.range:active::-webkit-slider-thumb { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), 0 0 0 9px var(--accent-soft); }
.range::-moz-range-track { height: 8px; border-radius: 99px; background: var(--track); }
.range::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--accent); }
.range::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 99px; flex: none; background: var(--track); transition: background 0.25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); transition: transform 0.3s var(--ease); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }

.swatches { display: flex; flex-wrap: wrap; gap: 11px; padding: 6px 4px 4px; }
.swatch { --c: #fff; width: 36px; height: 36px; border-radius: 50%; background: var(--c); position: relative; flex: none;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.35); transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.swatch:active { transform: scale(0.9); }
.swatch.on { box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.35), 0 0 0 3px var(--bg), 0 0 0 5px var(--c); transform: scale(1.04); }
.swatch.on::after { content: ""; position: absolute; inset: 0; margin: auto; width: 11px; height: 6px; border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff; transform: translateY(-1px) rotate(-45deg); filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6)); }
.swatch.custom { background: conic-gradient(#ff4d6d, #ffd166, #2ec4b6, #3d8bfd, #8b5cf6, #ff4d6d); overflow: hidden; }
.swatch.custom.on { background: var(--c); overflow: visible; }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.txt { display: flex; align-items: center; gap: 8px; }
.txt .input { flex: 1; }
.counter { font-size: 12px; color: var(--hint); font-feature-settings: "tnum"; min-width: 4ch; text-align: right; }
.hint { font-size: 12.5px; color: var(--hint); margin-top: 8px; }

.dial { position: relative; width: 168px; height: 168px; margin: 10px auto 4px; touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: pointer; --a: 0deg; }
.dial-ring { position: absolute; inset: 0; border-radius: 50%; border: 12px solid var(--track); }
.dial-ticks { position: absolute; inset: 22px; border-radius: 50%;
  background: repeating-conic-gradient(from -0.9deg, var(--hint) 0 1.8deg, transparent 1.8deg 15deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 7px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 7px)); opacity: 0.55; }
.dial-knob { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45), 0 0 0 5px var(--accent-soft);
  transform: rotate(var(--a)) translateY(-72px); transition: transform 0.2s var(--ease); }
.dial[data-js-drag] .dial-knob { transition: none; }
.dial-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.dial-mid b { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; }
.dial-mid small { font-size: 12px; color: var(--hint); }
.dial-presets { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- тост ---------- */
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--dock-h) + var(--safe-b) + 26px); max-width: min(92vw, 420px);
  transform: translate(-50%, 24px); opacity: 0; padding: 12px 16px; border-radius: 16px; font-size: 14px; font-weight: 550; text-align: center;
  background: var(--text); color: var(--bg); box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.6);
  transition: transform 0.35s var(--ease), opacity 0.25s; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.bad { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #05281c; }

/* ---------- анимации ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.9) translateY(6px); } }
@keyframes view-in { from { opacity: 0; transform: translateX(26px); } }
@keyframes view-back { from { opacity: 0; transform: translateX(-26px); } }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }
.screen { animation: screen-in 0.4s var(--ease) both; }
.screen > * + * { margin-top: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (min-width: 520px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .thumb { max-width: 108px; }
}

.ctl-reset[hidden-slot] { visibility: hidden; pointer-events: none; }

/* шрифты подписи: каждое название набрано своим шрифтом */
.fontchips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.fontchip { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); text-align: left;
  background: var(--card-2); border: 1.5px solid transparent; color: var(--text); font-weight: 700; min-width: 0; }
.fontchip b { font-size: 22px; line-height: 1; font-weight: 700; flex: none; }
.fontchip span { font-size: 12px; color: var(--hint); font-family: Inter, sans-serif; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fontchip.on { border-color: var(--accent); background: var(--accent-soft); }
.fontchip:active { transform: scale(0.97); }

/* выбор из нескольких вариантов и сетка положений 5×5 */
.choice { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 8px auto 2px; max-width: 232px; padding: 8px;
  border-radius: var(--r-md); background: var(--card-2); }
.cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; }
.cell i { width: 7px; height: 7px; border-radius: 50%; background: var(--hint); opacity: 0.55; transition: all 0.16s; }
.cell:active i { transform: scale(1.6); }
.cell.on { background: var(--accent); }
.cell.on i { width: 9px; height: 9px; background: #fff; opacity: 1; }
.swatch.auto { display: grid; place-items: center; background: linear-gradient(135deg, #fff 50%, #12141a 50%); }
.swatch.auto b { font-size: 15px; font-weight: 800; color: #6d4aff; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.swatch.auto.on::after { display: none; }

/* эффекты, рисующие и в углах кадра: показываем квадрат, а круг — пунктирной меткой */
.pv.square { border-radius: 14px; }
.pv-big.square { border-radius: 22px; width: min(40vw, 150px); }
.pv-big.square .pv { border-radius: 18px; overflow: visible; }
.pv-big.square .pv img { border-radius: 16px; }
.pv-big.square .pv::before { content: ""; position: absolute; inset: 0; border-radius: 50%; z-index: 3; pointer-events: none;
  border: 1.5px dashed rgba(255, 255, 255, 0.75); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); }
.pv.square.loading::after { border-radius: 14px; }

/* картинка водяного знака: одна кнопка с миниатюрой внутри */
.wm-btn { margin-top: 8px; gap: 10px; }
.wm-btn .btn-figure { width: 30px; height: 30px; flex: none; border-radius: 8px; object-fit: contain;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.25) 0 25%, rgba(255, 255, 255, 0.05) 0 50%) 0 0 / 10px 10px; }
.wm-btn .i { width: 20px; height: 20px; }
.wm-btn.lost { background: var(--card-2); color: var(--danger); border-color: var(--danger); }
.wm-btn.lost .i { color: var(--danger); }
.hint.bad { color: var(--danger); }

/* лента категорий: на компьютере её крутят колесом и тащат мышью */
@media (hover: hover) {
  .cats { scroll-snap-type: none; cursor: grab; }
  .cats.dragging { cursor: grabbing; user-select: none; }
}
