/* ============================================================
   NeuroArt Studio — design system (premium pass, 2026-07-13)
   Black-platinum + single amber — approved base, preserved.
   Structure layered on top: strict 8pt · two-layer depth ·
   unified radii · amber-as-material · ease-out motion.
   Display: Manrope · Body: Inter · Numerals: JetBrains Mono
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg: #0A0A0B;            /* black platinum — near-black, neutral */
  --bg-soft: #121214;
  --surface: rgba(216, 222, 232, 0.05);   /* platinum-tinted neutrals */
  --surface-2: rgba(216, 222, 232, 0.085);
  --surface-3: rgba(216, 222, 232, 0.13);
  --surface-solid: #16161A;
  --surface-solid-2: #1F1F24;

  --ink: #F2F4F8;           /* platinum white */
  --ink-dim: #AEB4C0;
  --ink-faint: #6E7480;
  --ink-faint-card: #868C9C;  /* AA-safe on tinted card surfaces (4.5:1+) */
  --ink-ghost: rgba(242, 244, 248, 0.5);

  --line: rgba(216, 222, 232, 0.10);
  --line-strong: rgba(216, 222, 232, 0.20);

  --accent: #F5B400;        /* amber — the single accent */
  --accent-2: #FFC93C;
  --accent-soft: #FFD86B;
  --accent-glow: rgba(245, 180, 0, 0.45);
  --gold: #D8DEE8;          /* platinum (premium highlight) */

  /* amber-as-material alpha steps (the ONLY alpha values for the accent) */
  --amber-a03: rgba(245, 180, 0, 0.03);
  --amber-a05: rgba(245, 180, 0, 0.05);
  --amber-a08: rgba(245, 180, 0, 0.08);
  --amber-a12: rgba(245, 180, 0, 0.12);
  --amber-a18: rgba(245, 180, 0, 0.18);
  --amber-a25: rgba(245, 180, 0, 0.25);
  --amber-a35: rgba(245, 180, 0, 0.35);
  --amber-a50: rgba(245, 180, 0, 0.50);

  --good: #5EE08A;
  --bad: #FF6259;

  /* dark text/icon drawn ON the amber accent (buttons, thumb, mark) */
  --on-accent: #1A1300;

  --tint-image: var(--accent);
  --tint-video: var(--accent-2);
  --tint-music: var(--accent-soft);

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-pill: 999px;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --shadow-1: 0 1px 0 rgba(216, 222, 232, 0.05) inset, 0 10px 30px -16px rgba(0, 0, 0, 0.7);
  /* raised card (TZ §5.2): surface/2 + soft drop shadow */
  --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.42), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  --shadow-2: 0 24px 70px -24px rgba(0, 0, 0, 0.85);

  /* motion — ease-out exponential, no bounce/elastic */
  --dur-1: 150ms; --dur-2: 200ms; --dur-3: 280ms;
  --ease-out-quart: cubic-bezier(.25, 1, .4, 1);

  /* spacing — strict 8pt scale (TZ §2.2) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 40px; --s-8: 48px; --s-9: 64px;

  --ff-display: "Manrope", system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --ff-body: "Inter", system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", monospace;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 80% at 50% -10%, #17151A 0%, var(--bg) 55%),
    var(--bg);
}
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; -webkit-tap-highlight-color: transparent; }
input, textarea { font-family: inherit; color: inherit; }
::selection { background: var(--accent-glow); color: #fff; }
svg { display: block; }

/* ── Keyboard focus ──────────────────────────────────────
   :focus-visible only — touch/mouse taps never show rings,
   Tab navigation always does. One amber ring system for every
   interactive element (buttons, links, chips, rows, inputs). */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
.btn:focus-visible, .chip:focus-visible, .row:focus-visible,
.tabnav__item:focus-visible, .tabnav__fab:focus-visible,
.sheetopt:focus-visible, .optcard:focus-visible, .modelcard:focus-visible,
.inspfilt:focus-visible, .reftab__t:focus-visible, .genlive__row:focus-visible,
[role="button"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-2);
}
input:focus-visible[type="checkbox"], input:focus-visible[type="color"],
input:focus-visible[type="file"], input:focus-visible[type="range"] {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

/* ── Atmosphere ─────────────────────────────────────────── */
.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.9  0 0 0 0 0.7  0 0 0 0.9 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; }
.glow--a { width: 60vw; height: 60vw; left: -22vw; top: -24vw; background: radial-gradient(circle, var(--accent) 0%, transparent 65%); opacity: 0.38; animation: drift1 18s ease-in-out infinite; }
/* Тонкая фактура «расплавленного золота»: bg-ambient подложен только на этот
   glow (план §5.6) — почти чёрная текстура в screen-смешении не спорит с
   радиальным градиентом, только добавляет зерно света. */
.glow--b { width: 55vw; height: 55vw; right: -24vw; top: 8vw; background-image: url('assets/showcase/bg-ambient-t.webp'), radial-gradient(circle, #3D2E00 0%, transparent 65%); background-size: cover, cover; mix-blend-mode: screen; opacity: 0.5; animation: drift2 22s ease-in-out infinite; }
.glow--c { width: 50vw; height: 50vw; left: 18vw; bottom: -30vw; background: radial-gradient(circle, var(--gold) 0%, transparent 60%); opacity: 0.14; animation: drift3 26s ease-in-out infinite; }
@keyframes drift1 { 50% { transform: translate(8vw, 6vw) scale(1.1); } }
@keyframes drift2 { 50% { transform: translate(-7vw, 10vw) scale(0.9); } }
@keyframes drift3 { 50% { transform: translate(10vw, -8vw) scale(1.15); } }

/* ── Device frame ───────────────────────────────────────── */
.device {
  position: relative;
  z-index: 1;
  width: min(100vw, 420px);
  height: min(100dvh, 900px);
  background: linear-gradient(180deg, #0C0C0E 0%, #08080A 100%);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: none;
}
@media (min-width: 480px) {
  body { padding: 24px; }
  .device {
    border-radius: 46px;
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-2), 0 0 0 10px #050507, 0 0 0 11px #15151A;
    height: min(100dvh - 48px, 880px);
  }
  .device__notch {
    position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
    width: 116px; height: 30px; background: #050507; border-radius: var(--r-lg); z-index: 40;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset;
  }
}
@media (max-width: 479px) { .device__notch { display: none; } }

/* ── Status bar ─────────────────────────────────────────── */
.statusbar {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--ink);
  padding-top: env(safe-area-inset-top, 0);
  position: relative; z-index: 20;
}
@media (min-width: 480px) { .statusbar { padding-top: 18px; } }
.statusbar__brand { font-family: var(--ff-display); font-size: 11px; letter-spacing: 0.32em; color: var(--ink-faint); }

/* ── App shell ──────────────────────────────────────────── */
.app {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* ── Top bar ────────────────────────────────────────────── */
.topbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 12px;
  position: relative; z-index: 15;
}
.topbar__back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); }
.topbar__back svg { width: 22px; height: 22px; transition: transform .25s var(--ease); }
.topbar__back:active svg { transform: translateX(-3px); }
.topbar__back[hidden] { visibility: hidden; }
.topbar__center { text-align: center; min-width: 0; }
.topbar__title { font-family: var(--ff-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__sub { font-size: 11px; color: var(--ink-faint); margin-top: 2px; letter-spacing: 0.04em; text-transform: uppercase; min-height: 13px; }
.topbar__trail { display: flex; align-items: center; gap: 8px; min-width: 44px; justify-content: flex-end; }

.iconbtn { display: grid; place-items: center; border-radius: 50%; color: var(--ink); transition: background .2s, transform .15s; }
.iconbtn:active { transform: scale(0.92); }

/* balance pill in topbar */
.balpill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px 7px 10px; border-radius: var(--r-pill);
  background: linear-gradient(135deg, rgba(216,222,232,0.16), var(--amber-a12));
  border: 1px solid rgba(216,222,232,0.30);
  font-family: var(--ff-mono); font-weight: 600; font-size: 13px; color: var(--gold);
  line-height: 1; white-space: nowrap;
}
.balpill__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.balpill.balpill--buy { color: var(--accent-2); border-color: var(--amber-a35); background: linear-gradient(135deg, var(--amber-a18), var(--amber-a05)); }

/* ── Screen base ────────────────────────────────────────── */
.screen {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px 40px;       /* TZ §2.2: generous edge air + bottom scroll room */
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen > * {
  opacity: 0;
  transform: translateY(11px);
  animation: rise .5s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 48ms);
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* ── Type ───────────────────────────────────────────────── */
.display { font-family: var(--ff-display); font-weight: 800; letter-spacing: -0.02em; line-height: 1.02; }
.eyebrow { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent-2); }
.h1 { font-family: var(--ff-display); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; line-height: 1.06; }
.h2 { font-family: var(--ff-display); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; line-height: 1.15; }
.lede { font-size: 14.5px; line-height: 1.55; color: var(--ink-dim); }
.cap { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.02em; }
.mono { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; }
.grad-text { color: var(--accent); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 16px 20px; border-radius: var(--r-md);            /* TZ §7.1: ~52px height, r16 */
  font-weight: 700; font-size: 15.5px; line-height: 1;
  width: 100%;
  transition: transform var(--dur-1) var(--ease-out-quart), box-shadow var(--dur-2), background var(--dur-2), opacity var(--dur-2);
  user-select: none;
}
.btn svg { width: 19px; height: 19px; }
.btn:active { transform: scale(0.97); }                       /* TZ §7.4: pressed 0.97, ~110ms ease-out */
.btn--primary {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent-2) 40%, var(--accent) 100%);
  color: var(--on-accent);
  box-shadow: 0 10px 26px -10px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.45) inset, 0 -2px 6px rgba(0,0,0,0.18) inset;
}
.btn--primary:hover { box-shadow: 0 14px 34px -10px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.5) inset, 0 -2px 6px rgba(0,0,0,0.18) inset; }
.btn--primary:active { box-shadow: 0 6px 16px -8px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.35) inset; }
.btn--ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn--ghost:hover { background: var(--surface-3); }
.btn--link { background: transparent; color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--amber-a35); }
.btn--link:hover { background: var(--amber-a08); }
.btn--soft { background: linear-gradient(135deg, var(--amber-a18), var(--amber-a12)); color: var(--accent-2); border: 1px solid var(--amber-a25); }
.btn--danger { background: rgba(255,98,89,0.12); color: var(--bad); border: 1px solid rgba(255,98,89,0.28); }
.btn--block + .btn--block { margin-top: 9px; }
.btn[disabled], .btn.is-disabled { opacity: 0.45; pointer-events: none; }   /* TZ §7.5: readable, not "broken" */
.btn__sub { font-size: 12px; font-weight: 600; opacity: 0.72; font-family: var(--ff-mono); }
.btn--lg { padding: 17px 20px; font-size: 16px; border-radius: var(--r-lg); }
.btn--sm { padding: 10px 14px; font-size: 13px; width: auto; border-radius: var(--r-sm); }

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.card--solid { background: var(--surface-solid); }
/* TZ §5.2 raised card — surface/2 + soft drop shadow, for featured/hero surfaces */
.card--raised { background: var(--surface-2); border-color: var(--line-strong); box-shadow: var(--shadow-raised); }

/* ── Chips / segment ────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--ink-dim);
}
.chip--accent { color: var(--accent-2); border-color: var(--amber-a35); background: var(--amber-a12); }
.chip--violet { color: var(--accent-2); border-color: var(--amber-a35); background: var(--amber-a12); }
.chip--magenta { color: var(--accent-soft); border-color: var(--amber-a35); background: var(--amber-a12); }
.chip--muted { color: var(--ink-faint); }

/* ── Toggle switch ──────────────────────────────────────── */
.switch { position: relative; width: 46px; height: 28px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch__track { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--line); transition: background .25s var(--ease); }
.switch__thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink-dim); transition: transform .28s var(--ease-out), background .25s; }
.switch input:checked ~ .switch__track { background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; }
.switch input:checked ~ .switch__thumb { transform: translateX(18px); background: var(--on-accent); }

/* ── Setting row (constructor + options) ────────────────── */
.row {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 15px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  transition: background .2s, transform .12s, border-color .2s;
}
.row:active { transform: scale(0.99); }
.row--btn { cursor: pointer; width: 100%; text-align: left; }
.row--btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.row__ico { width: 38px; height: 38px; flex: 0 0 auto; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 18px; background: var(--surface-3); color: var(--accent-2); }
.row__ico svg { width: 20px; height: 20px; }
.row__ico svg { width: 19px; height: 19px; }
.row__main { flex: 1 1 auto; min-width: 0; }
.row__label { font-size: 14px; font-weight: 600; color: var(--ink); }
.row__hint { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.row__val { font-family: var(--ff-mono); font-size: 13px; font-weight: 600; color: var(--ink-dim); white-space: nowrap; }
.row__chev { color: var(--ink-faint); flex: 0 0 auto; }
.row__chev svg { width: 18px; height: 18px; }
.row__val.is-accent { color: var(--accent-2); }
/* small sub-hint rendered as a sibling of a setting row (e.g. vocal toggle) */
.row-note { font-size: 11.5px; color: var(--ink-faint); line-height: 1.4; padding: 0 4px; }

/* ── Textarea / field ───────────────────────────────────── */
.field { position: relative; }
.field__ta {
  width: 100%; resize: none; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  padding: 16px; font-size: 15px; line-height: 1.45; color: var(--ink);
  transition: border-color .2s, background .2s; min-height: 96px;
}
.field__ta::placeholder { color: var(--ink-faint); }
.field__ta:focus { outline: none; border-color: var(--amber-a50); background: var(--surface-2); box-shadow: 0 0 0 4px var(--amber-a12); }
.field__ta--lg { min-height: 140px; font-size: 16px; }
.field__bar { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 0 4px; }
.field__count { font-family: var(--ff-mono); font-size: 11px; color: var(--ink-faint); }
.field__tools { display: flex; gap: 6px; }
.toolbtn {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 11px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; color: var(--ink-dim);
  background: var(--surface-2); border: 1px solid var(--line); transition: all .18s;
}
.toolbtn svg { width: 14px; height: 14px; }
.toolbtn:active { transform: scale(0.95); }
.toolbtn:disabled { opacity: 0.4; pointer-events: none; }
.toolbtn--accent { color: var(--accent-2); border-color: var(--amber-a35); }

/* ── Lyrics: structural-tag chips ───────────────────────── */
.lyr-tags {
  display: flex; gap: 6px; margin-bottom: 10px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.lyr-tags::-webkit-scrollbar { display: none; }
.lyr-tag {
  flex: 0 0 auto; min-height: 36px; padding: 8px 12px; border-radius: var(--r-pill);
  white-space: nowrap; font-size: 12.5px; font-weight: 600; color: var(--accent-2);
  background: var(--amber-a12); border: 1px solid var(--amber-a35);
  transition: background .18s, transform .12s, border-color .18s;
}
.lyr-tag:active { transform: scale(0.94); }
.lyr-tag:hover { background: var(--amber-a18); border-color: var(--amber-a50); }

/* ── Segmented control (formats / presets) ──────────────── */
.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.seg {
  flex: 1 1 0; min-width: 0; padding: 11px 6px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line);
  font-weight: 600; font-size: 13px; color: var(--ink-dim);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: all .2s var(--ease); text-align: center;
}
.seg:active { transform: scale(0.96); }
.seg.is-active {
  background: linear-gradient(135deg, var(--amber-a25), var(--amber-a12));
  border-color: var(--amber-a50); color: var(--ink);
  box-shadow: 0 6px 18px -10px var(--accent-glow);
}
.seg__px { font-family: var(--ff-mono); font-size: 10px; color: var(--ink-faint); }
.seg.is-active .seg__px { color: var(--accent-soft); }

/* ratio visual box */
.ratio-box {
  width: 26px; height: 26px; position: relative; border-radius: var(--r-xs);
  border: 1.5px solid currentColor; opacity: 0.8;
}
.ratio-box::after { content: ""; position: absolute; inset: 0; border-radius: 4px; background: currentColor; opacity: 0.18; }

/* ── Section spacing ────────────────────────────────────── */
.section { margin-top: 28px; }
.section:first-child { margin-top: 4px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; padding: 0 2px; }
.section__label { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); }

/* ════════════════════ MENU ════════════════════ */
.menu-hero { padding: 6px 4px 4px; }
.menu-hero__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.mark {
  width: 40px; height: 40px; border-radius: var(--r-sm); flex: 0 0 auto;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  display: grid; place-items: center; color: var(--on-accent);
  box-shadow: 0 8px 22px -8px var(--accent-glow);
  font-family: var(--ff-display); font-weight: 800; font-size: 20px;
}
.menu-hero__title { font-family: var(--ff-display); font-weight: 800; font-size: 24px; letter-spacing: -0.025em; line-height: 1; }
.menu-hero__sub { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }

.catgrid { display: grid; gap: 12px; }
.cat {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  padding: 18px; border-radius: var(--r-xl); cursor: pointer;
  border: 1px solid var(--line); text-align: left; width: 100%;
  transition: transform .18s var(--ease), box-shadow .25s;
}
.cat:active { transform: scale(0.985); }
.cat__art { position: absolute; inset: 0; z-index: 0; opacity: 0.9; }
.cat__art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, rgba(8,14,28,0.45) 0%, rgba(8,14,28,0.15) 55%, transparent 100%); }
.cat__body { position: relative; z-index: 1; }
.cat__emoji { font-size: 30px; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4)); }
.cat__title { font-family: var(--ff-display); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.cat__desc { font-size: 12.5px; color: var(--ink-ghost); margin-top: 3px; }
.cat__arrow { position: relative; z-index: 1; margin-left: auto; color: var(--ink); opacity: 0.7; }
.cat__arrow svg { width: 22px; height: 22px; }
.cat--image { background: linear-gradient(120deg, #16161A, #0E0E12); }
.cat--image .cat__art { background: radial-gradient(120% 140% at 85% 20%, var(--amber-a50), transparent 60%); }
.cat--video { background: linear-gradient(120deg, #16161A, #0E0E12); }
.cat--video .cat__art { background: radial-gradient(120% 140% at 85% 20%, var(--amber-a50), transparent 60%); }
.cat--music { background: linear-gradient(120deg, #16161A, #0E0E12); }
.cat--music .cat__art { background: radial-gradient(120% 140% at 85% 20%, var(--amber-a50), transparent 60%); }

.tilegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 9px;
  padding: 16px; border-radius: var(--r-lg); cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .16s var(--ease), background .2s;
}
.tile:active { transform: scale(0.97); }
.tile:hover { background: var(--surface-2); }
.tile__ico { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 17px; background: var(--surface-3); }
.tile__title { font-weight: 700; font-size: 14px; }
.tile__sub { font-size: 11.5px; color: var(--ink-faint); }

/* ════════════════════ CONSTRUCTOR ════════════════════ */
.ctor-promptwrap { position: relative; }
.ctor-costbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(216,222,232,0.10), var(--amber-a05));
  border: 1px solid rgba(216,222,232,0.22);
}
.ctor-costbar__l { display: flex; flex-direction: column; gap: 2px; }
.ctor-costbar__cap { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.02em; }
.ctor-costbar__big { font-family: var(--ff-display); font-weight: 700; font-size: 19px; color: var(--ink); }
.ctor-costbar__big .mono { color: var(--gold); }
.ctor-costbar__r { text-align: right; }
.ctor-costbar__bal { font-family: var(--ff-mono); font-size: 12px; color: var(--ink-dim); }
.ctor-costbar__bal b { color: var(--ink); }
.ctor-costbar.is-low { border-color: rgba(255,98,89,0.4); background: linear-gradient(135deg, rgba(255,98,89,0.12), rgba(255,98,89,0.04)); }

.refsmini { display: flex; flex-wrap: wrap; gap: 7px; }
.refsmini__pill { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-dim); }

/* ════════════════════ MODEL PICK / CARDS ════════════════════ */
.modelcard {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 15px; border-radius: var(--r-lg); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .16s var(--ease), border-color .2s, background .2s; position: relative;
}
.modelcard:active { transform: scale(0.985); }
.modelcard:hover { border-color: var(--line-strong); background: var(--surface-2); }
.modelcard.is-active { border-color: var(--amber-a50); background: linear-gradient(135deg, var(--amber-a12), var(--amber-a03)); box-shadow: 0 8px 24px -14px var(--accent-glow); }
.modelcard__ico { width: 44px; height: 44px; flex: 0 0 auto; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 21px; background: var(--surface-3); }
.modelcard__main { flex: 1 1 auto; min-width: 0; }
.modelcard__name { display: flex; align-items: center; gap: 7px; font-family: var(--ff-display); font-weight: 600; font-size: 15.5px; }
.modelcard__desc { font-size: 12px; color: var(--ink-faint); margin-top: 3px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.modelcard__price { font-family: var(--ff-mono); font-weight: 600; font-size: 13px; color: var(--accent-2); white-space: nowrap; }
.modelcard__price small { color: var(--ink-faint); font-weight: 500; }
.star { color: var(--gold); font-size: 13px; }

/* ════════════════════ CABINET ════════════════════ */
.balhero {
  position: relative; overflow: hidden;
  padding: 24px 20px; border-radius: var(--r-xl);
  background: linear-gradient(135deg, #16161A 0%, #0E0E12 100%);
  border: 1px solid rgba(216,222,232,0.22);
}
.balhero__glow { position: absolute; width: 220px; height: 220px; right: -70px; top: -90px; background: radial-gradient(circle, var(--accent) 0%, transparent 65%); opacity: 0.4; filter: blur(20px); }
.balhero__cap { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); position: relative; }
.balhero__num { font-family: var(--ff-display); font-weight: 800; font-size: 48px; line-height: 1; margin-top: 8px; position: relative; letter-spacing: -0.02em; }
.balhero__num .unit { font-size: 16px; color: var(--ink-dim); font-weight: 600; margin-left: 6px; }
.balhero__rub { font-family: var(--ff-mono); font-size: 13px; color: var(--ink-faint); margin-top: 10px; position: relative; }
.statrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { padding: 15px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.stat__cap { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.02em; }
.stat__val { font-family: var(--ff-display); font-weight: 700; font-size: 22px; margin-top: 4px; }
.stat__sub { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }

/* ── PWA install CTA (cabinet) ── */
.pwa-card { padding: 0; }
.pwa-cta { position: relative; display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 16px 18px; border-radius: var(--r-lg); font-family: var(--ff-display); font-weight: 700; font-size: 15.5px; color: var(--on-accent); background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent) 100%); border: 1px solid rgba(216,222,232,0.6); box-shadow: 0 10px 26px -14px var(--accent-glow); cursor: pointer; transition: transform .12s; animation: pwaPulse 2.1s ease-in-out infinite; }
.pwa-cta:active { transform: scale(0.985); }
.pwa-cta__ico { font-size: 18px; }
.pwa-card__hint { font-size: 11.5px; color: var(--ink-faint); margin-top: 8px; text-align: center; }
@keyframes pwaPulse { 0%, 100% { box-shadow: 0 10px 26px -14px var(--accent-glow), 0 0 0 0 rgba(216,222,232,0); } 50% { box-shadow: 0 10px 26px -10px var(--accent-glow), 0 0 0 6px rgba(216,222,232,0.16); } }
@media (prefers-reduced-motion: reduce) { .pwa-cta { animation: none; } }

/* ════════════════════ HISTORY (gallery grid) ════════════════════ */
.gengrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .gengrid { grid-template-columns: repeat(3, 1fr); gap: 10px; } }
.gencard {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--r-lg);
  overflow: hidden; background: var(--surface-solid); border: 1px solid var(--line);
  transition: transform .18s var(--ease), border-color .22s, box-shadow .3s;
}
.gencard.is-clickable { cursor: pointer; }
.gencard.is-clickable:hover {
  border-color: rgba(245, 180, 0, 0.5);
  box-shadow: 0 18px 44px -22px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(245, 180, 0, 0.18);
}
.gencard.is-clickable:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); }
.gencard.is-clickable:active { transform: scale(0.968); }
.gencard__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; background: var(--surface-solid-2);
  transition: transform .5s var(--ease-out), filter .3s;
}
.gencard.is-clickable:hover .gencard__img { transform: scale(1.055); filter: brightness(1.05); }
.gencard__shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 7, 12, 0) 34%, rgba(5, 7, 12, 0.5) 62%, rgba(5, 7, 12, 0.94) 100%);
}
.gencard__info { position: absolute; left: 0; right: 0; bottom: 0; padding: 11px 12px 12px; pointer-events: none; }
.gencard__prompt {
  font-size: 12px; font-weight: 600; line-height: 1.32; color: var(--ink);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.65);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gencard__meta { margin-top: 4px; display: flex; align-items: center; gap: 6px; font-size: 10.5px; letter-spacing: 0.01em; color: rgba(216, 222, 232, 0.72); }
.gencard__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: rgba(216, 222, 232, 0.45); flex: 0 0 auto; }
.gencard__price { font-family: var(--ff-mono); font-weight: 600; font-size: 10px; color: rgba(216, 222, 232, 0.85); white-space: nowrap; }
/* quiet type glyph, top-left — a mixed grid reads at a glance */
.gencard__type {
  position: absolute; top: 9px; left: 9px; z-index: 2;
  width: 27px; height: 27px; border-radius: 9px;
  display: grid; place-items: center; color: rgba(242, 244, 248, 0.92);
  background: rgba(8, 9, 12, 0.42); border: 1px solid rgba(216, 222, 232, 0.16);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.gencard__type svg { width: 14px; height: 14px; }
.gencard__pill { position: absolute; top: 9px; left: 9px; z-index: 2; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
/* top-right frosted action cluster: «оживить» (amber) + download */
.gencard__acts { position: absolute; top: 9px; right: 9px; z-index: 3; display: flex; gap: 6px; }
.gencard__act {
  width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center; color: var(--ink);
  background: rgba(8, 9, 12, 0.42); border: 1px solid rgba(216, 222, 232, 0.16);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .18s, border-color .18s, transform .12s, box-shadow .2s;
}
.gencard__act:hover { background: rgba(8, 9, 12, 0.72); border-color: var(--line-strong); }
.gencard__act:active { transform: scale(0.88); }
.gencard__act svg { width: 15px; height: 15px; }
.gencard__act--anim { color: var(--accent-2); border-color: rgba(245, 180, 0, 0.5); }
.gencard__act--anim:hover {
  background: rgba(245, 180, 0, 0.16); border-color: rgba(245, 180, 0, 0.65);
  box-shadow: 0 6px 18px -8px var(--accent-glow);
}
.gencard__play {
  position: absolute; inset: 0; z-index: 2; margin: auto; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink); pointer-events: none;
  background: rgba(10, 10, 12, 0.55); border: 1px solid rgba(216, 222, 232, 0.28);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px -10px rgba(0, 0, 0, 0.8);
}
.gencard__play svg { width: 17px; height: 17px; margin-left: 2px; }
.gencard__ph {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-dim);
  background: linear-gradient(160deg, var(--surface-solid-2), var(--surface-solid) 70%);
}
.gencard__ph svg { width: 26px; height: 26px; opacity: 0.5; }
.gencard__ph--wait svg { animation: gencardPulse 1.7s ease-in-out infinite; }
@keyframes gencardPulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.22; } }
.gencard__audio {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent-2);
  background: radial-gradient(120% 120% at 30% 18%, var(--amber-a08), transparent 60%),
              linear-gradient(160deg, var(--surface-solid-2), var(--surface-solid) 70%);
}
.gencard__audio svg { width: 30px; height: 30px; opacity: 0.9; }
.status-pill { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-pill); text-transform: uppercase; letter-spacing: 0.04em; }
.status--done { color: var(--good); background: rgba(94, 224, 138, 0.12); }
.status--failed { color: var(--bad); background: rgba(255, 98, 89, 0.12); }
.status--processing, .status--pending { color: var(--gold); background: rgba(216, 222, 232, 0.12); }
.empty { text-align: center; padding: 56px 24px; color: var(--ink-faint); }
.empty__ico { display: inline-grid; place-items: center; color: var(--ink-faint); opacity: 0.55; margin-bottom: 14px; }
.empty__ico svg { width: 44px; height: 44px; }

/* infinite-scroll sentinel + spinner at the bottom of the history grid */
.history-sentinel { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 16px 8px; color: var(--ink-faint); font-size: 12px; }
.history-sentinel[hidden] { display: none; }
.history-loader { border-color: rgba(216, 222, 232, 0.22); border-top-color: var(--accent-2); }

/* ════════════════════ TOPUP / TARIFFS ════════════════════ */
.tariff { position: relative; padding: 18px; border-radius: var(--r-lg); cursor: pointer; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); transition: transform .16s var(--ease), border-color .2s, background .2s; }
.tariff:active { transform: scale(0.985); }
.tariff:hover { border-color: var(--line-strong); }
.tariff--feat { border-color: var(--amber-a50); background: linear-gradient(135deg, var(--amber-a12), var(--amber-a03)); box-shadow: 0 10px 30px -16px var(--accent-glow); }
.tariff__ribbon { position: absolute; top: 14px; right: 14px; font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-2); }
.tariff__name { font-family: var(--ff-display); font-weight: 700; font-size: 19px; }
.tariff__tokens { font-family: var(--ff-display); font-weight: 800; font-size: 30px; margin-top: 6px; letter-spacing: -0.01em; }
.tariff__tokens .unit { font-size: 13px; color: var(--ink-dim); font-weight: 600; }
.tariff__desc { font-size: 12.5px; color: var(--ink-faint); margin-top: 6px; line-height: 1.4; }
.tariff__est { font-size: 12px; color: var(--ink-dim); margin-top: 7px; font-weight: 500; }
.tariff__price { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px dashed var(--line); }
.tariff__rub { font-family: var(--ff-mono); font-weight: 700; font-size: 20px; }
.tariff__per { font-size: 11.5px; color: var(--ink-faint); }

/* ── Paywall: hero + global term selector + tier cards ── */
.pw-hero { padding: 6px 2px 2px; }
.pw-hero__eyebrow { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent-2); }
.pw-hero__title { font-family: var(--ff-display); font-weight: 800; font-size: 30px; letter-spacing: -0.025em; line-height: 1.04; margin-top: 9px; text-wrap: balance; }
.pw-hero__lede { font-size: 14px; line-height: 1.5; color: var(--ink-dim); margin-top: 10px; max-width: 38ch; text-wrap: pretty; }

/* Global term selector — one segmented control drives every card */
.pw-terms {
  display: flex; gap: 6px; margin-top: 20px; padding: 5px;
  border-radius: var(--r-pill); background: var(--bg-soft);
  border: 1px solid var(--line);
}
.pw-term {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 13.5px; color: var(--ink-dim);
  transition: color .2s var(--ease), background .2s var(--ease), transform .14s;
}
.pw-term:active { transform: scale(0.96); }
.pw-term__save { font-family: var(--ff-mono); font-size: 10px; font-weight: 700; color: var(--good); letter-spacing: 0.02em; }
.pw-term.is-active {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent-2) 45%, var(--accent) 100%);
  box-shadow: 0 6px 18px -8px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.4) inset;
}
.pw-term.is-active .pw-term__save { color: var(--on-accent); opacity: 0.8; }

/* Horizontal carousel of tariff cards (left → right): trial + tiers.
   overflow-x:auto forces overflow-y to auto too (CSS spec), which would clip
   the ribbons that straddle each card's top — so the top padding reserves room
   for them (≈ half-ribbon height + clearance). */
.pw-rail {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 20px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin: 24px -20px 4px; padding: 28px 20px 14px;
}
.pw-rail::-webkit-scrollbar { display: none; }
.pw-rail > .pw-card { flex: 0 0 64%; scroll-snap-align: start; min-width: 0; }

/* Carousel pagination dots + term-selector label */
.pw-dots { display: flex; justify-content: center; gap: 6px; margin: 14px 0 0; }
.pw-dot { width: 7px; height: 7px; padding: 0; border-radius: 50%; background: var(--line-strong); transition: width .28s var(--ease), background .25s; }
.pw-dot.is-active { width: 20px; border-radius: var(--r-pill); background: var(--accent-2); }
.pw-terms-label { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 8px 2px; }
.pw-card {
  position: relative; padding: 20px; border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(216,222,232,0.06), rgba(216,222,232,0.025));
  border: 1px solid var(--line-strong); cursor: pointer;
  transition: transform .18s var(--ease-out), border-color .2s, box-shadow .2s, background .2s;
}
.pw-card:active { transform: scale(0.985); }
.pw-card:hover { border-color: rgba(216,222,232,0.34); }
.pw-card--feat {
  border-color: var(--amber-a50);
  background: linear-gradient(160deg, var(--amber-a18) 0%, var(--amber-a05) 48%, rgba(216,222,232,0.05) 100%);
  box-shadow: 0 22px 54px -20px var(--accent-glow), 0 1px 0 var(--amber-a25) inset;
  padding-top: 30px;
}

.pw-ribbon {
  position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--on-accent); font-family: var(--ff-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
  padding: 7px 15px; border-radius: var(--r-pill); box-shadow: 0 8px 20px -6px var(--accent-glow);
}
.pw-ribbon--ghost { background: var(--surface-solid-2); color: var(--gold); border: 1px solid var(--line-strong); box-shadow: none; }

.pw-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pw-card__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pw-card__name { font-family: var(--ff-display); font-weight: 800; font-size: 22px; letter-spacing: -0.01em; line-height: 1.05; }
.pw-card__tag { font-size: 12px; font-weight: 500; color: var(--ink-faint-card); line-height: 1.2; }
.pw-card--feat .pw-card__tag { color: var(--accent-soft); }

.pw-card__tokens { font-family: var(--ff-display); font-weight: 700; font-size: 18px; color: var(--ink-dim); margin-top: 8px; line-height: 1.15; }
.pw-card__tokens .unit { font-size: 12px; color: var(--ink-faint-card); font-weight: 600; margin-left: 6px; }

.pw-card__ests { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.pw-est {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: 12px; color: var(--ink-dim); font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 5px 11px;
}
.pw-card--feat .pw-est { color: var(--accent-soft); border-color: var(--amber-a35); background: var(--amber-a08); }

/* Feature checklist */
.pw-feats { list-style: none; display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.pw-feat { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-dim); line-height: 1.3; }
.pw-feat > svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--accent-2); margin-top: 1px; }
.pw-card--feat .pw-feat { color: var(--ink); }
.pw-card--feat .pw-feat > svg { color: var(--accent); }

/* Price + CTA — big accent monthly price is THE number; smaller term total below */
.pw-card__price { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.pw-card__mo { display: flex; align-items: baseline; gap: 3px; }
.pw-card__rub { font-family: var(--ff-mono); font-weight: 800; font-size: 36px; letter-spacing: -0.02em; color: var(--accent-2); line-height: 1; }
.pw-card__cur { font-size: 14px; font-weight: 700; color: var(--ink-dim); }
.pw-card__term { margin-top: 7px; display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; font-size: 12.5px; }
.pw-card__term[hidden] { display: none; }
.pw-card__old { font-family: var(--ff-mono); color: var(--ink-dim); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.pw-card__old[hidden] { display: none; }
.pw-card__sum { font-family: var(--ff-mono); font-weight: 600; color: var(--ink-dim); }

.pw-card__cta {
  margin-top: 13px; padding: 14px; text-align: center; border-radius: var(--r-md);
  font-family: var(--ff-display); font-weight: 700; font-size: 15px;
  background: var(--surface-solid-2); border: 1px solid var(--line-strong); color: var(--ink);
  transition: transform .14s var(--ease), background .2s;
}
.pw-card:active .pw-card__cta { transform: scale(0.985); }
.pw-card__cta--feat {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent-2) 45%, var(--accent) 100%);
  color: var(--on-accent); border-color: transparent;
  box-shadow: 0 12px 28px -10px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.4) inset;
}

/* Trust bar */
.pw-trust {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 6px; row-gap: 4px;
  margin-top: 22px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--ff-mono); font-size: 11px; color: var(--ink-dim); letter-spacing: 0.02em; text-align: center;
}
.pw-trust__sep { color: var(--ink-ghost); }

/* pricing table */
.pricegroup { margin-bottom: 6px; }
.pricegroup__head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.pricegroup__title { font-family: var(--ff-display); font-weight: 600; font-size: 14px; }
.pricegroup__hint { font-family: var(--ff-mono); font-size: 11px; color: var(--ink-faint); }
.priceline { display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.priceline + .priceline { margin-top: 6px; }
.priceline__name { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.priceline__tok { font-family: var(--ff-mono); font-weight: 600; font-size: 12.5px; color: var(--accent-2); }

/* ════════════════════ GENERATING — signature scene (TZ §11) ════════════════════ */
.genstage { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 62vh; text-align: center; padding: 12px 0 4px; }
.genstage__eta { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent-2); display: inline-flex; align-items: center; gap: 9px; }
.genstage__eta::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); animation: genpulse 1.4s ease-in-out infinite; }

/* ghost card = placeholder of the future result */
.ghost { position: relative; width: min(74%, 232px); aspect-ratio: var(--ar, 1/1); margin-top: 30px; }
.ghost__skel { position: absolute; inset: 0; border-radius: var(--r-lg); overflow: hidden; background: linear-gradient(155deg, var(--surface-solid-2), var(--surface-solid) 70%); border: 1px solid var(--line-strong); box-shadow: var(--shadow-raised); }
.ghost__skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 22%, rgba(255,255,255,0.08) 42%, rgba(255,210,100,0.16) 50%, rgba(255,255,255,0.08) 58%, transparent 78%); transform: translateX(-100%); animation: genshimmer 1.9s var(--ease) infinite; }
.ghost__mark { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent-2); opacity: 0.9; animation: genbreathe 2.6s ease-in-out infinite; }
.ghost__mark svg { width: 44px; height: 44px; }
/* animated amber ring around the ghost — "soft animated border" */
.ghost__ring { position: absolute; inset: -10px; border-radius: calc(var(--r-lg) + 10px); padding: 2px; background: conic-gradient(from 0deg, var(--accent) 0deg, var(--accent-soft) 45deg, transparent 140deg, transparent 225deg, rgba(216,222,232,0.55) 300deg, transparent 360deg); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: genspin 3s linear infinite; filter: drop-shadow(0 0 10px var(--accent-glow)); }
@keyframes genshimmer { 100% { transform: translateX(100%); } }
@keyframes genspin { to { transform: rotate(360deg); } }
@keyframes genbreathe { 50% { transform: scale(1.07); opacity: 0.6; } }
@keyframes genpulse { 50% { opacity: 0.3; transform: scale(0.75); } }

.genstage__title { font-family: var(--ff-display); font-weight: 700; font-size: 19px; margin-top: 28px; }
.genstage__sub { font-size: 13px; color: var(--ink-faint); margin-top: 6px; max-width: 32ch; line-height: 1.45; }

/* trajectory → gallery destination: the result is "moving" to your gallery */
.genrail { display: flex; align-items: center; gap: 10px; margin-top: 30px; font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.genrail__line { position: relative; width: 68px; height: 2px; border-radius: var(--r-pill); background: var(--line-strong); overflow: hidden; }
.genrail__dot { position: absolute; top: 50%; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); transform: translateY(-50%); animation: gentravel 1.7s var(--ease) infinite; }
.genrail__dest { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-dim); }
.genrail__dest svg { width: 14px; height: 14px; color: var(--accent-2); }
@keyframes gentravel { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

/* shared spinner keyframe — kept for .loader */
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════ RESULT ════════════════════ */
.result { }
.result__art { position: relative; width: 100%; max-width: 340px; aspect-ratio: var(--ar, 1/1); max-height: 56vh; margin-inline: auto; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line-strong); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-raised); animation: resultIn var(--dur-3) var(--ease-out-quart) both; }
@keyframes resultIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: none; } }
.result__art .rs-bg { position: absolute; inset: 0; }
.result__art .rs-emoji { position: relative; color: var(--ink); filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5)); }
.result__art .rs-emoji svg { width: 56px; height: 56px; }
.result__art .rs-type { position: absolute; top: 12px; left: 12px; }
.result__art .rs-prompt { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 14px 13px; font-size: 12px; color: var(--ink); background: linear-gradient(0deg, rgba(6,10,22,0.85), transparent); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.result__done { display: flex; align-items: center; gap: 9px; margin-top: 16px; padding: 13px 15px; border-radius: var(--r-md); background: rgba(94,224,138,0.10); border: 1px solid rgba(94,224,138,0.25); }
.result__done__ico { color: var(--good); display: inline-grid; place-items: center; }
.result__done__ico svg { width: 18px; height: 18px; }
.result__done__t { font-size: 13.5px; }
.result__done__t b { color: var(--good); }

/* real media from producer_st */
.rs-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0A0A0B; }
.rs-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(7,19,37,0.55); color: #fff; font-size: 17px; padding-left: 3px; pointer-events: none; border: 1px solid rgba(255,255,255,0.25); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.rs-audio { width: 100%; margin-top: 14px; }
.rs-dl { display: inline-block; margin-top: 14px; color: var(--accent-2); font-weight: 700; font-size: 13px; text-decoration: none; padding: 9px 16px; border-radius: var(--r-pill); border: 1px solid var(--amber-a35); background: var(--amber-a08); }
.rs-dl:hover { background: var(--amber-a12); }
.rs-dl[hidden] { display: none; }
/* download / share action row on the result screen */
.rs-actions { display: flex; gap: 9px; margin-top: 16px; }
.rs-actions .btn { flex: 1; }

/* ════════════════════ INFO / LEGAL ════════════════════ */
.infostub { padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.infostub__ico { font-size: 30px; margin-bottom: 12px; }
.linkcard { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 15px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); transition: background .2s, transform .14s; }
.linkcard:hover { background: var(--surface-2); }
.linkcard:active { transform: scale(0.99); }
.linkcard__ico { width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 18px; background: var(--surface-3); }
.linkcard__main { flex: 1; min-width: 0; }
.linkcard__t { font-weight: 700; font-size: 14px; }
.linkcard__s { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkcard__ext { color: var(--ink-faint); }
.linkcard__ext svg { width: 16px; height: 16px; }

/* ════════════════════ REF UPLOAD ════════════════════ */
.refdrop {
  display: block;
  border: 1.5px dashed var(--amber-a50); border-radius: var(--r-lg);
  padding: 32px 16px; text-align: center; cursor: pointer;
  background: linear-gradient(135deg, var(--amber-a12), var(--amber-a05));
  box-shadow: 0 8px 24px -16px var(--accent-glow);
  transition: border-color .2s, background .2s, transform .12s;
}
.refdrop:hover { border-color: var(--amber-a50); background: linear-gradient(135deg, var(--amber-a18), var(--amber-a05)); }
.refdrop:active { transform: scale(0.99); }
/* The native file inputs must never render (a stray dark block was covering
   the dropzone). Force-hide them regardless of the `hidden` attribute. */
.file-in, #refInput { display: none !important; }
.refdrop__ico { font-size: 36px; margin-bottom: 10px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3)); }
.refdrop__t { font-weight: 700; font-size: 15px; color: var(--ink); }
.refdrop__s { font-size: 12px; color: var(--ink-dim); margin-top: 5px; }
.refthm { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.refthm__t { aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; position: relative; background: var(--surface-3); }
.refthm__t img { width: 100%; height: 100%; object-fit: cover; }
.refthm__del { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; display: grid; place-items: center; font-size: 13px; line-height: 1; }
.reftab { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px 2px; }
.reftab::-webkit-scrollbar { display: none; }
.reftab__t { flex: 0 0 auto; padding: 9px 14px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; color: var(--ink-dim); background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.reftab__t.is-active { color: var(--accent-2); border-color: var(--amber-a50); background: var(--amber-a12); }
.reftab__count { font-family: var(--ff-mono); font-size: 11px; opacity: 0.7; margin-left: 4px; }

/* ════════════════════ AUTH / LOGIN ════════════════════ */
.mark--xl { width: 64px; height: 64px; border-radius: var(--r-lg); font-size: 32px; margin: 0 auto; box-shadow: 0 14px 36px -12px var(--accent-glow); }
.login-code {
  display: inline-block; margin-top: 18px; padding: 14px 24px 14px 30px; border-radius: var(--r-md);
  font-family: var(--ff-mono); font-weight: 700; font-size: 32px; letter-spacing: 0.34em;
  color: var(--gold); background: linear-gradient(135deg, rgba(216,222,232,0.12), var(--amber-a05));
  border: 1px solid rgba(216,222,232,0.3);
}
.cmdline { display: flex; align-items: center; gap: 10px; }
.cmdline__code { flex: 1 1 auto; min-width: 0; font-family: var(--ff-mono); font-size: 13.5px; font-weight: 600; color: var(--ink); background: var(--surface-3); padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.cmdline__code::-webkit-scrollbar { display: none; }

/* ════════════════════ DURATION SLIDER ════════════════════ */
.row--slider { margin-bottom: 2px; }
.slider-wrap { padding: 14px 4px 2px; }
.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) var(--p, 50%), var(--surface-3) var(--p, 50%), var(--surface-3) 100%);
  outline: none; cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); border: 2px solid var(--on-accent);
  box-shadow: 0 4px 12px -4px var(--accent-glow); cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--on-accent);
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); cursor: pointer;
}
.slider-edges { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; font-family: var(--ff-mono); font-size: 10.5px; color: var(--ink-faint); }
.slider-edges__cur { color: var(--accent-2); font-size: 12.5px; font-weight: 700; }

/* ════════════════════ DOCK ════════════════════ */
.dock {
  flex: 0 0 auto; padding: 12px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, rgba(7,12,22,0.85) 30%);
  position: relative; z-index: 12;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.dock[hidden] { display: none; }
/* when the tab nav is also present (generation screen) it carries the safe-area */
.has-tabnav .dock { padding-bottom: 12px; }
.dock__row { display: flex; gap: 9px; }
.dock__row .btn { flex: 1; }
.dock__hint { text-align: center; font-size: 11px; color: var(--ink-faint); margin-top: 8px; }

/* home indicator (removed — the tab bar / dock carry the bottom safe-area) */

/* ════════════════════ SHEET ════════════════════ */
.sheet-veil { position: fixed; inset: 0; z-index: 80; background: rgba(5,8,16,0.6); backdrop-filter: blur(3px); opacity: 0; transition: opacity .28s; }
.sheet-veil[hidden] { display: none; }
.sheet-veil.is-shown { opacity: 1; }
.sheet {
  position: fixed; z-index: 81; left: 50%; bottom: 0; transform: translate(-50%, 100%);
  width: min(100vw, 420px);
  max-height: 82dvh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #16161A, #0E0E12);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 1px solid var(--line-strong); border-bottom: none;
  box-shadow: 0 -20px 60px -10px rgba(0,0,0,0.7);
  transition: transform .36s var(--ease-out); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet[hidden] { display: flex; }
.sheet.is-shown { transform: translate(-50%, 0); }
.sheet__grip { width: 40px; height: 4px; border-radius: var(--r-pill); background: var(--line-strong); margin: 10px auto 4px; flex: 0 0 auto; }
.sheet__head { padding: 8px 20px 12px; flex: 0 0 auto; border-bottom: 1px solid var(--line); }
.sheet__head .h2 { font-size: 17px; }
.sheet__head .cap { margin-top: 3px; }
.sheet__body { padding: 16px 20px 24px; overflow-y: auto; scrollbar-width: none; }
.sheet__body::-webkit-scrollbar { display: none; }
.sheet__close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-dim); }
.sheet__close svg { width: 16px; height: 16px; }

.sheet__list { display: flex; flex-direction: column; gap: 8px; }
.sheetopt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 15px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  transition: background .18s, transform .14s, border-color .18s;
}
.sheetopt:hover { background: var(--surface-2); }
.sheetopt:active { transform: scale(0.98); }
.sheetopt.is-active { border-color: var(--amber-a50); background: linear-gradient(135deg, var(--amber-a12), var(--amber-a03)); }
.sheetopt__main { flex: 1; min-width: 0; }
.sheetopt__t { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.sheetopt__s { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.sheetopt__check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: 0 0 auto; display: grid; place-items: center; }
.sheetopt.is-active .sheetopt__check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sheetopt__check svg { width: 13px; height: 13px; opacity: 0; transition: opacity .15s; }
.sheetopt.is-active .sheetopt__check svg { opacity: 1; }

/* ════════════════════ TOAST ════════════════════ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 24px);
  z-index: 90; max-width: 360px; width: max-content;
  padding: 13px 18px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600;
  background: rgba(16,26,44,0.96); border: 1px solid var(--line-strong); color: var(--ink);
  box-shadow: var(--shadow-2); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .3s var(--ease-out);
  display: flex; align-items: center; gap: 9px;
}
.toast[hidden] { display: none; }
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
/* actionable toast: tap navigates (e.g. «Генерация запущена» → галерея) */
.toast.is-shown.toast--act { pointer-events: auto; cursor: pointer; }
.toast--act { border-color: var(--amber-a35); }
.toast__chev { display: inline-flex; color: var(--accent-2); }
.toast__chev svg { width: 16px; height: 16px; }
/* lift above the persistent tab bar when it's on screen */
.toast.is-over-tabnav { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
.toast--bad { border-color: rgba(255,98,89,0.4); }
.toast--bad .toast__ico { color: var(--bad); }
.toast--good { border-color: rgba(94,224,138,0.4); }
.toast--good .toast__ico { color: var(--good); }
.toast__ico { font-size: 16px; }

/* ════════════════════ LIGHTBOX (fullscreen gallery viewer) ════════════════════ */
.lightbox {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(4, 6, 11, 0.96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 10px 14px;
  opacity: 0; transition: opacity .22s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.is-shown { opacity: 1; }
.lightbox__topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 12px 12px;
}
.lb-count {
  font-family: var(--ff-mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--ink-dim); background: rgba(10, 10, 13, 0.55); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 6px 12px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.lightbox__close {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink); background: rgba(10, 10, 13, 0.55); border: 1px solid var(--line);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.lightbox__close:active { transform: scale(0.92); }
.lightbox__close svg { width: 18px; height: 18px; }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink); background: rgba(10, 10, 13, 0.55); border: 1px solid var(--line);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background .18s, transform .12s;
}
.lightbox__nav:hover { background: rgba(10, 10, 13, 0.82); }
.lightbox__nav:active { transform: translateY(-50%) scale(0.9); }
.lightbox__nav svg { width: 20px; height: 20px; }
.lightbox__nav--prev { left: 10px; }
.lightbox__nav--prev svg { margin-left: -2px; }
.lightbox__nav--next { right: 10px; }
.lightbox__nav--next svg { margin-right: -2px; }
.lightbox__nav[hidden] { display: none; }
.lightbox__body {
  flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 58px 6px 2px;
}
.lb-media {
  max-width: 100%; max-height: 100%; border-radius: var(--r-md); object-fit: contain;
  box-shadow: var(--shadow-2); animation: lbIn .26s var(--ease-out);
}
img.lb-media { cursor: zoom-in; transition: transform .28s var(--ease-out); }
.lb-media.is-zoom { transform: scale(2.15); cursor: zoom-out; border-radius: 0; }
@keyframes lbIn { from { opacity: 0; transform: scale(0.985); } }
.lb-audiowrap { text-align: center; }
.lb-audiowrap .lb-emoji { font-size: 72px; margin-bottom: 18px; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.5)); }
.lb-audiowrap .lb-cover { width: min(52vh, 78vw); aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--r-lg); margin-bottom: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); }
.lb-audio { width: min(420px, 100%); }
.lb-empty { text-align: center; color: var(--ink-faint); }
.lb-empty .lb-emoji { font-size: 64px; margin-bottom: 12px; opacity: 0.6; }
.lightbox__bar {
  flex: 0 0 auto; width: 100%; max-width: 640px; margin-top: 8px;
  padding: 12px 14px max(4px, env(safe-area-inset-bottom));
  text-align: center; border-top: 1px solid rgba(216, 222, 232, 0.09);
}
.lb-prompt {
  font-size: 13px; color: var(--ink-dim); line-height: 1.45; margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lb-meta { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 10px; }

/* spinner (used inside buttons during async ops) */
.loader {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(7, 19, 37, 0.3); border-top-color: var(--on-accent);
  animation: spin 0.7s linear infinite; display: inline-block;
}

/* ════════════════════ UTIL ════════════════════ */
.spacer { flex: 1; }
.muted { color: var(--ink-faint); }
.tcenter { text-align: center; }
.row-gap-sm > * + * { margin-top: 8px; }
.row-gap > * + * { margin-top: 11px; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.kbd { font-family: var(--ff-mono); font-size: 11px; padding: 2px 6px; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-dim); }

/* hide caret flicker on long press */
* { -webkit-tap-highlight-color: transparent; }

@media (prefers-reduced-motion: reduce) {
  .screen > * { animation: none; opacity: 1; transform: none; }
  .glow { animation: none; }
  .ghost__ring, .ghost__skel::after, .ghost__mark, .genstage__eta::before, .genrail__dot { animation: none; }
  .ghost__ring { opacity: 0.5; }
  .result__art { animation: none; }
}

/* ── Subscriptions (#11) ─────────────────────────────────────── */
.tariff--sub { border-color: rgba(216,222,232,0.40); background: linear-gradient(135deg, rgba(216,222,232,0.12), var(--amber-a03)); box-shadow: 0 12px 34px -18px rgba(216,222,232,0.55); }
.tariff--sub .tariff__ribbon { color: var(--gold); }
.subbadge { padding: 16px; }
.subbadge__head { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--good); display: flex; align-items: center; gap: 8px; }
.subbadge__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(94,224,138,0.18); }

/* ── Share banner (#12) ──────────────────────────────────────── */
.share-banner { padding: 14px; }
.share-banner__head { font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.share-banner__head svg { width: 13px; height: 13px; flex: 0 0 auto; }
.share-banner__media { width: 100%; max-height: 56vh; object-fit: contain; border-radius: var(--r-md); display: block; background: #000; }
.share-banner__media:not([controls]) { max-height: 40vh; }

/* ── TOPUP: term picker + disabled packs ─────────────────────── */
.termrow { display: flex; gap: 8px; margin-top: 12px; }
.termbtn { flex: 1; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding: 10px 11px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--bg-soft); cursor: pointer; transition: transform .14s var(--ease), border-color .2s, background .2s; }
.termbtn:active { transform: scale(0.97); }
.termbtn:hover { border-color: var(--line-strong); background: var(--amber-a05); }
.termbtn__label { font-size: 11px; color: var(--ink-dim); letter-spacing: 0.02em; }
.termbtn__price { font-family: var(--ff-display); font-weight: 700; font-size: 15px; color: var(--ink); }
.tariff:disabled, .tariff[disabled] { opacity: 0.45; cursor: not-allowed; }
.tariff:disabled:active { transform: none; }

/* ── Inspiration cards (home screen) ─────────────────────────── */
.insprow { display: flex; flex-direction: column; gap: 10px; }
.insp { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: transform .14s var(--ease), border-color .2s, background .2s; text-align: left; }
.insp:active { transform: scale(0.985); }
.insp:hover { border-color: var(--line-strong); background: var(--amber-a05); }
.insp__emoji { font-size: 24px; line-height: 1; }
.insp__body { flex: 1; min-width: 0; }
.insp__title { font-family: var(--ff-display); font-weight: 600; font-size: 15px; color: var(--ink); }
.insp__type { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.insp__arrow { color: var(--ink-faint); display: grid; place-items: center; }
.insp__arrow svg { width: 18px; height: 18px; }

/* ════════════════════ HOME (redesign) ════════════════════ */
.home__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px 4px; }
.home__brand { display: flex; align-items: center; gap: 11px; }
.home__brandtext { line-height: 1; }
.home__brandname { font-family: var(--ff-display); font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.home__brandsub { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.3em; color: var(--accent-2); text-transform: uppercase; margin-top: 4px; }
.home__headright { display: flex; align-items: center; gap: 8px; }
.subchip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: var(--r-pill); font-family: var(--ff-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--gold); background: linear-gradient(135deg, rgba(216,222,232,0.16), rgba(216,222,232,0.05)); border: 1px solid rgba(216,222,232,0.32); }
.subchip__crown { font-size: 12px; }
.home__tokens { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px 8px 11px; border-radius: var(--r-pill); background: linear-gradient(135deg, rgba(216,222,232,0.14), var(--amber-a05)); border: 1px solid rgba(216,222,232,0.28); transition: background .2s, transform .12s; }
.home__tokens:active { transform: scale(0.96); }
.home__tokens-star { color: var(--gold); font-size: 13px; line-height: 1; filter: drop-shadow(0 0 6px rgba(216,222,232,0.5)); }
.home__tokens-val { font-family: var(--ff-mono); font-weight: 700; font-size: 14px; color: var(--ink); }
.home__tokens-unit { font-size: 11px; color: var(--ink-dim); font-weight: 600; }

.home__hero { margin-top: 26px; }
/* content-first home (PLAN-HOME-REDESIGN §3.1): компактный герой над витриной */
.home__title { font-family: var(--ff-display); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; line-height: 1.08; margin-top: 8px; }
.home__lede { font-size: 14px; line-height: 1.5; color: var(--ink-dim); margin-top: 10px; max-width: 30ch; }

/* small text action used in section heads ("Смотреть все →", "Сбросить") */
.section__link { font-family: var(--ff-mono); font-size: 11px; font-weight: 600; color: var(--accent-2); letter-spacing: 0.02em; }
.section__link:active { opacity: 0.7; }

/* ── Create cards (home: Изображение / Видео / Музыка) ──── */
.creategrid { display: grid; gap: 12px; margin-top: 4px; }
.createcard {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  padding: 18px; border-radius: var(--r-xl); cursor: pointer;
  border: 1px solid var(--line); text-align: left; width: 100%;
  transition: transform .18s var(--ease), box-shadow .25s, border-color .2s;
}
.createcard:active { transform: scale(0.985); }
.createcard__art { position: absolute; inset: 0; z-index: 0; }
.createcard__art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, rgba(7,14,38,0.6) 0%, rgba(7,14,38,0.2) 50%, transparent 100%); }
.createcard__body { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 3px; }
.createcard__emoji { font-size: 26px; line-height: 1; margin-bottom: 5px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.45)); }
.createcard__name { font-family: var(--ff-display); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.createcard__desc { font-size: 12.5px; color: var(--ink-ghost); }
.createcard__go { position: relative; z-index: 1; margin-left: auto; color: var(--ink); opacity: 0.6; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(216,222,232,0.08); border: 1px solid var(--line); }
.createcard__go svg { width: 18px; height: 18px; }
.createcard--image { background: linear-gradient(120deg, #16161A, #0E0E12); }
.createcard--image .createcard__art { background: radial-gradient(120% 140% at 85% 20%, var(--amber-a50), transparent 60%); }
.createcard--video { background: linear-gradient(120deg, #16161A, #0E0E12); }
.createcard--video .createcard__art { background: radial-gradient(120% 140% at 85% 20%, var(--amber-a50), transparent 60%); }
.createcard--music { background: linear-gradient(120deg, #16161A, #0E0E12); }
.createcard--music .createcard__art { background: radial-gradient(120% 140% at 85% 20%, var(--amber-a50), transparent 60%); }

/* ════════════════════ CONSTRUCTOR: type switcher + style picker ════════════════════ */
.typeswitch { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.typeswitch__t {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 4px; border-radius: var(--r-sm);
  font-family: var(--ff-body); font-weight: 600; font-size: 12px; color: var(--ink-dim);
  transition: all .2s var(--ease); min-width: 0;
}
.typeswitch__t svg { width: 18px; height: 18px; flex: 0 0 auto; }
.typeswitch__t span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typeswitch__t:active { transform: scale(0.96); }
.typeswitch__t.is-active {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 16px -9px var(--accent-glow);
}

/* ═══ CONSTRUCTOR: stable/swappable regions + 2×2 grid (no full re-render) ═══ */
/* Exempt the swappable regions from the screen-rise animation — its `forwards`
   fill would lock opacity:1 and block the swap crossfade. They render at
   opacity:1 and crossfade on type / option / style changes instead. */
.ctor-region { animation: none; opacity: 1; transform: none; transition: opacity 150ms var(--ease-out-quart), transform 150ms var(--ease-out-quart); }
.ctor-region.is-out { opacity: 0; transform: translateY(6px); }

.ctor-modelrow { display: flex; flex-direction: column; gap: 10px; }

/* 2×2 settings grid + compact value cards (Пропорции / Разрешение / Длительность / Звук …) */
.ctorgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optcard {
  display: flex; flex-direction: column; gap: 7px;
  padding: 13px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  cursor: pointer; text-align: left; width: 100%;
  transition: transform var(--dur-1) var(--ease-out-quart), background var(--dur-2), border-color var(--dur-2);
}
.optcard:active { transform: scale(0.97); }
.optcard:hover { background: var(--surface-2); border-color: var(--line-strong); }
.optcard--accent { border-color: var(--amber-a35); background: linear-gradient(135deg, var(--amber-a12), var(--amber-a03)); }
.optcard__top { display: flex; align-items: center; gap: 8px; }
.optcard__ico { color: var(--ink-faint); display: inline-grid; place-items: center; }
.optcard__ico svg { width: 18px; height: 18px; }
.optcard--accent .optcard__ico { color: var(--accent-2); }
.optcard__label { flex: 1; font-size: 12px; color: var(--ink-faint); letter-spacing: 0.01em; }
.optcard__val { font-family: var(--ff-mono); font-weight: 700; font-size: 16px; color: var(--ink); }
.optcard--model .optcard__val { font-family: var(--ff-body); font-weight: 600; font-size: 15px; }   /* model name, not a number */
.optcard__sub { font-size: 11px; color: var(--ink-faint); margin-top: -3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctor-prompt { min-height: 148px; }

/* ════════════════════ INSPIRATION tab ════════════════════ */
.inspfilt-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 4px 20px; -webkit-overflow-scrolling: touch; }
.inspfilt-row::-webkit-scrollbar { display: none; }
.inspfilt { flex: 0 0 auto; padding: 9px 15px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; color: var(--ink-dim); background: var(--surface); border: 1px solid var(--line); white-space: nowrap; transition: all .18s var(--ease); }
.inspfilt:active { transform: scale(0.95); }
.inspfilt.is-active { color: var(--on-accent); background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; box-shadow: 0 6px 18px -10px var(--accent-glow); }

.inspgrid { column-count: 2; column-gap: 4px; }
.inspcard { break-inside: avoid; margin-bottom: 4px; display: block; padding: 0; appearance: none; -webkit-appearance: none; border-radius: var(--r-lg); cursor: pointer; background: none; border: none; transition: transform .16s var(--ease), border-color .2s, background .2s; overflow: hidden; position: relative; }
.inspcard:active { transform: scale(0.97); }
.inspcard:hover { border-color: var(--line-strong); }
.inspcard__art { width: 100%; display: block; position: relative; overflow: hidden; }
.inspcard__art--emoji { aspect-ratio: 1/1; display: grid; place-items: center; }
.inspcard__art img { display: block; width: 100%; height: auto; }
.inspcard__art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255,255,255,0.13), transparent 55%); }
.inspcard__emoji { position: relative; font-size: 34px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }
.inspcard__body { display: flex; flex-direction: column; gap: 2px; padding: 0 2px 3px; }
.inspcard__title { font-family: var(--ff-display); font-weight: 600; font-size: 13.5px; }
.inspcard__type { font-size: 11px; color: var(--ink-faint); }

/* ════════════════════ PERSISTENT TAB NAVIGATION ════════════════════ */
.tabnav { flex: 0 0 auto; position: relative; z-index: 14; padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, transparent, rgba(6,12,28,0.92) 38%); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tabnav[hidden] { display: none; }
.tabnav__row { position: relative; display: flex; align-items: flex-end; justify-content: space-between; padding: 7px 6px; border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(20,20,24,0.82), rgba(10,10,12,0.92)); border: 1px solid var(--line-strong); box-shadow: 0 1px 0 rgba(216,222,232,0.08) inset, 0 14px 40px -18px rgba(0,0,0,0.8); }
.tabnav__item { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; color: var(--ink-faint); transition: color .2s var(--ease), transform .12s; min-width: 0; }
.tabnav__item:active { transform: scale(0.92); }
.tabnav__item.is-active { color: var(--accent-2); }
.tabnav__ico { width: 23px; height: 23px; display: grid; place-items: center; position: relative; }
.tabnav__ico svg { width: 22px; height: 22px; }
.tabnav__item.is-active .tabnav__ico { filter: drop-shadow(0 0 7px var(--accent-glow)); }
.tabnav__label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
.tabnav__badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-xs);
  background: var(--accent-2);
  color: #1a1a1a;
  font-family: var(--ff-display);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg), 0 0 10px var(--accent-glow);
  animation: tabnav-badge-pop .32s var(--ease);
  pointer-events: none;
  z-index: 2;
}
@keyframes tabnav-badge-pop {
  from { transform: scale(0); }
  60%  { transform: scale(1.18); }
  to   { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .tabnav__badge { animation: none; }
}

/* live dot on the Create FAB — background generations in flight */
.tabnav__fabdot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: fabdot-pulse 1.6s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}
@keyframes fabdot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(0.72); opacity: 0.65; }
}
@media (prefers-reduced-motion: reduce) {
  .tabnav__fabdot { animation: none; }
}

/* live strip: active background generations (MENU / CONSTRUCTOR) */
.genlive { padding: 12px 14px; border: 1px solid var(--amber-a25); border-radius: var(--r-md); background: linear-gradient(150deg, var(--amber-a08), var(--amber-a03)); }
.genlive__head { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint-card); margin-bottom: 8px; }
.genlive__row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: none; border-radius: var(--r-sm); background: none; cursor: pointer; text-align: left; transition: background .16s; }
.genlive__row:hover { background: var(--amber-a05); }
.genlive__row + .genlive__row { margin-top: 2px; }
.genlive__spin { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--amber-a25); border-top-color: var(--accent-2); animation: genlive-rot .9s linear infinite; }
@keyframes genlive-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .genlive__spin { animation-duration: 2.4s; }
}
.genlive__main { flex: 1; min-width: 0; }
.genlive__t { display: block; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.genlive__s { display: block; font-size: 11.5px; color: var(--ink-faint-card); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.genlive__time { flex: 0 0 auto; font-size: 11.5px; color: var(--ink-faint-card); }

/* center Create FAB — raised, glowing platinum-azure star */
.tabnav__fab { flex: 0 0 auto; position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: -28px; padding: 0 6px; }
.tabnav__star {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: var(--on-accent);
  background: radial-gradient(120% 120% at 30% 25%, var(--accent-soft) 0%, var(--accent-2) 35%, var(--accent) 100%);
  border: 1px solid rgba(216,222,232,0.5);
  box-shadow: 0 12px 30px -8px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.4) inset;
  transition: transform .15s var(--ease);
  animation: fabGlow 2.4s ease-in-out infinite;
}
.tabnav__star svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
.tabnav__fab:active .tabnav__star { transform: scale(0.93); }
.tabnav__fab.is-active .tabnav__fab-label { color: var(--accent-2); }
.tabnav__fab.is-active .tabnav__star { animation: none; filter: drop-shadow(0 0 10px var(--accent-glow)); }
.tabnav__fab-label { font-family: var(--ff-display); font-weight: 700; font-size: 10px; color: var(--accent-soft); letter-spacing: 0.02em; }
@keyframes fabGlow {
  0%, 100% { box-shadow: 0 12px 30px -8px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.4) inset; }
  50% { box-shadow: 0 0 0 6px var(--amber-a12), 0 16px 38px -8px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.5) inset; }
}
@media (prefers-reduced-motion: reduce) { .tabnav__star { animation: none; } }

/* ════════════════════ APP BAR (persistent header) ════════════════════ */
.appbar { flex: 0 0 auto; padding: 10px 16px 8px; padding-top: max(10px, env(safe-area-inset-top, 0px)); position: relative; z-index: 20; }
@media (min-width: 480px) { .appbar { padding-top: 18px; } }
.appbar__in { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appbar__spacer { flex: 1; min-width: 4px; }
.appbar__back { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--surface); border: 1px solid var(--line); transition: transform .15s, background .2s; }
.appbar__back:active { transform: scale(0.92); }
.appbar__back svg { width: 20px; height: 20px; }
.appbar__title { font-family: var(--ff-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appbar__wordmark { display: flex; flex-direction: column; line-height: 1; }
.appbar__na { font-family: var(--ff-display); font-weight: 800; font-size: 15px; letter-spacing: -0.01em; }
.appbar__st { font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.3em; color: var(--accent-2); text-transform: uppercase; margin-top: 2px; }
.mark--sm { width: 32px; height: 32px; border-radius: var(--r-sm); font-size: 16px; box-shadow: 0 6px 16px -8px var(--accent-glow); }

/* combined token + subscription chip */
.appbar__chip { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; padding: 7px 12px; border-radius: var(--r-pill); background: linear-gradient(135deg, rgba(216,222,232,0.14), var(--amber-a05)); border: 1px solid rgba(216,222,232,0.26); transition: background .2s, transform .12s; }
.appbar__chip:active { transform: scale(0.96); }
.appbar__chip-star { color: var(--gold); font-size: 12px; line-height: 1; filter: drop-shadow(0 0 5px rgba(216,222,232,0.5)); }
.appbar__chip-tok { font-weight: 700; font-size: 13px; color: var(--ink); }
.appbar__chip-sep { width: 1px; height: 14px; background: rgba(216,222,232,0.22); }
.appbar__chip-sub { display: inline-flex; align-items: center; gap: 4px; font-family: var(--ff-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--gold); }
.appbar__chip-crown { font-size: 11px; }

/* ════════════════════ HOME: minimalist create row ════════════════════ */
.home__hero { margin-top: 18px; }
.createcards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 2px; }
.createcard-mini { display: flex; flex-direction: column; align-items: center; gap: 11px; padding: 18px 8px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: transform .16s var(--ease), border-color .2s, background .2s; }
.createcard-mini:active { transform: scale(0.97); }
.createcard-mini:hover { border-color: var(--line-strong); background: var(--surface-2); }
.createcard-mini__ico { width: 48px; height: 48px; border-radius: var(--r-md); display: grid; place-items: center; color: var(--accent-2); background: linear-gradient(135deg, var(--amber-a18), var(--amber-a05)); border: 1px solid var(--amber-a25); box-shadow: 0 6px 16px -10px var(--accent-glow); }
.createcard-mini__ico svg { width: 23px; height: 23px; }
.createcard-mini__name { font-family: var(--ff-display); font-weight: 600; font-size: 12.5px; color: var(--ink); }

/* ════════════════════ HOME: content-first showcase (PLAN-HOME-REDESIGN §5) ════════════════════ */

/* ── 5.1 Snap-карусель витрины ── */
.showcase { margin-top: 14px; }
.showcase__track {
  position: relative;               /* offsetParent для scroll-to-card */
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
  scrollbar-width: none;
}
.showcase__track::-webkit-scrollbar { display: none; }

.scard {
  position: relative;
  flex: 0 0 86%;
  aspect-ratio: 3 / 4;
  max-height: 62vh;
  margin: 0;
  padding: 0;
  appearance: none; -webkit-appearance: none;
  border: none;
  border-radius: var(--r-xl);
  overflow: hidden;
  scroll-snap-align: center;
  background: var(--surface-solid);
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  text-align: left;
  opacity: 0.55;
  transform: scale(0.96);
  transition: transform .3s var(--ease-out), opacity .3s var(--ease-out);
}
.scard.is-active { opacity: 1; transform: scale(1); }
.scard:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* скелетон на время загрузки манифеста */
.scard--skel { cursor: default; scroll-snap-align: center; background: var(--surface); box-shadow: none;
  background-image: linear-gradient(100deg, transparent 30%, var(--surface-2) 50%, transparent 70%);
  background-size: 200% 100%; animation: showcase-shimmer 1.6s linear infinite; }
@keyframes showcase-shimmer { to { background-position: -200% 0; } }

.scard__media { position: absolute; inset: 0; }
.scard__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* ken-burns только на активном слайде; рестарт при возврате — осознанно */
.scard.is-active .scard__media img { animation: showcase-kb 14s var(--ease) forwards; }
@keyframes showcase-kb { from { transform: scale(1); } to { transform: scale(1.06); } }

.scard__scrim {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10,10,11,.38) 0%, rgba(10,10,11,0) 22%),
    linear-gradient(180deg, rgba(10,10,11,0) 42%, rgba(10,10,11,.88) 100%);
}

.scard__chip, .ideacard__chip {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(10,10,11,.72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-family: var(--ff-body); font-weight: 600; font-size: 12px; line-height: 1;
  color: var(--ink);
  pointer-events: none;
}
.scard__chip::before, .ideacard__chip::before {
  content: ""; flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.ideacard__chip { top: 8px; left: 8px; padding: 5px 9px; font-size: 11px; }

.scard__meta {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.scard__title { font-family: var(--ff-display); font-weight: 800; font-size: 22px; line-height: 26px; letter-spacing: -0.01em; color: var(--ink); }
.scard__cta {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--ff-body); font-weight: 700; font-size: 14px; line-height: 1;
  transition: transform .16s var(--ease), box-shadow .25s var(--ease);
}
.scard__cta svg { width: 15px; height: 15px; }
.scard:active .scard__cta { transform: scale(0.97); }
@media (hover: hover) {
  .scard:hover .scard__cta { box-shadow: 0 0 24px var(--amber-a35); }
  .scard:hover { opacity: 1; }
}

.showcase__dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.sdot {
  width: 6px; height: 6px; padding: 0;
  appearance: none; -webkit-appearance: none;
  border: none; border-radius: var(--r-pill);
  background: rgba(216,222,232,.25);
  cursor: pointer;
  transition: width .25s var(--ease-out), background-color .25s;
}
.sdot.is-active { width: 18px; background: var(--accent); }
.sdot:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ── 5.2 Prompt bar ── */
.promptbar {
  display: flex; align-items: center; gap: 6px;
  margin-top: 18px;
  padding: 8px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  transition: border-color .2s, box-shadow .2s;
}
.promptbar:focus-within { border-color: var(--amber-a50); box-shadow: 0 0 0 3px var(--amber-a12); }
.promptbar__input {
  flex: 1; min-width: 0;
  padding: 8px 6px;
  border: none; background: none; outline: none;
  font-family: var(--ff-body); font-size: 15px; line-height: 1.35;
  color: var(--ink);
}
.promptbar__input::placeholder { color: var(--ink-faint); }
.promptbar__go {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  appearance: none; -webkit-appearance: none;
  border: none; border-radius: var(--r-md);
  background: var(--accent); color: var(--on-accent);
  cursor: pointer;
  animation: promptbar-spark 2.4s ease-in-out infinite;   /* единственный «живой» якорь */
}
.promptbar__go:active { transform: scale(0.94); }
.promptbar__go svg { width: 19px; height: 19px; }
@keyframes promptbar-spark {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,180,0,0); }
  50% { box-shadow: 0 0 18px 2px var(--amber-a35); }
}

/* чипы типов под баром: сгенерированный арт-фон + затемнение */
.createcard-mini--art { position: relative; overflow: hidden; border-color: rgba(216,222,232,.16); }
.createcard-mini--art::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(10,10,11,.55), rgba(10,10,11,.55)), var(--card-bg);
  background-size: cover;
  background-position: center;
}
.createcard-mini--art > * { position: relative; z-index: 1; }
.createcard-mini--art .createcard-mini__ico {
  background: rgba(10,10,11,.6);
  border-color: var(--amber-a25);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.createcard-mini--art .createcard-mini__name { text-shadow: 0 1px 6px rgba(0,0,0,.6); }

/* ── 5.3 Ideas: masonry-витрина (нативные высоты, без кропа) ── */
.ideasgrid { columns: 2; column-gap: 12px; }
.ideacard {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  appearance: none; -webkit-appearance: none;
  border: none;
  border-radius: var(--r-md);
  overflow: hidden;
  break-inside: avoid;
  margin-bottom: 12px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  transition: transform .16s var(--ease);
}
.ideacard:active { transform: scale(0.97); }
.ideacard:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.ideacard img { display: block; width: 100%; height: auto; }
.ideacard__scrim {
  position: absolute; left: 0; right: 0; bottom: 0; height: 46%;
  background: linear-gradient(180deg, rgba(10,10,11,0), rgba(10,10,11,.84));
  pointer-events: none;
}
.ideacard__title {
  position: absolute; left: 10px; right: 10px; bottom: 9px;
  font-family: var(--ff-body); font-weight: 600; font-size: 14px; line-height: 1.25;
  color: var(--ink);
}

/* ════════════════════ HOME v2: видео-кейсы + фотосет (PLAN-HOME-V2 §2/§4/§5) ════════════════════ */

/* ── Видео-слайды карусели: вертикальные 9:16, ширина ≤86% трека и ≤62vh ── */
.scard--video {
  flex-basis: auto;
  width: min(86%, calc(62vh * 9 / 16));
  aspect-ratio: 9 / 16;
}
.scard__media video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  background: #000;   /* чёрные поля до load видео / при фейле — постер сверху */
}

/* ── Кейсы-шаблоны «Что умеет студия»: горизонтальный скролл карточек 2:3 ── */
.caserail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
  scrollbar-width: none;
}
.caserail::-webkit-scrollbar { display: none; }
.casecard {
  position: relative;
  flex: 0 0 44%;
  aspect-ratio: 2 / 3;
  margin: 0;
  padding: 0;
  appearance: none; -webkit-appearance: none;
  border: none;
  border-radius: var(--r-lg);
  overflow: hidden;
  scroll-snap-align: start;
  background: var(--surface-solid);
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  text-align: left;
  transition: transform .16s var(--ease);
}
.casecard:active { transform: scale(0.97); }
.casecard:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.casecard__media { position: absolute; inset: 0; }
.casecard__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.casecard__play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 1;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(10,10,12,.55);
  color: var(--ink);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 0 1px rgba(216,222,232,.18) inset, 0 4px 14px rgba(0,0,0,.35);
  pointer-events: none;
}
.casecard__play svg { width: 16px; height: 16px; padding-left: 2px; }
.casecard__scrim {
  position: absolute; left: 0; right: 0; bottom: 0; height: 52%;
  background: linear-gradient(180deg, rgba(10,10,11,0), rgba(10,10,11,.86));
  pointer-events: none;
}
.casecard__meta { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 1; }
.casecard__cat {
  font-family: var(--ff-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 3px;
}
.casecard__title {
  font-family: var(--ff-display); font-weight: 700; font-size: 15px; line-height: 1.2;
  color: var(--ink);
}
/* Фотосет §5 переиспользует .ideasgrid/.ideacard из §5.3 без изменений. */

/* reduced-motion: витрина полностью статична, автолистание и видео-автоплэй выключены в JS */
@media (prefers-reduced-motion: reduce) {
  .scard, .sdot, .scard__cta, .ideacard, .casecard { transition: none; }
  .scard.is-active .scard__media img { animation: none; }
  .scard--skel { animation: none; }
  .promptbar__go { animation: none; }
}

/* media-backed cards + home teaser thumb */
.insp__thumb { width: 44px; height: 44px; flex: 0 0 auto; border-radius: var(--r-sm); background-size: cover; background-position: center; background-color: var(--surface-2); }
.inspcard__art--media { line-height: 0; }
.inspcard__art--media::after { background: linear-gradient(160deg, rgba(0,0,0,0.20), transparent 60%); }
.inspcard__art--video { padding: 0; }
.inspcard__video { width: 100%; height: auto; display: block; }
.inspcard__play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(10,10,12,0.55); color: var(--ink); font-size: 13px; padding-left: 2px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: opacity .25s ease; pointer-events: none; }
.inspcard.is-playing .inspcard__play { opacity: 0; }
.inspcard__pin { position: absolute; top: 6px; right: 7px; z-index: 2; font-size: 13px; color: var(--accent-2); filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6)); }

/* ════════════════════ INSPIRATION CMS · ADMIN ════════════════════ */
.acard { display: flex; gap: 12px; padding: 11px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.acard + .acard { margin-top: 8px; }
.acard__thumb { width: 64px; height: 64px; flex: 0 0 auto; border-radius: var(--r-sm); background-size: cover; background-position: center; position: relative; }
.acard__thumb--ph { display: grid; place-items: center; background: var(--surface-2); font-size: 22px; }
.acard__play { position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(10,10,12,0.55); color: var(--ink); font-size: 10px; padding-left: 2px; }
.acard__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.acard__t { font-family: var(--ff-display); font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acard__meta { font-size: 11px; color: var(--ink-faint); }
.acard__acts { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.mini { padding: 5px 10px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; color: var(--ink-dim); background: var(--surface-2); border: 1px solid var(--line); transition: all .16s var(--ease); }
.mini:active { transform: scale(0.94); }
.mini.is-on { color: var(--on-accent); background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-color: transparent; }
.mini--danger { color: var(--bad); border-color: rgba(255,98,89,0.30); }

/* admin create form */
.adraft__prevwrap { margin-top: 12px; }
.adraft__prev { width: 100%; max-height: 260px; object-fit: contain; border-radius: var(--r-md); background: var(--surface-2); display: block; }
.adraft__ph { padding: 28px 12px; text-align: center; color: var(--ink-faint); font-size: 12.5px; border-radius: var(--r-md); background: var(--surface); border: 1px dashed var(--line-strong); }
.fld { display: block; }
.fld__label { display: block; font-size: 11px; font-weight: 600; color: var(--ink-dim); margin-bottom: 6px; letter-spacing: 0.01em; }
.fld__input { width: 100%; box-sizing: border-box; padding: 11px 13px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-family: var(--ff-body); font-size: 14px; resize: vertical; }
.fld__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.fld--check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-dim); cursor: pointer; }
.fld--check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* lightbox actions row */
.lb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.lb-btn--danger { color: var(--bad); border-color: rgba(255,98,89,0.30); }

/* Inspiration: admin in-tab management (▲▼ + visibility on tap) */
.inspcard { position: relative; }
.inspcard.is-manage { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-glow); }
.inspcard__off { position: absolute; top: 8px; left: 8px; z-index: 3; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink); background: rgba(10,10,12,0.66); padding: 2px 7px; border-radius: var(--r-pill); }
.inspm__hint { margin: 2px 2px 12px; }
.inspm__bar { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 3; display: flex; justify-content: center; gap: 7px; }
.inspm__b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: var(--ink); background: rgba(10,10,12,0.62); border: 1px solid var(--line-strong); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.inspm__b svg { width: 15px; height: 15px; }
.inspm__b:active { transform: scale(0.92); }
.inspm__b.is-off { color: var(--bad); }

/* ── Pull-to-refresh ───────────────────────────────────── */
.ptr {
  flex: 0 0 auto;
  height: 0;
  overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center;
  transition: height .2s var(--ease-out);
  background: transparent;
}
.ptr__sp {
  width: 26px; height: 26px; margin-bottom: 10px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.14);
  border-top-color: var(--accent);
  opacity: 0;
  transition: opacity .15s, transform .15s;
}
.ptr.is-pull .ptr__sp { opacity: 1; }
.ptr.is-armed .ptr__sp { border-top-color: var(--accent-2); transform: scale(1.1); }
.ptr.is-spin .ptr__sp { animation: spin .8s linear infinite; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ptr.is-spin .ptr__sp { animation: none; } }

/* ── Prompt enhance sheet ── */
.enh { display: flex; flex-direction: column; gap: 14px; }
.enh--loading { align-items: center; justify-content: center; padding: 24px 0; color: var(--ink-dim); gap: 10px; }
.enh__summary { background: linear-gradient(135deg, var(--amber-a12), var(--amber-a03)); border: 1px solid var(--amber-a25); border-radius: var(--r-md); padding: 12px 14px; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.enh__qs { display: flex; flex-direction: column; gap: 12px; }
.enh__ql { font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.enh__opts { display: flex; flex-wrap: wrap; gap: 6px; }
.enh__opt { font: inherit; font-size: 12.5px; padding: 7px 12px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-dim); cursor: pointer; transition: all .15s; }
.enh__opt.is-active { border-color: var(--accent); background: var(--amber-a12); color: var(--ink); }
.enh__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.enh__chip { font: inherit; font-size: 12.5px; padding: 6px 11px; border-radius: var(--r-pill); border: 1px dashed var(--line-strong); background: transparent; color: var(--ink-dim); cursor: pointer; transition: all .15s; }
.enh__chip.is-active { border-style: solid; border-color: var(--accent); background: var(--amber-a12); color: var(--ink); }
.enh__ta { width: 100%; min-height: 56px; resize: vertical; font: inherit; font-size: 13.5px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); box-sizing: border-box; }
.enh__ta:focus { outline: none; border-color: var(--accent); }
.enh__btns { display: flex; gap: 8px; }
.enh__btns .toolbtn { flex: 1; }
.enh__full { width: 100%; }
.enh__result { display: flex; flex-direction: column; gap: 10px; }
.enh__rh { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
.enh__prompt { font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.enh__prompt--sm { font-size: 13px; }
.enh__deltas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.enh__delta { font-size: 12.5px; color: #7bd88f; }
.enh__why { font-size: 12.5px; color: var(--ink-faint); font-style: italic; }
.enh__err { text-align: center; padding: 16px 0; color: var(--ink-dim); display: flex; align-items: center; justify-content: center; gap: 9px; }
.enh__err svg { width: 17px; height: 17px; color: var(--accent-2); flex: 0 0 auto; }
.enh--chat { height: 60vh; }
.enh__thread { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; margin-bottom: 10px; scrollbar-width: none; }
.enh__thread::-webkit-scrollbar { display: none; }
.enh__cap { font-size: 13px; color: var(--ink-faint); padding: 8px 2px; }
.enh__bubble { font-size: 13.5px; line-height: 1.45; padding: 9px 12px; border-radius: var(--r-md); max-width: 88%; word-wrap: break-word; }
.enh__bubble--user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.enh__bubble--ai { align-self: flex-start; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.enh__inline { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.enh__input { display: flex; gap: 8px; align-items: flex-end; }
.enh__input .enh__ta { min-height: 44px; flex: 1; }
.enh__input .toolbtn { flex: 0 0 auto; }
/* Enhancer: Промпт/Стихи segment (reuse .seg, compact row layout) */
.enh__tabs { margin-bottom: 14px; }
.enh__tabs .seg { flex-direction: row; justify-content: center; padding: 9px 6px; }
/* Lyrics tab: theme textarea + result preview */
.enh__ta--lyr { min-height: 88px; }
.enh__lyrics { white-space: pre-wrap; max-height: 44vh; overflow-y: auto; font-size: 13.5px; scrollbar-width: thin; }
.enh__tags { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }

/* ── Analyzer: реверс-промпт из файла/ссылки (лист «Анализ контента») ── */
.an { display: flex; flex-direction: column; gap: 14px; }
.an--loading { align-items: center; justify-content: center; padding: 24px 0; color: var(--ink-dim); gap: 10px; }
.an__drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 24px 14px; cursor: pointer; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  color: var(--ink-dim); transition: border-color .2s, background .2s, color .2s;
}
.an__drop:hover { border-color: var(--amber-a50); background: var(--amber-a05); }
.an__drop svg { width: 27px; height: 27px; color: var(--ink-faint); }
.an__drop-t { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.an__drop-s { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }
.an__file { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
.an__file--err { border-color: var(--amber-a35); }
.an__file > img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line-strong); flex: 0 0 auto; }
.an__file-meta { flex: 1; min-width: 0; }
.an__file-name { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an__file-sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.an__frames { display: flex; gap: 5px; overflow-x: auto; flex: 0 1 auto; max-width: 100%; padding-bottom: 3px; scrollbar-width: thin; }
.an__frames img { width: 82px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line-strong); flex: 0 0 auto; }
.an__rm { flex: 0 0 auto; width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--ink-dim); background: transparent; border: 0; cursor: pointer; }
.an__rm svg { width: 14px; height: 14px; }
.an__rm:hover { color: var(--ink); background: var(--surface-3); }
.an__or { display: flex; align-items: center; gap: 10px; color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.an__or::before, .an__or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.an__url-in {
  flex: 1; width: 100%; box-sizing: border-box; font: inherit; font-size: 13.5px;
  padding: 11px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink);
}
.an__url-in:focus { outline: none; border-color: var(--accent); }
.an__url-in::placeholder { color: var(--ink-faint); }
.an__go { width: 100%; }
.an__limited { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; color: var(--ink-dim); background: var(--amber-a12); border: 1px solid var(--amber-a25); border-radius: var(--r-sm); padding: 10px 12px; }
.an__limited svg { width: 16px; height: 16px; color: var(--accent-2); flex: 0 0 auto; margin-top: 1px; }
.an__prompt { font-size: 13.5px; line-height: 1.5; color: var(--ink); background: linear-gradient(135deg, var(--amber-a12), var(--amber-a03)); border: 1px solid var(--amber-a25); border-radius: var(--r-sm); padding: 12px 14px; }
.an__btns { display: flex; gap: 8px; }
.an__btns .toolbtn { flex: 1; }
.an__kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 12.5px; line-height: 1.45; }
.an__kv-k { color: var(--ink-faint); }
.an__kv-v { color: var(--ink-dim); overflow-wrap: anywhere; }
.an__palette { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.an__pal { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-faint); }
.an__sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(216, 222, 232, 0.25); }
.an__toggle { align-self: flex-start; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--accent-2); background: transparent; border: 0; padding: 2px 0; cursor: pointer; }
.an__toggle--dim { color: var(--ink-dim); font-weight: 600; }
.an__full { font-size: 13px; line-height: 1.55; color: var(--ink-dim); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; max-height: 44vh; overflow-y: auto; scrollbar-width: thin; }
.enh__tags .enh__chips { margin: 0; }
.enh__chip:disabled { opacity: .55; cursor: default; }
/* Audio prompt hint (MiniMax parses English tags better) */
.ctor-prompt-note { margin-top: 7px; }

/* ════════════════════ ICON SIZING (inline SVG glyphs) ════════════════════ */
/* Provider brand marks — monochrome platinum, amber when the card is active */
.modelcard__ico svg { width: 22px; height: 22px; color: var(--ink-dim); }
.modelcard.is-active .modelcard__ico svg { color: var(--accent-2); }

/* Pricing screen — provider chip + content-type group header */
.priceline__prov { display: inline-flex; align-items: center; flex: 0 0 auto; }
.priceline__prov svg { width: 15px; height: 15px; color: var(--ink-dim); }
.pricegroup__title { display: inline-flex; align-items: center; gap: 7px; }
.pricegroup__title svg { width: 15px; height: 15px; color: var(--accent-2); }

/* Reference upload — tabs, drop zone, thumbnails */
.reftab__t { display: inline-flex; align-items: center; gap: 6px; }
.reftab__t svg { width: 14px; height: 14px; }
.reftab__t.is-active svg { color: var(--accent-2); }
.refdrop__ico svg { width: 36px; height: 36px; color: var(--accent-2); }
.refthm__t svg { position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; color: var(--ink-dim); }

/* Paywall — estimates, features, trust bar */
.pw-est svg { width: 13px; height: 13px; flex: 0 0 auto; color: var(--accent-2); }
.pw-card--feat .pw-est svg { color: var(--accent); }
.pw-types { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.pw-types svg { width: 13px; height: 13px; color: var(--accent-2); }
.pw-card--feat .pw-types svg { color: var(--accent); }
.pw-types i { font-style: normal; }
.pw-types__dot { color: var(--ink-faint); }
.pw-trust > span { display: inline-flex; align-items: center; gap: 5px; }
.pw-trust svg { width: 13px; height: 13px; color: var(--accent-2); }
.pw-trust i { font-style: normal; }

/* Profile rows + info cards + PWA + account glyphs */
.linkcard__ico { color: var(--accent-2); }
.linkcard__ico svg { width: 18px; height: 18px; }
.infostub__ico { color: var(--accent-2); }
.infostub__ico svg { width: 30px; height: 30px; }
.pwa-cta__ico svg { width: 18px; height: 18px; }
.stat__sub svg { width: 11px; height: 11px; vertical-align: -1.5px; }

/* Toast + error sheet glyphs */
.toast__ico { display: inline-grid; place-items: center; }
.toast__ico svg { width: 16px; height: 16px; }
.err-emoji { display: inline-block; color: var(--accent-2); }
.err-emoji svg { width: 44px; height: 44px; }

/* Lightbox — media placeholder + meta + action buttons */
.lb-emoji svg { width: 56px; height: 56px; color: var(--ink-dim); }
.lb-meta__ico { display: inline-flex; align-items: center; vertical-align: -2px; margin-right: 4px; }
.lb-meta__ico svg { width: 13px; height: 13px; }
.btn--sm svg { width: 15px; height: 15px; }

/* ══════════════════════ WB КАРТОЧКИ (SPEC-WB-CARDS) ══════════════════════ */

/* Плитка-вход на главной */
.wbcard {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 16px; border-radius: var(--r-lg); cursor: pointer;
  background: linear-gradient(140deg, var(--amber-a12), var(--amber-a03) 55%), var(--surface);
  border: 1px solid var(--amber-a25); color: var(--ink);
  transition: transform .12s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.wbcard:active { transform: scale(0.985); }
.wbcard__ico {
  flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: var(--r-md); color: var(--accent-2); background: var(--amber-a12);
}
.wbcard__ico svg { width: 24px; height: 24px; }
.wbcard__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wbcard__t { font-weight: 700; font-size: 15.5px; }
.wbcard__s { font-size: 12.5px; color: var(--ink-faint-card); line-height: 1.35; }
.wbcard__chev { flex: 0 0 auto; width: 18px; height: 18px; color: var(--ink-faint); }
.wbcard__chev svg { width: 18px; height: 18px; }

/* Дропзона SKU */
.wb-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 16px; border-radius: var(--r-lg); text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); background: var(--surface);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.wb-drop:hover { border-color: var(--accent); background: var(--surface-2); }
.wb-drop__ico { font-size: 22px; color: var(--accent-2); display: grid; place-items: center; }
.wb-drop__ico svg { width: 26px; height: 26px; }
.wb-drop__t { font-weight: 700; font-size: 15px; }
.wb-drop .cap { max-width: 260px; }
.wb-drop--has { position: relative; padding: 0; border-style: solid; overflow: hidden; }
.wb-drop--has img { display: block; width: 100%; max-height: 300px; object-fit: contain; }
.wb-drop__del {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px;
  border-radius: var(--r-pill); border: none; cursor: pointer;
  background: rgba(10,10,11,0.72); color: var(--ink); font-size: 14px;
}

/* Цвета бренда */
.wb-colors { display: flex; gap: 12px; }
.wb-color {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-dim); cursor: pointer;
}
.wb-color input { width: 34px; height: 34px; padding: 0; border: none; border-radius: var(--r-xs); background: none; cursor: pointer; }

/* Переключатель «быстро и дешевле» */
.wb-switch {
  flex: 0 0 auto; width: 44px; height: 26px; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--line-strong); position: relative;
  transition: background .2s var(--ease);
}
.wb-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--ink-dim); transition: transform .2s var(--ease), background .2s var(--ease);
}
.wb-switch.is-on { background: var(--amber-a35); border-color: var(--accent); }
.wb-switch.is-on::after { transform: translateX(18px); background: var(--accent-2); }

/* Прогресс конвейера */
.wb-run { display: flex; flex-direction: column; gap: 18px; }
.wb-progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.wb-progress__bar {
  height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .6s var(--ease);
}
.wb-steps { display: flex; align-items: flex-start; justify-content: space-between; gap: 2px; }
.wb-step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.wb-step__dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; color: var(--ink-faint);
  background: var(--surface-2); border: 1px solid var(--line);
}
.wb-step__label { font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.wb-step.is-done .wb-step__dot { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.wb-step.is-done .wb-step__label { color: var(--ink-dim); }
.wb-step.is-cur .wb-step__dot {
  color: var(--accent-2); background: var(--amber-a12); border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--amber-a12); animation: wb-pulse 1.6s var(--ease) infinite;
}
.wb-step.is-cur .wb-step__label { color: var(--accent-soft); }
.wb-steps__sep { flex: 0 0 6px; height: 1px; margin-top: 15px; background: var(--line-strong); }
@keyframes wb-pulse { 0%,100% { box-shadow: 0 0 0 3px var(--amber-a12); } 50% { box-shadow: 0 0 0 7px var(--amber-a05); } }
.wb-run__hint { text-align: center; }

/* Галерея слайдов */
.wb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wb-slide { margin: 0; border-radius: var(--r-md); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.wb-slide img { display: block; width: 100%; height: auto; }
.wb-slide__cap {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 10px; font-size: 11.5px; color: var(--ink-dim);
}
.wb-qc { flex: 0 0 auto; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-pill); }
.wb-qc--ok { color: var(--good); background: rgba(94,224,138,0.12); }
.wb-qc--warn { color: var(--accent-soft); background: var(--amber-a12); }
.wb-qc--bad { color: var(--bad); background: rgba(255,98,89,0.12); }
.wb-verdict {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 14px; border-radius: var(--r-md); font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--line);
}
.wb-verdict--pass { border-color: rgba(94,224,138,0.35); }
.wb-verdict--warning { border-color: var(--amber-a35); }
.wb-verdict--fail { border-color: rgba(255,98,89,0.35); }
.wb-verdict svg { width: 16px; height: 16px; flex: 0 0 auto; }
.wb-verdict--pass svg { color: var(--good); }
.wb-verdict--warning svg { color: var(--accent-2); }
.wb-verdict--fail svg { color: var(--bad); }

/* УТП-тексты (копируемые) */
.wb-copy { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.wb-copy__head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px 0; }
.wb-copy__t { font-size: 12px; font-weight: 700; color: var(--ink-faint-card); text-transform: uppercase; letter-spacing: 0.04em; }
.wb-copy__btn {
  border: none; cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--accent-2); background: none; padding: 2px 4px;
}
.wb-copy__pre {
  margin: 0; padding: 8px 12px 12px; white-space: pre-wrap; word-break: break-word;
  font-family: inherit; font-size: 13.5px; line-height: 1.45; color: var(--ink);
}

/* Ошибка */
.wb-fail { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 28px 8px; }
.wb-fail__ico {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  font-size: 22px; color: var(--bad); background: rgba(255,98,89,0.12);
}
.wb-fail__t { font-weight: 700; font-size: 16px; }

.wb-zip { text-decoration: none; }

@media (min-width: 560px) {
  .wb-grid { grid-template-columns: 1fr 1fr 1fr; }
}


/* ════════════════════ SPEC-2026-10-08: image edit modes + video refs strip ════════════════════ */

/* Image sub-mode switch (Создание / Редактирование) — quieter sibling of .typeswitch */
.modeswitch { display: flex; gap: 4px; padding: 3px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.modeswitch__t {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 4px; border-radius: var(--r-pill);
  font-family: var(--ff-body); font-weight: 600; font-size: 12px; color: var(--ink-dim);
  transition: all .2s var(--ease); min-width: 0;
}
.modeswitch__t svg { width: 15px; height: 15px; flex: 0 0 auto; }
.modeswitch__t span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modeswitch__t:active { transform: scale(0.96); }
.modeswitch__t.is-active {
  color: var(--accent-2);
  background: var(--amber-a12);
  border: 1px solid var(--amber-a50);
}

/* Erase-mode badge row (replaces the old op tabs): way back + status chip */
.editbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.editbar__back {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-dim);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 7px 12px;
  transition: color .2s, border-color .2s;
}
.editbar__back svg { width: 13px; height: 13px; flex: 0 0 auto; }
.editbar__back:hover { color: var(--ink); border-color: var(--line-strong); }
.editbar__t {
  display: inline-flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0;
  font-size: 12px; font-weight: 700; color: var(--ink);
}
.editbar__t svg { width: 14px; height: 14px; color: var(--accent-2); flex: 0 0 auto; }
.editbar__t span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editbar__chip {
  font: inherit; font-family: var(--ff-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; cursor: pointer;
  color: var(--ink); background: rgba(10,10,13,0.66); border: 1px solid var(--line-strong);
  border-radius: var(--r-pill); padding: 7px 11px;
  transition: border-color .2s, color .2s;
}
.editbar__chip:hover { border-color: var(--amber-a50); }
.editbar__chip.is-set { color: var(--accent-2); border-color: var(--amber-a50); }
.editbar__back:disabled, .editbar__chip:disabled { opacity: 0.45; pointer-events: none; }

/* Hero upload frame (image edit source) */
.editup {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 4 / 3; min-height: 190px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--amber-a50); border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--amber-a12), var(--amber-a05));
  box-shadow: 0 8px 24px -16px var(--accent-glow);
  transition: border-color .2s, background .2s, transform .12s;
}
.editup:hover { background: linear-gradient(135deg, var(--amber-a18), var(--amber-a05)); }
.editup:active { transform: scale(0.99); }
.editup__ico { font-size: 34px; margin-bottom: 8px; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3)); }
.editup__ico svg { width: 34px; height: 34px; }
.editup__t { font-weight: 700; font-size: 15px; color: var(--ink); }
.editup__s { font-size: 12px; color: var(--ink-dim); margin-top: 5px; padding: 0 14px; }
.editup--has { position: relative; display: block; cursor: default; aspect-ratio: auto; min-height: 0; padding: 0; overflow: hidden; }
.editup--has .editup__img { display: block; width: 100%; max-height: 46vh; object-fit: contain; background: #0A0A0B; }
/* Saved-mask overlay: the exported PNG (white = edit zone) layered over the
   source preview so the selection stays visible after the editor closes.
   Same box rules as .editup__img → pixel-perfect alignment. */
.editup__maskov {
  position: absolute; inset: 0; width: 100%; max-height: 46vh; object-fit: contain;
  opacity: 0.45; mix-blend-mode: screen; pointer-events: none;
}
.editup__maskchip {
  position: absolute; top: 10px; left: 10px; z-index: 2; cursor: pointer;
  font-family: var(--ff-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--ink); background: rgba(10,10,13,0.66); border: 1px solid var(--amber-a50);
  border-radius: var(--r-pill); padding: 6px 11px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.editup__tools {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding: 26px 10px 12px;
  background: linear-gradient(0deg, rgba(6,10,22,0.88), transparent);
}
.editup__tool {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: var(--ink); background: rgba(10,10,13,0.6); border: 1px solid var(--line-strong);
  border-radius: var(--r-pill); padding: 8px 14px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: border-color .2s, background .2s, transform .12s;
}
.editup__tool:hover { border-color: var(--amber-a50); }
.editup__tool:active { transform: scale(0.95); }
.editup__tool.is-accent { color: var(--accent-2); border-color: var(--amber-a50); background: var(--amber-a12); }
.editup__tool--danger { color: var(--bad); border-color: rgba(255,98,89,0.35); }
.editup__tool:disabled { opacity: 0.45; pointer-events: none; }
/* tool carrying a leading icon («Удалить объект» — ластик) */
.editup__tool--ico { display: inline-flex; align-items: center; gap: 6px; }
.editup__tool--ico svg { width: 14px; height: 14px; flex: 0 0 auto; }
/* empty state = drop-zone + the standalone «Удалить объект» entry below it */
.editup__empty { display: flex; flex-direction: column; }
.editup__alt { display: flex; justify-content: center; margin-top: 10px; }
/* in-place generation: dim the source, spinner + caption on top, tools off */
.editup__busy {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(6, 8, 14, 0.66);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  font-weight: 700; font-size: 13.5px; color: var(--ink);
}
.editup__busy .loader { border-color: rgba(242, 244, 248, 0.25); border-top-color: var(--accent-2); }
.editup--has.is-busy .editup__tools { pointer-events: none; opacity: 0.45; }
.editup--has.is-busy .editup__maskchip { display: none; }

/* Video refs strip (#ctorRefs) */
.refcards { display: flex; flex-direction: column; gap: 12px; }
.refcard {
  padding: 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  transition: opacity .2s;
}
.refcard.is-blocked { opacity: 0.55; }
.refcard__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.refcard__ico svg { width: 16px; height: 16px; display: block; }
.refcard__t { font-weight: 700; font-size: 13px; color: var(--ink); flex: 1 1 auto; }
.refcard__cnt { font-family: var(--ff-mono); font-size: 11px; color: var(--ink-faint); }
.refcard__why { margin-top: 10px; font-size: 12px; color: var(--ink-dim); line-height: 1.45; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.refcard__fix {
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--accent-2); background: var(--amber-a12); border: 1px solid var(--amber-a50);
  border-radius: var(--r-pill); padding: 7px 12px;
}

/* Keyframe slots */
.refslots { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.refslot {
  position: relative; width: calc(50% - 5px); aspect-ratio: 4 / 3;
  border-radius: var(--r-sm); overflow: hidden; background: var(--surface-3);
  border: 1.5px dashed var(--line-strong);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer; transition: border-color .2s, background .2s, transform .12s;
}
.refslot:hover { border-color: var(--amber-a50); background: var(--amber-a05); }
.refslot:active { transform: scale(0.98); }
.refslot__plus { font-size: 22px; font-weight: 700; color: var(--ink-faint); line-height: 1; }
.refslot__lbl { font-size: 11px; color: var(--ink-dim); text-align: center; padding: 0 6px; }
.refslot--has { border-style: solid; border-color: var(--line-strong); cursor: default; }
.refslot--has img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.refslot__tag {
  position: absolute; bottom: 6px; left: 6px; z-index: 2;
  font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink); background: rgba(10,10,13,0.66); border-radius: var(--r-pill); padding: 3px 8px;
}
.refslot.is-locked { cursor: not-allowed; border-style: solid; opacity: 0.45; }
.refslot.is-blocked { cursor: not-allowed; opacity: 0.45; }
.refslot__swap {
  flex: 1 1 100%; font: inherit; font-size: 12px; font-weight: 600; color: var(--accent-2);
  background: var(--amber-a08); border: 1px solid var(--amber-a25); border-radius: var(--r-sm);
  padding: 8px; cursor: pointer; transition: background .2s;
}
.refslot__swap:hover { background: var(--amber-a12); }

/* Thumb grid (image references) */
.refthumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.refth { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-3); }
.refth img { width: 100%; height: 100%; object-fit: cover; display: block; }
.refth__del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff; display: grid; place-items: center; font-size: 13px; line-height: 1;
}
.refth__del--flat { position: static; width: 26px; height: 26px; flex: 0 0 auto; background: var(--surface-3); color: var(--ink-dim); border: 1px solid var(--line); }
.refth--add {
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); color: var(--ink-faint); font-size: 22px; font-weight: 700;
  transition: border-color .2s, background .2s;
}
.refth--add:hover { border-color: var(--amber-a50); background: var(--amber-a05); }

/* Unified «Референсы» card (video ctor): one chip flow for every kind */
.refchips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.refchip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 34px; max-width: 100%; padding: 4px 5px 4px 10px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-dim);
  font-size: 12px; line-height: 1.25;
}
.refchip__ico { display: inline-flex; flex: 0 0 auto; color: var(--ink-faint); }
.refchip__ico svg { width: 14px; height: 14px; display: block; }
.refchip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(44vw, 240px); }
.refchip__tag {
  flex: 0 0 auto; font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-faint);
}
.refchip__del {
  flex: 0 0 auto; width: 21px; height: 21px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--line);
  color: var(--ink-dim); font-size: 12px; line-height: 1;
  transition: color .18s, background .18s, border-color .18s;
}
.refchip__del:hover { color: var(--accent-2); background: var(--amber-a12); border-color: var(--amber-a25); }
/* image chip: the data URI itself is the icon — tiny rounded thumb */
.refchip--img { padding: 3px 4px 3px 3px; gap: 6px; }
.refchip--img img { width: 27px; height: 27px; border-radius: var(--r-sm); object-fit: cover; display: block; }
/* audio chip: amber tint + play/stop toggle (no progress bar) */
.refchip--aud { background: var(--amber-a08); border-color: var(--amber-a25); color: var(--ink); }
.refchip__play {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; padding: 0; margin-left: 2px;
  display: grid; place-items: center; cursor: pointer;
  background: var(--amber-a18); border: 1px solid var(--amber-a25); color: var(--accent-2);
  transition: background .18s, color .18s, border-color .18s;
}
.refchip__play:hover { background: var(--amber-a25); }
.refchip__pico { width: 11px; height: 11px; display: block; }
.refchip__pico--stop { display: none; }
.refchip--aud.is-playing .refchip__pico { display: none; }
.refchip--aud.is-playing .refchip__pico--stop { display: block; }
.refchip--aud.is-playing .refchip__play { background: var(--accent-2); border-color: transparent; color: var(--on-accent); }

/* Single add zone + gallery source inside the chip flow */
.refadd {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 4px 13px; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-pill);
  color: var(--ink-dim); font-size: 12.5px; font-weight: 600;
  transition: border-color .2s, background .2s, color .2s;
}
.refadd:hover { border-color: var(--amber-a50); background: var(--amber-a05); }
.refadd__plus { font-size: 15px; font-weight: 700; color: var(--ink-faint); line-height: 1; }
.refadd--gal { border-style: solid; border-width: 1px; background: var(--surface-2); }
.refadd--gal:hover { color: var(--accent-2); }

/* Video reference card (image constructor keeps the per-type cards) */
.refvid { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.refvid video { display: block; width: 100%; max-height: 220px; background: #000; }
.refvid__row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.refvid__name { flex: 1 1 auto; font-size: 12px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.refvid--add {
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); color: var(--ink-dim);
  font-size: 12.5px; font-weight: 600; padding: 14px 10px; margin-top: 8px;
  transition: border-color .2s, background .2s;
}
.refvid--add:hover { border-color: var(--amber-a50); background: var(--amber-a05); }
.refvid__plus { font-size: 18px; font-weight: 700; color: var(--ink-faint); line-height: 1; }
.refcard .refvid + .refvid { margin-top: 8px; }

/* ── «Из галереи» secondary source on every upload zone ── */
/* Interactive span inside a <label>: HTML spec keeps label activation off
   interactive descendants, so the tap reaches only the gallery picker. */
.refslot__gal, .editup__gal {
  display: inline-block; font-size: 11px; font-weight: 600; cursor: pointer;
  color: var(--accent-2); background: var(--amber-a12); border: 1px solid var(--amber-a25);
  border-radius: var(--r-pill); padding: 5px 10px; margin-top: 4px;
  transition: background .2s, border-color .2s;
}
.refslot__gal:hover, .editup__gal:hover { background: var(--amber-a18); border-color: var(--amber-a50); }
.editup__gal { margin-top: 10px; }
/* Gallery tile in the image thumb grid (sits next to the «+» upload tile) */
.refth--gal {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer; color: var(--ink-faint);
}
.refth__galico svg { width: 20px; height: 20px; display: block; }
.refth__galtxt { font-size: 9.5px; font-weight: 700; letter-spacing: 0.03em; }
.refth--gal:hover { color: var(--accent-2); }
/* Button twin of the dashed video/audio upload rows */
.refgal-btn { font: inherit; }
.refgal-btn__ico { display: inline-flex; }
.refgal-btn__ico svg { width: 16px; height: 16px; display: block; }
.refgal-btn:hover { border-color: var(--amber-a50); color: var(--accent-2); }

/* Gallery picker sheet (grid of finished generations) */
/* Type tabs of the mixed picker (unified «Референсы» source) */
.galtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.galtabs__t {
  flex: 1 1 0; min-width: 0; padding: 9px 10px; border-radius: var(--r-pill); cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-dim);
  background: var(--surface); border: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .18s, background .18s, border-color .18s;
}
.galtabs__t:active { transform: scale(0.96); }
.galtabs__t.is-active {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent;
  box-shadow: 0 6px 18px -10px var(--accent-glow);
}
.galgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.galtile {
  position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-3);
  font: inherit; transition: transform .12s var(--ease), border-color .2s;
}
.galtile:hover { border-color: var(--amber-a50); }
.galtile:active { transform: scale(0.97); }
.galtile img, .galtile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.galtile__play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -58%);
  width: 34px; height: 34px; display: grid; place-items: center; color: #fff;
  background: rgba(10,10,13,0.62); border-radius: 50%; pointer-events: none;
}
.galtile__play svg { width: 18px; height: 18px; }
.galtile__aud {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-dim);
  background: linear-gradient(140deg, var(--amber-a08), transparent 70%);
}
.galtile__aud svg { width: 26px; height: 26px; }
.galtile__name {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: block;
  padding: 16px 6px 5px; font-size: 10px; line-height: 1.3; color: var(--ink); text-align: left;
  background: linear-gradient(0deg, rgba(6,10,22,0.86), transparent);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Mask editor overlay */
.maskwrap {
  position: fixed; inset: 0; z-index: 96;
  background: rgba(4, 6, 11, 0.97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  padding: 10px 10px 14px;
  opacity: 0; transition: opacity .22s var(--ease);
}
.maskwrap[hidden] { display: none; }
.maskwrap.is-shown { opacity: 1; }
.maskwrap__topbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 12px 12px;
}
.maskwrap__title { font-family: var(--ff-display); font-weight: 700; font-size: 15px; color: var(--ink); }
.maskwrap__stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 4px 0; }
.maskwrap__frame { position: relative; display: inline-block; max-width: 100%; max-height: 100%; line-height: 0; }
#maskImg { max-width: 100%; max-height: 62vh; object-fit: contain; border-radius: var(--r-md); user-select: none; -webkit-user-drag: none; }
#maskCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; border-radius: var(--r-md); }
.maskwrap__bar {
  flex: 0 0 auto; width: 100%; max-width: 640px; margin: 0 auto;
  padding: 12px 6px max(6px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
.maskwrap__brush { display: flex; align-items: center; gap: 10px; }
.maskwrap__brush-lbl { font-size: 12px; color: var(--ink-dim); flex: 0 0 auto; }
.maskwrap__brush input[type="range"] { flex: 1 1 auto; }
#maskBrushVal { font-size: 12px; color: var(--ink-dim); min-width: 22px; text-align: right; }
.maskwrap__actions { display: flex; gap: 8px; }
.maskwrap__actions .btn { flex: 1 1 0; padding: 11px 8px; font-size: 13px; }

/* ============================================================
   Экран чат-агента (SPEC-CHAT-AGENT)
   ============================================================ */
.chat { min-height: 100%; display: flex; flex-direction: column; }

/* Экран-приветствие пустого чата */
.chat__hero { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px 8px; gap: 12px; }
.chat__hero-mark { width: 58px; height: 58px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--amber-a08); border: 1px solid var(--line-strong); color: var(--accent); }
.chat__hero-mark svg { width: 30px; height: 30px; }
.chat__hero-t { font-family: var(--ff-display); font-weight: 800; font-size: 20px; letter-spacing: 0.01em; }
.chat__hero-s { max-width: 340px; font-size: 13.5px; line-height: 1.55; color: var(--ink-dim); }
.chat__chips { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; width: 100%; max-width: 340px; }
.chat__chip { text-align: left; padding: 11px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 13.5px; transition: border-color .18s var(--ease), background .18s var(--ease); }
.chat__chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chat__chip::before { content: "→ "; color: var(--accent); }

/* Лента сообщений */
.chat__list { display: flex; flex-direction: column; gap: 12px; padding: 6px 0 18px; }
.chat__msg { display: flex; flex-direction: column; max-width: 92%; }
.chat__msg--user { align-self: flex-end; align-items: flex-end; }
.chat__msg--ai { align-self: flex-start; }
.chat__msg--tool { align-self: stretch; max-width: 100%; }
.chat__bubble { padding: 10px 14px; border-radius: var(--r-md) var(--r-md) var(--r-md) var(--r-xs); background: var(--surface-2); border: 1px solid var(--line); font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.chat__msg--user .chat__bubble { border-radius: var(--r-md) var(--r-md) var(--r-xs) var(--r-md); background: var(--amber-a08); border-color: rgba(245, 180, 0, 0.22); }
.chat__bubble--ai { background: var(--surface); }
.chat__bubble a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
.chat__bubble code { font-family: var(--ff-mono); font-size: 12.5px; background: rgba(216, 222, 232, 0.09); padding: 1px 5px; border-radius: 6px; }
.chat__err { margin-top: 6px; font-size: 12.5px; color: var(--bad); }

/* Чат-markdown */
.chat-md-p { margin: 2px 0; }
.chat-md-h { margin: 10px 0 4px; font-family: var(--ff-display); font-weight: 700; font-size: 14.5px; }
.chat-md-h--big { font-size: 16px; }
.chat-md-list { margin: 4px 0; padding-left: 4px; }
.chat-md-li { position: relative; padding-left: 14px; margin: 3px 0; }
.chat-md-li::before { content: "•"; position: absolute; left: 2px; color: var(--accent); }

/* Вложения сообщений */
.chat__atts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.chat__att img { width: 92px; height: 92px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line-strong); }

/* Вложение-документ: чип с бейджем расширения, клик — скачать */
.chat__att--doc { display: flex; align-items: center; gap: 8px; max-width: min(260px, 100%); padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); text-decoration: none; }
.chat__att--doc:hover { border-color: var(--accent); }
.chat__docbadge { flex: none; font-family: var(--ff-mono); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); border-radius: var(--r-pill); padding: 3px 7px; }
.chat__docname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 12px; }

/* Ожидание ответа модели */
.chat__dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.chat__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); animation: chat-dot 1.2s infinite ease-in-out; }
.chat__dots i:nth-child(2) { animation-delay: .18s; }
.chat__dots i:nth-child(3) { animation-delay: .36s; }
@keyframes chat-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Карточка инструмента (tool call) */
.chat__tool { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat__tool--err { border-color: rgba(255, 98, 89, 0.35); }
.chat__tool-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.chat__tool-ico { color: var(--accent); display: grid; place-items: center; }
.chat__tool-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: chat-rot .8s linear infinite; margin-left: auto; }
@keyframes chat-rot { to { transform: rotate(360deg); } }
.chat__tool-body { display: flex; flex-direction: column; gap: 6px; }
.chat__tool-body--err { font-size: 12.5px; color: var(--bad); }
.chat__tool-note { font-size: 12px; color: var(--ink-faint); }
.chat__tool-quote { font-size: 13px; color: var(--ink-dim); border-left: 2px solid var(--accent); padding: 2px 0 2px 10px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat__gen-wait { font-size: 12.5px; color: var(--ink-dim); }
.chat__gen-media { max-width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line-strong); display: block; }
.chat__gen-cover { width: 132px; height: 132px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line-strong); }
.chat__gen-audio { width: 100%; }

/* Композер (ввод сообщения) */
.chatbar { display: flex; flex-direction: column; gap: 8px; }
.chatbar--gated { align-items: stretch; padding-top: 4px; }
.chatbar__gated-note { font-size: 13px; color: var(--ink-dim); text-align: center; padding: 4px 0 8px; }
.chatbar__strip { display: flex; gap: 8px; flex-wrap: wrap; }
.chatstrip__item { position: relative; }
.chatstrip__item img { width: 54px; height: 54px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line-strong); opacity: .55; animation: chat-pulse 1.2s ease-in-out infinite; }
.chatstrip__item img[src*="/api/web/chat/"] { opacity: 1; animation: none; }
@keyframes chat-pulse { 50% { opacity: .25; } }
.chatstrip__rm { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-solid-2); border: 1px solid var(--line-strong); color: var(--ink); font-size: 14px; line-height: 1; display: grid; place-items: center; cursor: pointer; box-shadow: 0 3px 10px -3px rgba(0,0,0,0.7); }
.chatbar__row { display: flex; align-items: flex-end; gap: 8px; padding: 6px; border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(20,20,24,0.85), rgba(10,10,12,0.92)); border: 1px solid var(--line-strong); box-shadow: 0 1px 0 rgba(216,222,232,0.08) inset, 0 14px 40px -18px rgba(0,0,0,0.8); }
.chatbar__clip, .chatbar__send { flex: 0 0 auto; width: 44px; height: 44px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--ink-dim); transition: color .15s var(--ease), background .15s var(--ease); cursor: pointer; }
.chatbar__clip svg, .chatbar__send svg { width: 21px; height: 21px; }
.chatbar__clip:hover { color: var(--ink); background: var(--surface); }
.chatbar__send { color: var(--on-accent); background: var(--accent); }
.chatbar__send:disabled { opacity: .45; cursor: default; }
.chatbar__send:not(:disabled):active { transform: scale(0.92); }
.chatbar__ta { flex: 1 1 auto; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14.5px; line-height: 1.45; max-height: 140px; padding: 9px 2px; }
.chatbar__ta::placeholder { color: var(--ink-faint); }

/* Плитка чата на главной */
.wbcard__ico--chat { color: var(--accent); }
.chatstrip__ph { display: block; width: 54px; height: 54px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); animation: chat-pulse 1.2s ease-in-out infinite; }

/* Документ в полосе вложений: чип той же высоты, что миниатюры (54px) */
.chatstrip__doc { display: flex; align-items: center; gap: 7px; height: 54px; min-width: 0; max-width: 190px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); box-sizing: border-box; }
.chatstrip__doc--wait { animation: chat-pulse 1.2s ease-in-out infinite; }
.chatstrip__docbadge { flex: none; font-family: var(--ff-mono); font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); border-radius: var(--r-pill); padding: 2px 6px; }
.chatstrip__docname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--ink); }
/* Аватар-инициал справа в appbar */
.appbar__avatar { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--ff-display); font-weight: 800; font-size: 14.5px; color: var(--on-accent); background: linear-gradient(135deg, var(--accent-2), var(--accent)); border: 1px solid rgba(245, 180, 0, 0.55); box-shadow: 0 2px 10px -2px var(--accent-glow); transition: transform .12s; }
.appbar__avatar:active { transform: scale(0.92); }
/* Карточка предложения генерации (propose_generation) */
.chat__tool--proposal { border-color: rgba(245, 180, 0, 0.28); }
.chat__tool-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat__chip-param { font-size: 11.5px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-dim); white-space: nowrap; }
.chat__proposal-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 2px; }
.chat__proposal-go { padding: 10px 16px; font-size: 13.5px; }
.chat__proposal-go:disabled { opacity: .6; }

.appbar__burger { flex: 0 0 auto; width: 44px; height: 44px; margin: -4px 0 -4px -10px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--ink); transition: color .15s var(--ease), background .15s var(--ease); }
.appbar__burger svg { width: 22px; height: 22px; }
.appbar__burger:hover { color: var(--ink); background: var(--surface); }
.appbar__burger:active { transform: scale(0.92); }
.appbar__title--chat { font-family: var(--ff-display); font-weight: 700; font-size: 15.5px; color: var(--ink); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* drawer диалогов: «+ Новый диалог» + история */
.chatsveil { position: absolute; inset: 0; z-index: 80; background: rgba(5,8,16,0.6); backdrop-filter: blur(3px); opacity: 0; transition: opacity .28s var(--ease); }
.chatsveil[hidden] { display: none; }
.chatsveil.is-shown { opacity: 1; }
.chatsdrawer {
  position: absolute; inset: 0 auto 0 0; z-index: 81;
  width: min(84vw, 320px);
  display: flex; flex-direction: column;
  padding: max(12px, env(safe-area-inset-top, 0px)) 10px max(12px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(17,17,21,0.97) 0%, rgba(10,10,13,0.99) 100%);
  border-right: 1px solid var(--line-strong);
  box-shadow: 24px 0 60px -30px rgba(0,0,0,0.85);
  transform: translateX(-102%);
  transition: transform .32s var(--ease-out);
}
.chatsdrawer[hidden] { display: none; }
.chatsdrawer.is-open { transform: translateX(0); }
.chatsdrawer__head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.chatsdrawer__title { font-family: var(--ff-display); font-weight: 800; font-size: 17px; letter-spacing: 0.01em; }
.chatsdrawer__close { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--ink-dim); transition: color .15s var(--ease), background .15s var(--ease); }
.chatsdrawer__close svg { width: 19px; height: 19px; }
.chatsdrawer__close:hover { color: var(--ink); background: var(--surface); }
.chatsdrawer__new {
  flex: 0 0 auto; display: flex; align-items: center; gap: 9px;
  min-height: 48px; padding: 0 14px; margin: 0 2px 10px;
  border-radius: var(--r-md); font-family: var(--ff-display); font-weight: 700; font-size: 14.5px;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent) 100%);
  border: 1px solid rgba(216,222,232,0.5);
  box-shadow: 0 8px 22px -12px var(--accent-glow);
  transition: transform .12s;
}
.chatsdrawer__new svg { width: 18px; height: 18px; }
.chatsdrawer__new:active { transform: scale(0.97); }
.chatsdrawer__list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; padding-right: 2px; }
.chatsdrawer__loading { display: grid; place-items: center; padding: 30px 0; }
.chatsdrawer__empty { padding: 22px 10px; font-size: 13px; line-height: 1.55; color: var(--ink-dim); text-align: center; }
.chatsdrawer__group { flex: 0 0 auto; padding: 12px 12px 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.chatsdrawer__item {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; text-align: left;
  min-height: 56px; justify-content: center;
  padding: 8px 12px; border-radius: var(--r-md);
  transition: background .15s var(--ease);
}
.chatsdrawer__item:hover { background: var(--surface); }
.chatsdrawer__item.is-active { background: linear-gradient(135deg, var(--amber-a12), var(--amber-a05)); box-shadow: inset 2px 0 0 var(--accent); }
.chatsdrawer__item-title { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatsdrawer__item.is-active .chatsdrawer__item-title { color: var(--accent-2); }
.chatsdrawer__item-meta { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Кнопка «в конец диалога» — липнет к низу ленты */
.chat__jump { position: sticky; bottom: 10px; z-index: 6; margin-top: -46px; align-self: flex-end; width: 42px; height: 42px; margin-right: 4px; border-radius: 50%; display: grid; place-items: center; color: var(--on-accent); background: var(--accent); border: 1px solid rgba(245, 180, 0, 0.55); box-shadow: 0 6px 18px -6px var(--accent-glow); cursor: pointer; }
.chat__jump svg { width: 20px; height: 20px; }
.chat__jump:active { transform: scale(0.92); }
.chat__jump[hidden] { display: none; }
/* file input offscreen (не display:none: в некоторых webview не
   срабатывает .click() на input без размеров) */
.visually-hidden-input { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* Бейдж «из галереи» на вложении */
.chatstrip__gal { position: absolute; left: 4px; bottom: 4px; font-size: 9px; font-weight: 700; letter-spacing: .02em; color: var(--on-accent); background: var(--accent); border-radius: var(--r-pill); padding: 1px 6px; }
/* лоадер загрузки диалога (блокирует ленту и композер) */
.chat__loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 0; color: var(--ink-dim); font-size: 13.5px; }
.chat__loading .loader { width: 26px; height: 26px; border-color: rgba(255,255,255,.18); border-top-color: var(--accent); }
.chatbar__clip:disabled { opacity: .45; cursor: default; }
