/* ==========================================================================
   PIAR · Подвкладки «Управление / API», ключи и примеры кода
   ========================================================================== */

.piar-subtabs-nav {
  display: flex !important;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.piar-subtabs-nav::-webkit-scrollbar { display: none; }
.piar-subtab-btn {
  border-radius: var(--r-m, 12px);
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: var(--fs-s, 0.86rem);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur, .2s) var(--ease, ease), color var(--dur, .2s) var(--ease, ease), border-color var(--dur, .2s) var(--ease, ease);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  white-space: nowrap;
  flex: none;
}
.piar-subtab-btn:hover { color: var(--ink); background: var(--surface-2); }
.piar-subtab-btn.active {
  background: var(--surface-2);
  color: var(--accent);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.piar-subtab-btn .icon { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* --- Контейнеры: категорически запрещаем распирать экран --- */
#piar-subpanel-api,
#piar-subpanel-api .settings-card,
#piar-subpanel-api .piar-stack,
#piar-subpanel-api .piar-quickstart,
#piar-subpanel-api .piar-key-card,
#piar-subpanel-api .piar-code-wrapper {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
#piar-subpanel-api .settings-card { overflow: hidden; }
#piar-subpanel-api .section-heading { min-width: 0; }

/* --- Блок «Base URL» --- */
.piar-baseurl {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-m, 10px);
  background: var(--surface-2);
}
.piar-baseurl code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  overflow-wrap: anywhere;
  user-select: all;
}
.piar-note {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: var(--r-l, 14px);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.piar-note-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  font-size: var(--fs-s);
  color: var(--ink-2);
}

/* --- Список ключей --- */
.piar-keys-list { display: grid; gap: 10px; min-width: 0; }
.piar-key-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-l, 14px);
  background: var(--surface-2);
  transition: border-color var(--dur, .2s) var(--ease, ease);
}
.piar-key-card:hover { border-color: var(--line-strong); }
.piar-key-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.piar-key-ident {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.piar-key-ico {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--accent);
}
.piar-key-ico .icon { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.piar-key-name {
  font-weight: 650;
  font-size: var(--fs-s);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.piar-key-value {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 6px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.piar-key-value code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all;
  -webkit-font-smoothing: antialiased;
}
.piar-key-value .icon-btn { flex: none; }
.piar-key-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: var(--fs-xs, 0.76rem);
  color: var(--ink-3);
  min-width: 0;
}
.piar-key-meta b { color: var(--ink-2); font-weight: 600; }
.piar-key-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.piar-key-actions .btn { flex: 1 1 auto; justify-content: center; min-width: 0; }
.piar-key-actions .btn .icon { width: 15px; height: 15px; }

/* --- Кнопки-иконки --- */
.piar-ico-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: color var(--dur, .2s) var(--ease, ease), background var(--dur, .2s) var(--ease, ease), border-color var(--dur, .2s) var(--ease, ease);
}
.piar-ico-btn:hover { color: var(--accent); border-color: var(--line-strong); background: var(--surface-2); }
.piar-ico-btn .icon { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.piar-ico-btn.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }

/* --- Быстрый старт: табы языков + код --- */
.piar-quickstart { display: grid; gap: 12px; }
.piar-quickstart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.piar-lang-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.piar-lang-tabs::-webkit-scrollbar { display: none; }
.piar-lang-tab {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: var(--fs-xs, 0.76rem);
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  transition: color var(--dur, .2s) var(--ease, ease), background var(--dur, .2s) var(--ease, ease);
}
.piar-lang-tab:hover { color: var(--ink); }
.piar-lang-tab.active { color: var(--accent); background: var(--surface); box-shadow: var(--shadow-xs); }

.piar-code-wrapper {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.piar-code-box {
  display: block;
  margin: 0;
  padding: 14px 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--surface-2, #18181d);
  border: 1px solid var(--line, #26262c);
  border-radius: 12px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: clamp(11.5px, 0.7rem + 0.25vw, 12.75px);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.01em;
  color: var(--ink, #f3f2ee);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  tab-size: 2;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-variant-ligatures: none;
}
.piar-code-box code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
}

/* --- Модальные окна API-ключей --- */
.piar-modal-card {
  width: min(460px, 100%);
  max-height: min(86dvh, 760px);
  overflow-y: auto;
}
.piar-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.piar-modal-head .piar-key-ico { width: 40px; height: 40px; border-radius: 12px; }
.piar-modal-head .piar-key-ico .icon { width: 20px; height: 20px; }
.piar-modal-head-text { min-width: 0; flex: 1; }
.piar-modal-head-text h3 { margin: 0; }
.piar-modal-head-text p { margin: 3px 0 0; font-size: var(--fs-s); line-height: 1.45; }
.piar-modal-close { margin-left: auto; }
.piar-field { display: grid; gap: 6px; }
.piar-field-label { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.piar-field input,
.piar-field select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-s);
  outline: none;
}
.piar-field input:focus,
.piar-field select:focus { border-color: var(--accent); }
.piar-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.piar-modal-actions .btn { flex: 1 1 auto; justify-content: center; }
.piar-key-reveal {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  min-width: 0;
}
.piar-key-reveal code {
  display: block;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all;
}
.piar-key-warning {
  display: flex;
  gap: 8px;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--ink-2);
}
.piar-key-warning .icon { flex: none; width: 16px; height: 16px; color: var(--warn); margin-top: 2px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ==========================================================================
   NEVERLOST SAVE / PIAR — Mini App · Design System 5.0 «Architectural Signal»
   Референс тёмной темы: neverLost.cyxap.top (Unbounded + Onest + JetBrains Mono,
   глубокий графит #09090b / #111114 / #18181d, медный сигнальный акцент #e56b38,
   архитектурная сетка, чёткие 1px границы, выверенная типографика).
   Четыре цветовые схемы: light · dark · orange · purple (единый data-theme).
   ========================================================================== */

@import url("fonts/fonts.css");

/* ---------- Fallback шрифты (self-hosted Inter Variable) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/InterVariable.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/InterVariable-Italic.woff2") format("woff2-variations");
}

/* ---------- Ярус 1: базовые токены ---------- */
:root {
  --font-display: "Unbounded", "Onest", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: "Onest", "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* Типографика — модульная шкала с плавным clamp */
  --fs-2xs: 0.68rem;
  --fs-xs: 0.76rem;
  --fs-s: 0.86rem;
  --fs-m: clamp(0.93rem, 0.9rem + 0.15vw, 0.98rem);
  --fs-l: clamp(1.05rem, 1rem + 0.28vw, 1.18rem);
  --fs-xl: clamp(1.26rem, 1.12rem + 0.7vw, 1.58rem);
  --fs-2xl: clamp(1.58rem, 1.32rem + 1.4vw, 2.25rem);

  /* Сетка и отступы */
  --sp-3xs: 0.25rem;
  --sp-2xs: 0.45rem;
  --sp-xs: 0.65rem;
  --sp-s: 0.95rem;
  --sp-m: 1.3rem;
  --sp-l: 1.75rem;
  --sp-xl: 2.4rem;
  --sp-2xl: 3.4rem;

  /* Форма — чёткая архитектурная геометрия */
  --r-xs: 6px;
  --r-s: 8px;
  --r-m: 10px;
  --r-l: 14px;
  --r-lg: 14px;
  --r-xl: 16px;
  --r-2xl: 20px;
  --r-round: 999px;

  /* Движение */
  --dur-fast: 120ms;
  --dur: 220ms;
  --dur-slow: 380ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Геометрия оболочки */
  --sidebar-w: 288px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}

/* ==========================================================================
   Ярус 2: семантические темы (light · dark · orange · purple)
   ========================================================================== */

/* ---------- Тема · Light (Editorial Swiss Paper & Cobalt) ---------- */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f3ef;
  --bg-2: #eae8e1;
  --surface: #ffffff;
  --surface-2: #f7f6f2;
  --surface-3: #eceae3;
  --line: #dcdad2;
  --line-strong: #c2bfb5;
  --ink: #111215;
  --ink-1: #111215;
  --ink-2: #3d4047;
  --ink-3: #666972;
  --accent: #0f56e8;
  --accent-rgb: 15, 86, 232;
  --accent-strong: #0a43bd;
  --accent-onsoft: #0a43bd;
  --accent-ink: #ffffff;
  --accent-soft: rgb(15 86 232 / 0.10);
  --accent-ring: rgb(15 86 232 / 0.36);
  --tone-plus: #0a7a5a;
  --tone-pro: #6444e0;
  --tone-ultra: #945808;
  --ok: #0a7239;
  --ok-soft: rgb(10 114 57 / 0.12);
  --warn: #8c5206;
  --warn-soft: rgb(140 82 6 / 0.13);
  --danger: #c42331;
  --danger-soft: rgb(196 35 49 / 0.10);
  --bg-fade: rgb(244 243 239 / 0.88);
  --grid-line: rgba(17, 18, 21, 0.028);
  --shadow-xs: 0 1px 2px rgb(17 18 21 / 0.05);
  --shadow-s: 0 1px 3px rgb(17 18 21 / 0.06), 0 8px 22px rgb(17 18 21 / 0.06);
  --shadow-m: 0 4px 12px rgb(17 18 21 / 0.08), 0 24px 56px rgb(17 18 21 / 0.14);
  --scrim: rgb(14 16 22 / 0.46);
  --aurora: radial-gradient(60% 48% at 88% -8%, rgb(15 86 232 / 0.09), transparent 70%);
  --donate-1: #e56b38;
  --donate-2: #c94e1c;
  --donate-ink: #ffffff;
  --heart: #e03558;
  --heart-soft: rgb(224 53 88 / 0.12);
  --star: #b8870e;
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23666972' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  --check-mark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'><path d='M1 4l2.6 2.6L9 1' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  --header-color: #f4f3ef;
}

/* ---------- Тема · Dark (Референс neverLost.cyxap.top: Graphite & Signal Copper) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --bg-2: #0d0d10;
  --surface: #111114;
  --surface-2: #18181d;
  --surface-3: #202027;
  --line: #26262c;
  --line-strong: #3e3e47;
  --ink: #f3f2ee;
  --ink-1: #f3f2ee;
  --ink-2: #b8b7b0;
  --ink-3: #8e8d86;
  --accent: #e56b38;
  --accent-rgb: 229, 107, 56;
  --accent-strong: #d15624;
  --accent-onsoft: #f58a5b;
  --accent-ink: #09090b;
  --accent-soft: rgb(229 107 56 / 0.15);
  --accent-ring: rgb(229 107 56 / 0.44);
  --tone-plus: #34d399;
  --tone-pro: #a78bfa;
  --tone-ultra: #f59e0b;
  --ok: #34d399;
  --ok-soft: rgb(52 211 153 / 0.14);
  --warn: #f59e0b;
  --warn-soft: rgb(245 158 11 / 0.15);
  --danger: #f87171;
  --danger-soft: rgb(248 113 113 / 0.14);
  --bg-fade: rgb(9 9 11 / 0.88);
  --grid-line: rgba(255, 255, 255, 0.02);
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.5);
  --shadow-s: 0 2px 6px rgb(0 0 0 / 0.45), 0 10px 26px rgb(0 0 0 / 0.38);
  --shadow-m: 0 4px 14px rgb(0 0 0 / 0.6), 0 28px 68px rgb(0 0 0 / 0.62);
  --scrim: rgb(3 3 5 / 0.68);
  --aurora: radial-gradient(60% 50% at 86% -8%, rgb(229 107 56 / 0.12), transparent 70%);
  --donate-1: #f07b49;
  --donate-2: #d15624;
  --donate-ink: #09090b;
  --heart: #fb7185;
  --heart-soft: rgb(251 113 133 / 0.15);
  --star: #fbbf24;
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238e8d86' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  --check-mark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'><path d='M1 4l2.6 2.6L9 1' fill='none' stroke='%2309090b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  --header-color: #09090b;
}

/* ---------- Тема · Orange (Warm Terracotta & Sand Studio) ---------- */
:root[data-theme="orange"] {
  color-scheme: light;
  --bg: #f8f1e7;
  --bg-2: #efe4d4;
  --surface: #fffcf7;
  --surface-2: #f6ecde;
  --surface-3: #ebdcc8;
  --line: #dfd0bc;
  --line-strong: #c8b296;
  --ink: #22160b;
  --ink-1: #22160b;
  --ink-2: #543d26;
  --ink-3: #78593a;
  --accent: #d44d12;
  --accent-rgb: 212, 77, 18;
  --accent-strong: #b03c09;
  --accent-onsoft: #a63707;
  --accent-ink: #ffffff;
  --accent-soft: rgb(212 77 18 / 0.12);
  --accent-ring: rgb(212 77 18 / 0.38);
  --tone-plus: #0c7a41;
  --tone-pro: #7a3fb0;
  --tone-ultra: #8c5806;
  --ok: #0a6b39;
  --ok-soft: rgb(10 107 57 / 0.12);
  --warn: #8a5206;
  --warn-soft: rgb(138 82 6 / 0.14);
  --danger: #b5370f;
  --danger-soft: rgb(181 55 15 / 0.11);
  --bg-fade: rgb(248 241 231 / 0.88);
  --grid-line: rgba(110, 66, 22, 0.032);
  --shadow-xs: 0 1px 2px rgb(74 44 14 / 0.06);
  --shadow-s: 0 1px 3px rgb(74 44 14 / 0.07), 0 8px 20px rgb(74 44 14 / 0.08);
  --shadow-m: 0 4px 12px rgb(74 44 14 / 0.09), 0 24px 54px rgb(74 44 14 / 0.16);
  --scrim: rgb(38 22 8 / 0.46);
  --aurora: radial-gradient(60% 48% at 86% -8%, rgb(212 77 18 / 0.11), transparent 70%);
  --donate-1: #e4570f;
  --donate-2: #a83b06;
  --donate-ink: #ffffff;
  --heart: #c73a2c;
  --heart-soft: rgb(199 58 44 / 0.13);
  --star: #b8860b;
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%2378593a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  --check-mark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'><path d='M1 4l2.6 2.6L9 1' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  --header-color: #f8f1e7;
}

/* ---------- Тема · Purple (Obsidian & Electric Violet) ---------- */
:root[data-theme="purple"] {
  color-scheme: dark;
  --bg: #0b0914;
  --bg-2: #110d1f;
  --surface: #141024;
  --surface-2: #1c1632;
  --surface-3: #251d42;
  --line: #292145;
  --line-strong: #403469;
  --ink: #f3f0fa;
  --ink-1: #f3f0fa;
  --ink-2: #c2b8dc;
  --ink-3: #8e83ab;
  --accent: #9d7aff;
  --accent-rgb: 157, 122, 255;
  --accent-strong: #8359fa;
  --accent-onsoft: #b49aff;
  --accent-ink: #0b0914;
  --accent-soft: rgb(157 122 255 / 0.15);
  --accent-ring: rgb(157 122 255 / 0.42);
  --tone-plus: #34d399;
  --tone-pro: #82aaff;
  --tone-ultra: #f59e0b;
  --ok: #34d399;
  --ok-soft: rgb(52 211 153 / 0.15);
  --warn: #f59e0b;
  --warn-soft: rgb(245 158 11 / 0.15);
  --danger: #fb7185;
  --danger-soft: rgb(251 113 133 / 0.14);
  --bg-fade: rgb(11 9 20 / 0.88);
  --grid-line: rgba(200, 180, 255, 0.024);
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.5);
  --shadow-s: 0 2px 6px rgb(0 0 0 / 0.48), 0 10px 26px rgb(0 0 0 / 0.4);
  --shadow-m: 0 4px 14px rgb(0 0 0 / 0.6), 0 28px 68px rgb(0 0 0 / 0.64);
  --scrim: rgb(4 2 10 / 0.66);
  --aurora: radial-gradient(60% 50% at 86% -8%, rgb(157 122 255 / 0.14), transparent 70%);
  --donate-1: #d8b4fe;
  --donate-2: #8b5cf6;
  --donate-ink: #0b0914;
  --heart: #fb7185;
  --heart-soft: rgb(251 113 133 / 0.15);
  --star: #fbbf24;
  --select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238e83ab' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  --check-mark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'><path d='M1 4l2.6 2.6L9 1' fill='none' stroke='%230b0914' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  --header-color: #0b0914;
}

/* ---------- Reset / база ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--line-strong) transparent;
  scroll-padding-top: calc(var(--safe-top) + 84px);
}
html, body { min-height: 100%; }
body {
  margin: 0;
  font: 400 var(--fs-m)/1.55 var(--font-sans);
  letter-spacing: -0.008em;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur-slow) var(--ease), color var(--dur-slow) var(--ease);
}
h1, h2, h3, h4, p, dl, dd, dt, ul, ol, blockquote, figure { margin: 0; min-width: 0; overflow-wrap: break-word; }
h1 {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 700;
}
h2 {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-weight: 600;
}
h3 {
  font-family: var(--font-display);
  font-size: var(--fs-l);
  line-height: 1.24;
  letter-spacing: -0.02em;
  font-weight: 600;
}
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  min-width: 0;
}
button { cursor: pointer; border: 0; background: none; padding: 0; font-weight: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
code, kbd { font-family: var(--font-mono); }
code {
  font-size: 0.88em;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 0.12em 0.42em;
  overflow-wrap: anywhere;
}
.mono { font-family: var(--font-mono); font-size: 0.92em; overflow-wrap: anywhere; }
.muted { color: var(--ink-3); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* Фокус: чёткое архитектурное кольцо */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ---------- Skip-link ---------- */
.skip-link {
  position: fixed;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-s);
  padding: 8px 16px; box-shadow: var(--shadow-m);
  font-family: var(--font-mono);
  font-size: var(--fs-xs); text-decoration: none; color: var(--ink);
  transition: top var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out);
}
.skip-link:focus-visible {
  top: calc(var(--safe-top) + 8px);
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Подложка: сигнальное свечение темы ---------- */
body::before {
  content: "";
  position: fixed; inset: 0;
  z-index: -1; pointer-events: none;
  background: var(--aurora);
}

.app-shell { position: relative; z-index: 1; min-height: var(--tg-stable-height, 100dvh); }

/* ==========================================================================
   Боковая навигация (Desktop >= 1024px)
   ========================================================================== */
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: var(--sp-s);
  padding: calc(var(--safe-top) + var(--sp-m)) var(--sp-m) calc(var(--safe-bottom) + var(--sp-m));
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.brand {
  display: inline-flex; align-items: center; gap: 11px;
  color: inherit; text-decoration: none; min-width: 0;
  padding: 4px 2px 10px;
  border-bottom: 1px solid var(--line);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  flex: none;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--r-s);
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--line-strong);
  font: 700 1rem/1 var(--font-display);
  letter-spacing: -0.02em;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.brand-copy { display: grid; gap: 2px; line-height: 1.15; min-width: 0; }
.brand-copy strong {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.brand-copy small {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.side-nav { display: grid; gap: 3px; margin-top: 2px; }
.side-tab {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-s);
  border: 1px solid transparent;
  color: var(--ink-2);
  font-size: var(--fs-s); font-weight: 560;
  text-align: left;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.side-tab .icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; flex: none; }
.side-tab kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.64rem; font-weight: 600; letter-spacing: 0.06em;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  background: var(--surface-2);
}
.side-tab:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}
.side-tab:active { transform: translateY(1px); }
.side-tab.active {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 640;
  box-shadow: inset 3px 0 0 var(--accent);
}
.side-tab.active .icon { color: var(--accent); }
.side-tab.active kbd {
  color: var(--accent);
  border-color: var(--accent-ring);
  background: var(--accent-soft);
}

.sidebar-plan {
  margin-top: auto;
  display: grid; gap: 6px;
  padding: 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
}
.sidebar-plan strong {
  font-family: var(--font-display);
  font-size: var(--fs-l);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "//";
  color: var(--ink-3);
  font-weight: 400;
}
.eyebrow.accent { color: var(--accent); }
.btn-sm { padding: 7px 14px; font-size: var(--fs-xs); min-height: 36px; }

.sidebar-footer { display: grid; gap: 8px; }
.side-support {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left; color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.side-support:hover { border-color: var(--line-strong); background: var(--surface-3); }
.support-heart {
  flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--r-s);
  background: var(--heart-soft);
  color: var(--heart);
  font-size: 1rem; line-height: 1;
}
.side-support strong { display: block; font-size: var(--fs-xs); font-weight: 650; }
.side-support small { display: block; color: var(--ink-3); font-size: var(--fs-2xs); }

/* ---------- Переключатель тем (4 сегмента: light · dark · orange · purple) ---------- */
.theme-seg {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.theme-seg button {
  display: grid; place-items: center; gap: 4px;
  padding: 7px 4px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  color: var(--ink-3);
  min-width: 0;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.theme-seg button:hover { color: var(--ink); background: var(--surface-3); }
.theme-seg button.active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: var(--shadow-xs);
}
.theme-seg button small {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-ico {
  display: grid; place-items: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
}
.theme-ico.light { background: linear-gradient(135deg, #f4f3ef 0 50%, #0f56e8 50% 100%); border-color: #0f56e8; }
.theme-ico.dark { background: linear-gradient(135deg, #09090b 0 52%, #e56b38 52% 100%); border-color: #e56b38; }
.theme-ico.orange { background: linear-gradient(135deg, #fffcf7 0 48%, #d44d12 48% 100%); border-color: #d44d12; }
.theme-ico.purple { background: linear-gradient(135deg, #0b0914 0 50%, #9d7aff 50% 100%); border-color: #9d7aff; }

/* ==========================================================================
   Контент / верхняя панель телеметрии
   ========================================================================== */
.content {
  min-height: 100vh;
  min-height: 100dvh;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding-inline: clamp(14px, 3vw, 44px);
}
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: var(--sp-m);
  margin-inline: calc(-1 * clamp(14px, 3vw, 44px));
  padding: calc(var(--safe-top) + 10px) clamp(14px, 3vw, 44px) 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar-brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-bottom: 0;
  padding: 0;
}
.topbar-brand .brand-mark { width: 34px; height: 34px; font-size: 0.88rem; border-radius: var(--r-xs); }
.topbar-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.live-pill {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-pill-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .topbar-brand { gap: 7px; }
  .topbar-brand .brand-mark { width: 30px; height: 30px; font-size: 0.8rem; }
  .topbar-brand .brand-copy strong { font-size: 0.72rem; letter-spacing: 0.03em; }
  .topbar-brand .brand-copy small { display: none; }
  .topbar-meta { gap: 5px; }
  .live-pill { padding: 5px 8px; gap: 5px; font-size: 0.62rem; letter-spacing: 0.01em; }
  .topbar .icon-btn { width: 36px; height: 36px; flex: 0 0 auto; }
}
.live-dot {
  flex: none;
  position: relative;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
}
.live-dot::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--ok);
  animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping {
  0% { transform: scale(1); opacity: .5; }
  70%, 100% { transform: scale(2.8); opacity: 0; }
}
.icon-btn {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--accent); background: var(--surface-2); }
.icon-btn .icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; }

/* ==========================================================================
   Страницы / табы
   ========================================================================== */
main { max-width: 1200px; width: 100%; min-width: 0; margin-inline: auto; padding-bottom: var(--sp-2xl); overflow-x: clip; }
main:focus-visible { outline: none; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-m);
  margin: var(--sp-xs) 0 var(--sp-m);
  padding-bottom: var(--sp-s);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.page-head h1 { margin-top: 6px; }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lead { font-size: var(--fs-m); color: var(--ink-2); max-width: 62ch; margin-top: 4px; }
.tab-panel { display: none; min-width: 0; max-width: 100%; }
.tab-panel:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-l);
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
  animation: panelIn var(--dur-slow) var(--ease-out) both;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Появление контента при прокрутке (только при включённых скриптах) */
.js .reveal { opacity: 0; transform: translateY(10px); }
.js .reveal.in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: calc(min(var(--i, 0), 6) * 50ms);
}

/* ---------- Notice / подсказки / пустые состояния ---------- */
.notice {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-l);
  border: 1px solid var(--accent-ring);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: var(--fs-s);
}
.notice .icon { flex: none; width: 18px; height: 18px; stroke: var(--accent); fill: none; stroke-width: 1.8; margin-top: 2px; }
.notice-compact { max-width: 340px; align-self: flex-end; margin-bottom: var(--sp-2xs); }
.hint { font-size: var(--fs-s); color: var(--ink-3); }
.empty-state {
  padding: 26px 18px;
  text-align: center;
  color: var(--ink-3);
  font-size: var(--fs-s);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-l);
  background: var(--surface-2);
}

/* ==========================================================================
   Карточки: архитектурная поверхность + 1px граница
   ========================================================================== */
.card, .plan-card, .checkout-card, .donate-card, .documents-card, .settings-card,
.stat-card, .broadcast-card, .start-block, .profile-card, .orders-card,
.shop-hero, .feature-card, .sidebar-plan, .section-block, .folders-card {
  position: relative;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.section-heading { display: grid; gap: 4px; margin-bottom: var(--sp-s); }
.section-heading h2, .section-heading h3 { font-size: var(--fs-l); }

/* ==========================================================================
   Главная (Desktop + Mobile)
   ========================================================================== */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--sp-m);
  align-items: stretch;
}
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }

/* Карточка плана */
.plan-card {
  border-color: var(--line-strong);
  overflow: hidden;
}
.plan-card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: var(--aurora);
  pointer-events: none;
}
.plan-card-body {
  position: relative;
  padding: clamp(18px, 2.5vw, 26px);
  display: grid; gap: var(--sp-s);
  height: 100%;
  align-content: space-between;
}
.plan-topline {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
}
.badge, .plan-current {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent-onsoft);
  border: 1px solid var(--accent-ring);
  white-space: nowrap;
}
.plan-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-s); }
.plan-title-row strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.03em;
}
.plan-subtitle { color: var(--ink-2); font-size: var(--fs-s); max-width: 46ch; margin-top: 4px; }
.plan-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px;
  padding: 12px 14px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.plan-meta strong, .stats-ribbon strong {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.meta-label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px;
}
.plan-progress {
  height: 6px;
  border-radius: var(--r-round);
  background: var(--surface-3);
  overflow: hidden;
}
.plan-progress span {
  display: block; height: 100%; width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--tone-pro));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.7s var(--ease-out);
}
.plan-features { display: grid; gap: 7px; font-size: var(--fs-s); color: var(--ink-2); }
.plan-features li {
  display: grid; grid-template-columns: auto 1fr; gap: 9px;
  align-items: start; min-width: 0; overflow-wrap: anywhere;
}
.plan-features li::before {
  content: "";
  width: 6px; height: 6px; margin-top: 7px; margin-left: 2px;
  border-radius: 1px;
  background: var(--accent);
}
.plan-features.compact { grid-template-columns: none; }
.plan-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* Быстрые переходы (архитектурная сетка 2x3 на ПК, стек на телефонах) */
.quick-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: stretch;
}
@media (max-width: 540px) {
  .quick-stack { grid-template-columns: 1fr; }
}
.quick-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left; color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.quick-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: var(--shadow-s);
  transform: translateY(-1px);
}
.quick-card:active { background: var(--surface-2); transform: none; }
.quick-icon {
  flex: none; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--r-s);
  background: var(--surface-2); color: var(--accent);
  border: 1px solid var(--line-strong);
}
.quick-icon .icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; }
.quick-card > span:nth-child(2) { min-width: 0; flex: 1; }
.quick-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-s);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.quick-card small { display: block; color: var(--ink-3); font-size: var(--fs-2xs); margin-top: 2px; }
.quick-arrow {
  margin-left: auto;
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: var(--fs-m);
  transition: translate var(--dur) var(--ease), color var(--dur) var(--ease);
}
.quick-card:hover .quick-arrow { translate: 3px 0; color: var(--accent); }

/* Лента статистики */
.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}
.stats-ribbon > div {
  min-width: 0;
  padding: 16px 20px;
  border-right: 1px solid var(--line);
}
.stats-ribbon > div:last-child { border-right: 0; }
.stats-ribbon strong { display: block; font-size: var(--fs-l); margin-top: 2px; }
.stats-ribbon small { display: block; color: var(--ink-3); font-size: var(--fs-xs); margin-top: 2px; }
@media (max-width: 700px) {
  .stats-ribbon { grid-template-columns: 1fr; }
  .stats-ribbon > div { border-right: 0; border-bottom: 1px solid var(--line); padding: 13px 16px; }
  .stats-ribbon > div:last-child { border-bottom: 0; }
}

/* Возможности */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-s);
}
@media (max-width: 1020px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card { padding: 18px; display: grid; gap: 7px; align-content: start; }
.feature-num { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--accent); font-weight: 600; letter-spacing: .12em; }
.feature-card h3 { font-size: var(--fs-m); }
.feature-card p { color: var(--ink-3); font-size: var(--fs-s); }

/* ==========================================================================
   Магазин
   ========================================================================== */
.fee-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-round);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-xs); color: var(--ink-2);
  box-shadow: var(--shadow-s);
}
.fee-badge span {
  font-weight: 720; letter-spacing: -.02em;
  background: var(--accent-soft);
  color: var(--accent-onsoft);
  border-radius: var(--r-round);
  padding: 2px 7px;
}
.shop-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-m);
  padding: clamp(18px, 3vw, 26px);
  overflow: hidden;
  flex-wrap: wrap;
}
.shop-hero strong { font-size: var(--fs-xl); letter-spacing: -.024em; }
.shop-kicker { display: block; margin-bottom: 6px; }
.shop-hero .muted { max-width: 52ch; font-size: var(--fs-s); }
.shop-hero-mark {
  flex: none;
  display: grid; place-items: center;
  width: 76px; height: 76px;
  border-radius: 22px;
  font-weight: 800; font-size: .95rem; letter-spacing: .02em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
}

/* Тарифы (рендерится shop.js) */
.plan-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-s);
}
@media (max-width: 980px) { .plan-list { grid-template-columns: 1fr; } }
.shop-plan {
  --tone: var(--accent);
  position: relative;
  display: grid; gap: var(--sp-s);
  align-content: start;
  padding: clamp(16px, 2.4vw, 22px);
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.shop-plan:hover { border-color: var(--line-strong); box-shadow: var(--shadow-s); }
.shop-plan.selected {
  border-color: color-mix(in srgb, var(--tone) 55%, transparent);
  box-shadow: var(--shadow-s), 0 0 0 3px color-mix(in srgb, var(--tone) 14%, transparent);
}
@supports not (color: color-mix(in srgb, red blue)) {
  .shop-plan.selected { border-color: var(--tone); }
}
.shop-plan-plus { --tone: var(--tone-plus); }
.shop-plan-pro { --tone: var(--tone-pro); }
.shop-plan-ultra { --tone: var(--tone-ultra); }
.shop-plan-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 26px;
}
.shop-plan-index { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--ink-3); letter-spacing: .12em; }
.plan-current {
  background: color-mix(in srgb, var(--tone) 13%, transparent);
  color: var(--tone);
  border: 1px solid color-mix(in srgb, var(--tone) 38%, transparent);
}
@supports not (color: color-mix(in srgb, red blue)) {
  .plan-current { background: var(--accent-soft); color: var(--accent-onsoft); border-color: var(--accent-ring); }
}
.shop-plan-heading {
 display: grid;
 grid-template-columns: minmax(0,1fr) auto;
 align-items: start;
 gap:12px;
}
.shop-plan-name { display: block; font-size: var(--fs-xl); font-weight: 680; letter-spacing: -.028em; }
.shop-plan-heading p { color: var(--ink-3); font-size: var(--fs-s); max-width: 30ch; }
.shop-plan-price { text-align: right; white-space: nowrap; }
.shop-plan-price strong { display: block; font-size: var(--fs-xl); font-weight: 680; letter-spacing: -.028em; }
.shop-plan-price small { display: block; color: var(--ink-3); font-size: var(--fs-xs); }
.price-note {
  display: inline-block; margin-top: 4px;
  font-size: var(--fs-2xs); font-weight: 620;
  color: var(--ink-3);
  background: var(--surface-3);
  border-radius: var(--r-round);
  padding: 2px 8px;
  white-space: nowrap;
}
.shop-plan .btn { width: 100%; }

/* Предпросмотр заказа */
.checkout-card { padding: clamp(18px, 2.6vw, 26px); display: grid; gap: var(--sp-s); }
.checkout-summary {
  display: grid;
  gap: 0;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
}
.checkout-summary > div, .checkout-summary > label {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-s);
}
.checkout-summary > div:last-child { border-bottom: 0; }
.checkout-summary span { color: var(--ink-3); }
.checkout-summary strong { font-weight: 620; text-align: right; overflow-wrap: anywhere; }
.checkout-total { background: var(--accent-soft) !important; }
.checkout-total span { color: var(--ink-2); }
.checkout-total strong { color: var(--ink); font-size: var(--fs-l); letter-spacing: -.02em; }
.checkout-summary select { min-width: 130px; }

/* Способы оплаты */
.method-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}
.payment-method {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 11px 13px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-s);
  text-align: left;
  overflow-wrap: anywhere;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.payment-method strong {
  color: var(--ink);
  font-weight: 600;
  font-size: var(--fs-m);
  letter-spacing: -.01em;
}
.payment-method span { color: var(--ink-3); font-size: var(--fs-xs); white-space: nowrap; }
.payment-method::after {
  content: "";
  position: absolute; top: 11px; right: 11px;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.payment-method:hover { border-color: var(--line-strong); background: var(--surface-3); }
.payment-method:disabled { opacity: .55; cursor: not-allowed; }
.payment-method:disabled:hover { background: var(--surface); border-color: var(--line); }
.payment-method.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
@supports not (color: color-mix(in srgb, red blue)) {
  .payment-method.active { border-color: var(--accent-ring); }
}
.payment-method.active::after {
  border-color: var(--accent);
  background: radial-gradient(circle at center, var(--accent) 0 42%, transparent 45%);
}
@media (max-width:420px) {
 .payment-method span { white-space: normal; }
}
.method-fieldset { border:0; padding:0; margin:0; min-width:0; display: grid; gap:8px; }
.method-fieldset legend { padding:0; font-size: var(--fs-xs); font-weight:620; color: var(--ink-2); }
.method-note { margin:0; }
.method-empty { margin:0; font-size: var(--fs-s); }
.payment-method:disabled { opacity:.55; cursor:not-allowed; }
.payment-method:disabled:hover { background: var(--surface); border-color: var(--line); }

/* ==========================================================================
   Кнопки
   ========================================================================== */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 20px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-m); font-weight: 570; line-height: 1.2;
  text-align: center;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
 min-height:44px; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary:disabled, .btn.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn .icon { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: none; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn.ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.btn.ghost:active { transform: scale(.97); }
.btn.danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }
@supports not (color: color-mix(in srgb, red blue)) {
  .btn.danger:hover { opacity: .85; }
}
.btn.danger .icon { stroke: currentColor; }
.btn-lg { padding: 14px 26px; font-size: var(--fs-l); border-radius: var(--r-l); }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy::after {
  content: "";
  width: 14px; height: 14px; flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { rotate: 1turn; } }
.btn.done { color: var(--ok); }
.support-link { display: inline-flex; align-items: center; min-height:44px; font-size: var(--fs-s); font-weight:560; }

/* Донат — фирменный градиент темы */
.donate-card { padding: clamp(18px, 2.6vw, 26px); display: grid; gap: var(--sp-s); }
.donate-card > .donate-copy .muted { max-width: 60ch; font-size: var(--fs-s); }
.donate-form { display: grid; gap: 12px; max-width: 460px; }
.amount-input {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.amount-input:focus-within { border-color: var(--accent); outline: 2px solid var(--accent-ring); outline-offset: -2px; }
.amount-input input[type="number"], .amount-input input[type="text"], .amount-input input:not([type]) {
  flex: 1;
  border: 0; border-color: transparent; background: none; outline: none;
  padding: 12px 0;
  font-size: var(--fs-xl); font-weight: 640; letter-spacing: -.02em;
  -moz-appearance: textfield;
  appearance: textfield;
  box-shadow: none;
}
.amount-input:focus-within input { border: 0; border-color: transparent; box-shadow: none; }
.amount-input input::-webkit-inner-spin-button, .amount-input input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.amount-input span { color: var(--ink-3); font-weight: 560; }
.donate-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.donate-chips button {
  padding: 8px 15px;
  border-radius: var(--r-round);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--fs-s); font-weight: 580; font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.donate-chips button:hover { border-color: var(--line-strong); color: var(--ink); }
.donate-chips button:active { transform: scale(.95); }
.donate-chips button.active {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent-onsoft);
}
.donate-total {
  display: grid; gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--surface-2);
  overflow: hidden;
}
.donate-total > div {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-s);
}
.donate-total > div:last-child { border-bottom: 0; }
.donate-total dt { color: var(--ink-3); min-width:0; }
.donate-total dd { font-weight: 620; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.donate-total > div:last-child dd { color: var(--accent); font-size: var(--fs-l); font-weight: 700; }
.donate-btn {
  background: linear-gradient(160deg, var(--donate-1), var(--donate-2));
  border-color: transparent;
  color: var(--donate-ink);
}
.donate-btn:hover { filter: brightness(1.05); }

/* Документы */
.documents-card { padding: clamp(18px, 2.6vw, 26px); display: grid; gap: var(--sp-s); }
.article-promo { grid-template-columns: minmax(0, 1fr) minmax(220px, 38%); align-items: center; overflow: hidden; }
.article-promo-copy { display: grid; gap: var(--sp-s); }
.article-promo-copy h2, .article-promo-copy p { margin: 0; }
.article-promo-copy .btn { justify-self: start; text-decoration: none; }
.article-promo-image { width: 100%; height: 150px; border-radius: var(--r-m); object-fit: cover; border: 1px solid var(--line); }
.article-promo-preview {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
}
.article-promo-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-2xs);
  color: var(--ink-3);
}
.article-promo-preview-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-xs);
  color: var(--ink-2);
}
.article-promo-preview-line strong {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--accent);
}
@media (max-width: 700px) { .article-promo { grid-template-columns: 1fr; } .article-promo-image { height: 190px; order: -1; } .article-promo-copy .btn { justify-self: stretch; text-align: center; } }
.document-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 700px) { .document-links { grid-template-columns: 1fr; } }
.document-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  min-width: 0;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.document-link:hover { text-decoration: none; border-color: var(--line-strong); background: var(--surface-3); }
.document-icon {
  flex: none; display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 11px;
  font-family: var(--font-mono); font-size: .68rem; font-weight: 620;
  background: var(--accent-soft); color: var(--accent);
}
.document-link strong { display: block; font-size: var(--fs-s); font-weight: 600; }
.document-link small { display: block; color: var(--ink-3); font-size: var(--fs-2xs); }
.document-go { margin-left: auto; color: var(--ink-3); }

/* Панели статуса оплаты */
.payment-panel {
  display: grid; gap: 9px;
  padding: 16px;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface-2);
  animation: panelIn var(--dur) var(--ease-out) both;
}
.payment-panel-head {
  display: flex; align-items: center; gap: 9px;
  font-weight: 640;
  font-size: var(--fs-m);
}
.payment-panel-head .icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.payment-panel.error { border-color: rgb(from var(--danger) r g b / 35%); background: var(--danger-soft); }
.payment-panel.error .payment-panel-head { color: var(--danger); }
.payment-panel.success { border-color: rgb(from var(--ok) r g b / 35%); background: var(--ok-soft); }
.payment-panel.success .payment-panel-head { color: var(--ok); }
.payment-panel .btn { justify-self: start; }
.payment-panel .payment-panel-head .live-dot { position: relative; }

/* ==========================================================================
   Рассылки (Piar)
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-s);
}
@media (max-width: 1180px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 430px) { .stats-grid { grid-template-columns: 1fr; } }
.stat-card { padding: 16px 18px; display: grid; gap: 5px; align-content: start; min-width: 0; }
.stat-label { font-size: var(--fs-2xs); font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.stat-value {
  font-size: var(--fs-xl); font-weight: 680; letter-spacing: -.028em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-value.ok { color: var(--ok); }
.stat-value.bad { color: var(--danger); }
.stat-sub { font-size: var(--fs-xs); color: var(--ink-3); }
.skeleton { position: relative; overflow: hidden; }
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--ink) 6%, transparent) 50%, transparent 70%);
  translate: -100% 0;
  animation: shimmer 1.6s var(--ease) infinite;
}
@supports not (color: color-mix(in srgb, red blue)) {
  .skeleton::after { background: linear-gradient(100deg, transparent 30%, rgb(128 128 128 / .08) 50%, transparent 70%); }
}
@keyframes shimmer { to { translate: 100% 0; } }

/* Активная рассылка */
.broadcast-card { padding: 18px 20px; display: grid; gap: 11px; }
.broadcast-head { display: flex; align-items: center; gap: 10px; font-weight: 620; }
.broadcast-time { margin-left: auto; color: var(--ink-3); font-size: var(--fs-s); }
.progress-bar {
  height: 7px; border-radius: var(--r-round);
  background: var(--surface-3); overflow: hidden;
}
.progress-bar span {
  display: block; height: 100%; width: 34%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--tone-pro));
  animation: indeterminate 1.4s linear infinite;
}
@keyframes indeterminate {
  0% { transform: translateX(-105%); }
  100% { transform: translateX(305%); }
}
.broadcast-stats { display: flex; gap: 18px; color: var(--ink-2); font-size: var(--fs-s); flex-wrap: wrap; }
.broadcast-stats b { font-weight: 700; }

/* Прогресс и ETA активной рассылки */
.broadcast-eta { margin: 0; color: var(--ink-3); font-size: var(--fs-xs); }
.broadcast-lost {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 12px; border-radius: var(--r-m);
  background: var(--warn-soft); color: var(--warn);
  font-size: var(--fs-s);
}
.broadcast-lost .icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; margin-top: 1px; }
.broadcast-lost b { color: inherit; }
.broadcast-accounts {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.bc-acc {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-round);
  background: var(--surface-3); color: var(--ink-2);
  font-size: var(--fs-2xs); font-weight: 550;
}
.bc-acc-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.bc-acc-dot.ok { background: var(--ok); }
.bc-acc-dot.warn { background: var(--warn); }
.bc-acc-dot.bad { background: var(--danger); }

/* Сетевое уведомление дашборда рассылок */
.piar-net-notice { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); }
.piar-net-notice .icon { stroke: var(--warn); }

/* Модалка подтверждения запуска */
.piar-start-card { width: min(460px, 100%); }
.piar-start-summary { display: grid; gap: 7px; margin: 0; font-size: var(--fs-s); }
.piar-start-summary div { display: flex; justify-content: space-between; gap: 12px; }
.piar-start-summary dt { color: var(--ink-3); }
.piar-start-summary dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.piar-start-warnings {
  display: grid; gap: 7px;
  padding: 10px 12px; border-radius: var(--r-m);
  background: var(--warn-soft);
}
.piar-warn-row { display: flex; align-items: flex-start; gap: 8px; color: var(--warn); font-size: var(--fs-s); }
.piar-warn-row .icon { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; margin-top: 2px; }

/* Запуск */
.start-block {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}
.start-block .btn-lg {
  width: 100%;
  max-width: 100%;
  white-space: normal;
  text-align: center;
  box-sizing: border-box;
}

/* Форма настроек */
.settings-card { padding: clamp(18px, 2.6vw, 26px); display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 860px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: var(--fs-xs); font-weight: 620; color: var(--ink-2); letter-spacing: .02em; }
.field-hint { font-size: var(--fs-2xs); }
.signature-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
input[type="text"], input[type="number"], input[type="url"], input:not([type]), select, textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-m);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
input::placeholder { color: var(--ink-3); opacity: .8; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.field-row { display: grid; grid-template-columns: 1fr 96px; gap: 8px; }

/* Модификаторы */
.modes { border: 0; padding: 0; margin: 0; min-width: 0; }
.modes legend { font-size: var(--fs-xs); font-weight: 620; color: var(--ink-2); padding: 0; margin-bottom: 9px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-block;
  padding: 8px 15px;
  border-radius: var(--r-round);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--fs-s); font-weight: 580;
  color: var(--ink-2);
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  cursor: pointer;
}
.chip:hover span { border-color: var(--accent); color: var(--ink); }
.chip input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent-onsoft);
}
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-num { width: 74px !important; padding: 8px 10px !important; font-variant-numeric: tabular-nums; }
.chip-num:disabled { opacity: .45; }
.text-preview {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--r-m);
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--fs-s);
  color: var(--ink-2);
  min-height: 20px;
  overflow-wrap: anywhere;
}
.text-preview > span { min-width: 0; }
.text-preview > svg.icon { width: 15px; height: 15px; flex: none; margin-top: 2px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.text-preview.ok { border-style: solid; border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ink); }
@supports not (color: color-mix(in srgb, red blue)) {
  .text-preview.ok { border-color: var(--ok-soft); }
}

/* Аккаунты */
.section-block { padding: 0; overflow: hidden; }
.section-block > .section-heading { padding: 18px 20px 8px; }
.accounts-list { display: grid; gap: 10px; padding: 8px 16px 16px; }
.account-card {
  padding: 12px 14px;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.account-card:hover { border-color: var(--line-strong); }
.account-head {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  text-align: left;
  border-radius: var(--r-s);
}
.account-avatar {
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: .85rem;
  text-transform: uppercase;
}
.account-who { display: grid; min-width: 0; }
.account-name { font-weight: 600; font-size: var(--fs-m); overflow-wrap: anywhere; }
.account-phone { color: var(--ink-3); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.status-badge {
  margin-left: auto;
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-round);
  font-size: var(--fs-2xs); font-weight: 650; letter-spacing: .04em;
  white-space: nowrap;
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.ok { background: var(--ok-soft); color: var(--ok); }
.status-badge.bad { background: var(--danger-soft); color: var(--danger); }
.status-badge.warn { background: var(--warn-soft); color: var(--warn); }
.status-badge.unknown { background: var(--surface-3); color: var(--ink-3); }
.account-chevron { flex: none; color: var(--ink-3); transition: rotate var(--dur) var(--ease); }
.account-chevron .icon { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.account-card.open .account-chevron { rotate: 90deg; }
.account-body { display: none; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.account-card.open .account-body { display: grid; gap: 12px; animation: panelIn var(--dur) var(--ease-out) both; }
.account-details { display: grid; gap: 6px; font-size: var(--fs-s); }
.account-details div { display: flex; justify-content: space-between; gap: 12px; }
.account-details dt { color: var(--ink-3); }
.account-details dd { text-align: right; overflow-wrap: anywhere; }
.account-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.account-toggle-row { display: inline-flex; align-items: center; gap: 9px; font-size: var(--fs-s); color: var(--ink-2); }
.switch { position: relative; display: inline-block; width: 42px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; height: 100%; }
.track {
  position: absolute; inset: 0;
  border-radius: var(--r-round);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.track::before {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / .25);
  transition: translate var(--dur) var(--ease);
}
.switch input:checked + .track { background: var(--ok); border-color: transparent; }
.switch input:checked + .track::before { translate: 16px 0; }
.switch input:active + .track::before { scale: .88; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Piar MiniApp: Конструктор постов, кнопок, целей и управление
   ========================================================================== */
.piar-editor-box {
  display: grid;
  gap: var(--sp-m);
  padding: clamp(16px, 2.5vw, 24px);
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.piar-editor-box h3 {
  font-size: var(--fs-m);
  color: var(--ink-1);
  margin-bottom: 2px;
}
.piar-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
  font-family: inherit;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
}

/* Переключатель скрытых тегов */
.ghost-tags-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-l);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.ghost-tags-info {
  display: grid;
  gap: 3px;
}
.ghost-tags-info strong {
  font-size: var(--fs-s);
  color: var(--ink-1);
}
.ghost-tags-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tag-count-input {
  width: 70px !important;
  padding: 6px 10px !important;
  text-align: center;
  font-size: var(--fs-s) !important;
  border-radius: var(--r-s) !important;
}

/* Конструктор Inline-кнопок */
.button-builder {
  display: grid;
  gap: 12px;
}
.button-builder-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.button-builder-list {
  display: grid;
  gap: 8px;
}
.btn-row-card {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 110px 40px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--r-l);
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
@media (max-width: 640px) {
  .btn-row-card {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .btn-row-card .btn-color-select {
    grid-column: 1;
  }
  .btn-row-card .icon-btn {
    grid-column: 2;
    justify-self: end;
  }
}
.btn-row-card input, .btn-row-card select {
  padding: 8px 12px !important;
  font-size: var(--fs-xs) !important;
  border-radius: var(--r-s) !important;
}

/* Цели рассылки (до 10 ссылок) */
.targets-manager {
  display: grid;
  gap: 10px;
  padding: clamp(16px, 2.5vw, 22px);
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
}
.targets-input-row {
  display: flex;
  gap: 8px;
}
.targets-input-row input {
  flex: 1 1 auto;
}
.targets-badges-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}
.target-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-round);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring, var(--line-strong));
  font-size: var(--fs-xs);
  color: var(--ink-1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.target-badge-del {
  cursor: pointer;
  font-size: 16px;
  color: var(--ink-3);
  font-weight: 700;
  transition: color var(--dur-fast);
}
.target-badge-del:hover {
  color: var(--danger);
}

/* Живой предпросмотр Telegram-сообщения */
.telegram-preview-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r-xl);
  background: #0e1621;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}
.telegram-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
}
.telegram-bubble {
  position: relative;
  max-width: 95%;
  padding: 14px 16px;
  border-radius: 18px 18px 18px 4px;
  background: #182533;
  color: #ffffff;
  font-size: var(--fs-s);
  line-height: 1.45;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  overflow-wrap: break-word;
}
.telegram-bubble-body {
  white-space: pre-wrap;
}
.telegram-bubble-footer {
  margin-top: 10px;
  font-size: var(--fs-2xs);
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 6px;
}
.telegram-buttons-grid {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.tg-preview-btn {
  display: block;
  text-align: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 650;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-preview-btn.blue { background: rgba(56, 189, 248, 0.3); border-color: rgba(56, 189, 248, 0.5); }
.tg-preview-btn.green { background: rgba(34, 197, 94, 0.3); border-color: rgba(34, 197, 94, 0.5); }
.tg-preview-btn.red { background: rgba(239, 68, 68, 0.3); border-color: rgba(239, 68, 68, 0.5); }

/* Тулбар управления аккаунтами */
.accounts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--line);
}
.accounts-batch-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.accounts-filters {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--r-round);
  border: 1px solid var(--line);
}
.acc-filter-chip {
  padding: 5px 12px;
  border-radius: var(--r-round);
  font-size: var(--fs-2xs);
  font-weight: 650;
  color: var(--ink-3);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.acc-filter-chip.active {
  background: var(--surface);
  color: var(--ink-1);
  box-shadow: var(--shadow-xs);
}

.account-search-wrap {
  width: 100%;
  margin-bottom: 12px;
}
.account-search-input {
  padding: 10px 14px !important;
  font-size: var(--fs-s) !important;
  border-radius: var(--r-l) !important;
  background: var(--surface) !important;
}

/* Модалка добавления аккаунта */
.modal-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.modal-tab-btn {
  flex: 1 1 50%;
  padding: 10px 14px;
  border-radius: var(--r-m);
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--ink-2);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.modal-tab-btn.active {
  background: var(--surface);
  color: var(--ink-1);
  box-shadow: var(--shadow-xs);
}

/* Кастомные контролы сетки рассылки */
.custom-select-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 768px) {
  .custom-select-grid {
    grid-template-columns: 1fr;
  }
}

.custom-select-wrap {
  position: relative;
  width: 100%;
}
.custom-select {
  width: 100%;
  padding: 11px 36px 11px 14px !important;
  border-radius: var(--r-m) !important;
  border: 1px solid var(--line-strong) !important;
  background-color: var(--surface-2) !important;
  color: var(--ink-1) !important;
  font-size: var(--fs-s) !important;
  font-weight: 550;
  cursor: pointer;
  outline: none;
  transition: all var(--dur-fast);
}
.custom-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

.custom-input {
  width: 100%;
  padding: 11px 14px !important;
  border-radius: var(--r-m) !important;
  border: 1px solid var(--line-strong) !important;
  background-color: var(--surface-2) !important;
  color: var(--ink-1) !important;
  font-size: var(--fs-s) !important;
  font-weight: 550;
  outline: none;
  transition: all var(--dur-fast);
}
.custom-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

/* ==========================================================================
   Команды: быстрые модули, поиск, категории и блоки команд (Terminal Ledger)
   ========================================================================== */
.btn.secondary {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn.secondary:hover {
  background: var(--surface-3);
  border-color: var(--accent);
}

/* Модуль быстрых настроек UserBot на вкладке Команды */
.command-settings {
  border-color: var(--line-strong);
  padding: clamp(16px, 2.4vw, 24px);
  display: grid;
  gap: 16px;
}
.command-settings-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.command-settings-top .section-heading {
  margin-bottom: 0;
}
.command-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: var(--fs-2xs);
  letter-spacing: 0.04em;
}
.command-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
@media (max-width: 820px) {
  .command-settings-grid {
    grid-template-columns: 1fr;
  }
}
.command-setting-box {
  display: grid;
  gap: 8px;
  align-content: space-between;
  padding: 14px 16px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.command-setting-toggle-box {
  align-content: center;
}
.command-reaction-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.command-reaction-row input {
  flex: 1 1 180px;
  font-family: var(--font-mono);
  font-size: var(--fs-s);
  background: var(--surface);
}
.command-reaction-row .btn {
  flex: 0 0 auto;
}
@media (max-width: 520px) {
  .command-reaction-row .btn {
    width: 100%;
  }
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
}
.toggle-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.toggle-copy strong {
  font-size: var(--fs-s);
  font-weight: 640;
  color: var(--ink);
}
.toggle-copy small {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  line-height: 1.4;
}

/* Панель поиска и фильтрации категорий команд */
.commands-toolbar {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface);
}
.commands-search-wrap {
  position: relative;
}
.commands-search-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-s);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.commands-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.commands-toolbar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.commands-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.cmd-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.cmd-filter-chip .mono {
  font-size: var(--fs-2xs);
  color: var(--ink-3);
}
.cmd-filter-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.cmd-filter-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-onsoft);
}
.cmd-filter-chip.active .mono {
  color: var(--accent-onsoft);
}

/* Сетка групп команд: 2 колонки на широких ПК, 1 колонка на планшетах и мобильных */
.command-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
@media (max-width: 1120px) {
  .command-list {
    grid-template-columns: 1fr;
  }
}

.command-group {
  border-radius: var(--r-l);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.command-group:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
}
.command-group > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
  font-family: var(--font-display);
  font-size: var(--fs-m);
  font-weight: 650;
  letter-spacing: -0.02em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-fast) var(--ease);
}
.command-group > h2:hover {
  background: var(--surface-3);
}
.command-group.is-collapsed > h2 {
  border-bottom-color: transparent;
}
.command-group-idx {
  display: inline-grid;
  place-items: center;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent-onsoft);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.command-group-title {
  flex: 1;
  min-width: 0;
}
.command-group > h2::after {
  content: attr(data-count);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  padding: 2px 8px;
}
.command-group-chevron {
  order: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1;
}
.command-group-chevron::before {
  content: "−";
}
.command-group.is-collapsed .command-group-chevron::before {
  content: "+";
}
.command-group-body {
  display: grid;
}
.command-group.is-collapsed .command-group-body {
  display: none;
}

.command-row {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 1px solid var(--line);
  transition: background var(--dur-fast) var(--ease);
}
.command-row:last-child { border-bottom: 0; }
.command-row:hover {
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
}
.command-row.is-configurable > .command-row-main {
  cursor: pointer;
}
.command-row.is-open {
  background: color-mix(in srgb, var(--surface-2) 85%, transparent);
}
.command-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 12px 16px;
}
.command-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
}
.command-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.command-name {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent-onsoft);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  padding: 3px 9px;
  overflow-wrap: anywhere;
}
.cmd-config-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.cmd-config-badge::after {
  content: "▾";
  font-size: 0.72em;
  opacity: 0.8;
}
.command-row.is-open .cmd-config-badge::after {
  content: "▴";
}
.cmd-config-badge.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong));
  background: var(--accent-soft);
  color: var(--accent-onsoft);
}
.command-desc {
  color: var(--ink-2);
  font-size: var(--fs-s);
  line-height: 1.42;
  min-width: 0;
  overflow-wrap: anywhere;
}
.command-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  justify-self: end;
  padding: 7px 12px;
  min-height: 34px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.copy-btn:hover {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent);
}
.copy-btn:active {
  transform: scale(0.96);
}
.copy-btn.done {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok);
}

/* Выдвижная панель настроек внутри карточки команды */
.cmd-config-drawer {
  padding: 0 16px 14px;
  border-top: 1px dashed var(--line);
  background: color-mix(in srgb, var(--surface) 75%, var(--surface-2));
}
.cmd-drawer-inner {
  padding-top: 12px;
  display: grid;
  gap: 12px;
}
.cmd-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.cmd-drawer-status {
  font-size: var(--fs-2xs);
  padding: 3px 8px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.cmd-drawer-hint {
  margin: 0;
  color: var(--ink-3);
  font-size: var(--fs-xs);
  line-height: 1.45;
}
.cmd-drawer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cmd-drawer-field {
  display: grid;
  gap: 6px;
}
.cmd-drawer-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.cmd-input,
.cmd-select,
.cmd-textarea {
  width: 100%;
  flex: 1 1 180px;
  padding: 8px 11px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-s);
}
.cmd-textarea {
  resize: vertical;
  min-height: 68px;
  font-family: var(--font-sans);
}
.cmd-drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cmd-emoji-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cmd-emoji-chip {
  min-width: 36px;
  height: 34px;
  padding: 0 9px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 1rem;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.cmd-emoji-chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.cmd-emoji-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Конструктор inline-кнопок автоответчика */
.cmd-autootvet-btns-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.cmd-autootvet-btns-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.cmd-autootvet-btns-list {
  display: grid;
  gap: 8px;
}
.cmd-autootvet-btn-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface);
}
.cmd-autootvet-btn-fields {
  display: grid;
  grid-template-columns: 1fr 1.3fr auto;
  gap: 8px;
}
.cmd-autootvet-btn-fields input,
.cmd-autootvet-btn-fields select {
  padding: 7px 10px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-xs);
}

@media (max-width: 640px) {
  .command-row-main {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 14px;
  }
  .copy-btn {
    justify-self: start;
    min-height: 38px;
    padding: 8px 14px;
  }
  .cmd-drawer-grid-2,
  .cmd-autootvet-btn-fields {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Чаты: мессенджер в стиле Telegram (15 диалогов, перехват удалённых, медиа ≤ 50 МБ)
   ========================================================================== */
#chat-ub-conn-badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 38%, transparent);
}

.chat-browser {
  display: grid;
  grid-template-columns: minmax(290px, 370px) minmax(0, 1fr);
  gap: 0;
  min-height: 650px;
  height: min(76vh, 760px);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-s);
}
.chat-list-wrap, .chat-thread {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.chat-list-wrap {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.chat-sidebar-head {
  display: grid;
  gap: 10px;
  padding: 12px 12px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.chat-search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.chat-search-ico {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  stroke: var(--ink-3);
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}
.chat-search-input {
  width: 100%;
  padding: 8px 12px 8px 34px !important;
  border-radius: 18px !important;
  border: 1px solid var(--line-strong) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  font-size: var(--fs-xs) !important;
  outline: none;
}
.chat-search-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

.chat-folder-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.chat-folder-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chat-folder-tab:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.chat-folder-tab.active {
  background: var(--accent-soft);
  color: var(--accent-onsoft);
  border-color: var(--accent-ring);
}
.chat-folder-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
}
.chat-folder-badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Telegram-аватары с градиентами по ID чата */
.tg-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  user-select: none;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.2);
}
.tg-avatar[data-color="0"] { background: linear-gradient(135deg, #ff7e5f, #e54d2e); }
.tg-avatar[data-color="1"] { background: linear-gradient(135deg, #38bdf8, #2563eb); }
.tg-avatar[data-color="2"] { background: linear-gradient(135deg, #a855f7, #6366f1); }
.tg-avatar[data-color="3"] { background: linear-gradient(135deg, #34d399, #059669); }
.tg-avatar[data-color="4"] { background: linear-gradient(135deg, #fbbf24, #d97706); }
.tg-avatar[data-color="5"] { background: linear-gradient(135deg, #f472b6, #db2777); }
.tg-avatar-header {
  width: 38px;
  height: 38px;
  font-size: 0.74rem;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chat-list-item:hover {
  background: var(--surface-2);
}
.chat-list-item.active {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
}
.chat-item-body {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  overflow: hidden;
}
.chat-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.chat-list-item strong {
  font-family: var(--font-sans);
  font-size: var(--fs-s);
  font-weight: 650;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-item-time {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--ink-3);
}
.chat-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-item-preview,
.chat-list-item span {
  flex: 1;
  min-width: 0;
  color: var(--ink-3);
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-item-preview.is-deleted {
  color: var(--danger);
  font-weight: 560;
}
.chat-item-badges {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chat-badge-del {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
}
.chat-badge-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
}

.tg-empty-dialogs {
  margin: auto;
  padding: 28px 18px;
  text-align: center;
  display: grid;
  gap: 8px;
  max-width: 280px;
}
.tg-empty-ico {
  font-size: 2rem;
  line-height: 1;
}
.tg-empty-dialogs strong {
  font-family: var(--font-display);
  font-size: var(--fs-s);
}
.tg-empty-dialogs p {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  line-height: 1.45;
}

/* Правая панель переписки (Telegram Thread) */
.chat-thread {
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.chat-thread-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  min-height: 58px;
  flex-shrink: 0;
}
.chat-back-btn {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 7px 11px 7px 7px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chat-back-btn:hover {
  border-color: var(--accent);
  background: var(--surface-3);
}
.chat-back-btn.single-chat-only {
  display: none !important;
}
.chat-back-btn .icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.1;
  flex: none;
}
.chat-thread-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.chat-thread-head {
  font-family: var(--font-sans);
  font-size: var(--fs-m);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-thread-sub {
  margin: 0;
  font-size: var(--fs-2xs);
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-thread-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-filter-del-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--danger) 42%, var(--line-strong));
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-2xs);
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.chat-filter-del-btn b {
  font-family: var(--font-mono);
  color: var(--danger);
}
.chat-filter-del-btn.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}
.chat-filter-del-btn.active b {
  color: #ffffff;
}

/* Область сообщений (Telegram Wallpaper + Bubbles) */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px clamp(10px, 2.2vw, 24px);
  background:
    radial-gradient(circle at 18% 20%, var(--accent-soft), transparent 50%),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px),
    var(--bg);
  background-size: 100% 100%, 36px 36px, 36px 36px, 100% 100%;
}

.tg-chat-placeholder {
  margin: auto;
  padding: 28px 20px;
  max-width: 340px;
  text-align: center;
  border-radius: var(--r-l);
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow-s);
}
.tg-chat-placeholder-ico {
  font-size: 2.2rem;
  line-height: 1;
}
.tg-chat-placeholder strong {
  font-family: var(--font-display);
  font-size: var(--fs-m);
  color: var(--ink);
}
.tg-chat-placeholder p {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  line-height: 1.45;
}

.tg-date-divider {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
  position: sticky;
  top: 4px;
  z-index: 2;
  pointer-events: none;
}
.tg-date-pill {
  padding: 4px 12px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--surface-2) 94%, transparent);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 650;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-xs);
}

/* Пузыри сообщений Telegram */
.chat-message {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-start;
  width: fit-content;
  max-width: min(85%, 560px);
  min-width: 140px;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 16px 16px 16px 4px;
  background: var(--surface-2);
  padding: 10px 14px 9px;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: var(--shadow-s);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}
.chat-message.outgoing {
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
  background: color-mix(in srgb, var(--accent-soft) 92%, var(--surface-2));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
}
.chat-message.deleted-message {
  border: 1.5px dashed var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 85%, var(--surface-2));
}

.chat-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
}
.chat-message strong {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-onsoft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-message.deleted-message strong {
  color: var(--danger);
}
.chat-deleted-pill {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--danger);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.chat-message p {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  font-size: 0.93rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--ink);
}

.chat-media-preview {
  display: block;
  max-width: 100%;
  max-height: 280px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: cover;
  margin-top: 2px;
}
.chat-media-kind-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.chat-media-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--accent-ring);
  background: var(--surface);
  color: var(--accent-onsoft);
  font-size: var(--fs-xs);
  font-weight: 650;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.chat-media-link:hover {
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
}

.chat-msg-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 2px;
  min-width: 0;
}
.chat-msg-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}
.chat-reply-btn,
.chat-copy-msg-btn {
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 0.7rem;
  font-weight: 650;
  padding: 2px 4px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.chat-reply-btn:hover:not(:disabled),
.chat-copy-msg-btn:hover {
  color: var(--accent);
  background: var(--surface);
}
.chat-reply-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.chat-msg-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.chat-msg-edited {
  font-size: 0.66rem;
  color: var(--ink-2);
  font-style: italic;
}
.chat-message small {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-2);
}
.chat-msg-checks {
  font-size: 0.7rem;
  color: var(--accent);
  line-height: 1;
}

/* Нижняя панель ввода (Telegram Composer) */
.chat-compose {
  display: grid;
  gap: 6px;
  padding: 8px 12px 10px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.chat-compose-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.chat-compose-banner-accent {
  width: 3px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--accent);
}
.chat-replying-bar {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-banner-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.chat-banner-close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.chat-compose-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.chat-attach-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.chat-attach-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface-3);
}
.chat-attach-btn .icon {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.85;
}
.chat-compose textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  max-height: 120px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 14px;
  font-size: var(--fs-s);
  line-height: 1.4;
}
.chat-compose textarea:disabled {
  opacity: 0.6;
}
.chat-send-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-xs);
  font-weight: 650;
  cursor: pointer;
  transition: filter var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.chat-send-btn .icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.chat-send-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}
.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Мобильная адаптация чатов в стиле Telegram (переключение Список <-> Диалог) */
@media (max-width: 860px) {
  .chat-browser {
    grid-template-columns: 1fr;
    height: min(76dvh, 720px);
    min-height: 480px;
  }
  .chat-list-wrap {
    border-right: 0;
  }
  .chat-browser:not(.mobile-chat-open) .chat-thread {
    display: none;
  }
  .chat-browser.mobile-chat-open .chat-list-wrap {
    display: none;
  }
  .chat-browser.mobile-chat-open .chat-thread {
    display: flex;
  }
  .chat-back-btn {
    display: inline-flex;
  }
  .chat-send-btn span {
    display: none;
  }
  .chat-send-btn {
    width: 40px;
    padding: 0;
    border-radius: 50%;
  }
  .chat-message {
    max-width: 90%;
    padding: 9px 12px 8px;
  }
  .chat-thread-top {
    padding: 8px 10px;
    gap: 8px;
  }
  .chat-thread-top .tg-avatar-header {
    width: 34px;
    height: 34px;
    font-size: 0.78rem;
  }
}

/* ==========================================================================
   Профиль
   ========================================================================== */
.profile-layout {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: var(--sp-m);
  align-items: start;
}
@media (max-width: 900px) { .profile-layout { grid-template-columns: 1fr; } }
.avatar {
  flex: none;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--r-s);
  overflow: hidden;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent-onsoft);
  font-family: var(--font-display);
  font-weight: 700; font-size: .95rem;
  text-transform: uppercase;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.1rem; }
.profile-identity { display: flex; align-items: center; gap: 14px; padding: clamp(18px, 2.6vw, 26px) clamp(18px, 2.6vw, 26px) 8px; min-width: 0; }
.profile-identity h2 { font-size: var(--fs-l); overflow-wrap: anywhere; }
.profile-identity .muted { font-size: var(--fs-s); overflow-wrap: anywhere; }
.profile-card dl {
  display: grid;
  margin: 8px clamp(18px, 2.6vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface-2);
  overflow: hidden;
}
.profile-card dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 15px; border-bottom: 1px solid var(--line); font-size: var(--fs-s); }
.profile-card dl > div:last-child { border-bottom: 0; }
.profile-card dt { color: var(--ink-3); }
.profile-card dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.profile-card > .btn { margin: 0 clamp(18px, 2.6vw, 26px) clamp(18px, 2.6vw, 26px); }

/* История платежей */
.orders-card { padding: clamp(18px, 2.6vw, 26px); display: grid; gap: 10px; }
.orders-list { display: grid; gap: 8px; max-height: 520px; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.order-row {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.order-main { display: grid; gap: 3px; min-width: 0; flex: 1; }
.order-title { font-weight: 600; font-size: var(--fs-s); overflow-wrap: anywhere; }
.order-meta { color: var(--ink-3); font-size: var(--fs-2xs); overflow-wrap: anywhere; }
.order-amount { font-family: var(--font-mono); font-weight: 650; font-variant-numeric: tabular-nums; font-size: var(--fs-m); white-space: nowrap; }
.order-status {
  flex: none;
  padding: 3px 10px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs); font-weight: 650; letter-spacing: .04em;
  white-space: nowrap;
}
.order-status.paid { background: var(--ok-soft); color: var(--ok); }
.order-status.pending, .order-status.created { background: var(--warn-soft); color: var(--warn); }
.order-status.declined { background: var(--danger-soft); color: var(--danger); }
.order-refresh { justify-self: start; }

/* ==========================================================================
   Мобильная нижняя навигация (Architectural Dock <= 1023px)
   ========================================================================== */
.bottom-nav {
  display: none;
  position: fixed;
  z-index: 40;
  left: 50%;
  translate: -50% 0;
  bottom: calc(var(--safe-bottom) + 8px);
  width: min(640px, calc(100vw - 12px));
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  padding: 5px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-m);
}
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding-bottom: calc(96px + var(--safe-bottom)); }
  main { padding-bottom: var(--sp-s); }
  .bottom-nav { display: grid; }
  .icon-btn { width: 42px; height: 42px; }
  .chip span { padding: 10px 16px; }
  .donate-chips button { padding: 11px 16px; }
}
.nav-tab {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 7px 2px 6px;
  border-radius: 11px;
  border: 1px solid transparent;
  color: var(--ink-3);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color var(--dur-fast) var(--ease), background var(--dur) var(--ease), border-color var(--dur-fast) var(--ease);
}
.nav-tab .icon {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
}
.nav-tab span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#nav-bonuses span {
  white-space: normal;
  line-height: 1.04;
  text-align: center;
  font-size: 0.54rem;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.nav-tab:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.nav-tab.active {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line-strong);
  box-shadow: inset 0 2px 0 var(--accent);
}
.nav-tab.active .icon {
  color: var(--accent);
}
@media (max-width: 380px) {
  .bottom-nav {
    width: calc(100vw - 8px);
    padding: 4px;
    gap: 2px;
    border-radius: 14px;
  }
  .nav-tab {
    padding: 6px 1px 5px;
    border-radius: 9px;
    font-size: 0.56rem;
  }
  #nav-bonuses span {
    font-size: 0.49rem;
    line-height: 1.02;
  }
  .nav-tab .icon {
    width: 17px;
    height: 17px;
  }
}

/* ==========================================================================
   Тосты / модалка / drawer
   ========================================================================== */
.toasts {
  position: fixed; z-index: 90;
  left: 50%; translate: -50% 0;
  bottom: calc(var(--safe-bottom) + 86px);
  display: grid; gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
@media (min-width: 1024px) and (min-height: 700px) {
  .toasts { bottom: auto; top: calc(var(--safe-top) + 16px); }
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-m);
  font-size: var(--fs-s); font-weight: 550;
  animation: toastIn var(--dur) var(--ease-out) both;
}
.toast .toast-ico {
  flex: none;
  display: grid; place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font: 700 12px/1 var(--font-mono);
}
.toast.success { color: var(--ok); }
.toast.error { color: var(--danger); }
.toast.info { color: var(--ink-2); }
.toast.out { animation: toastOut var(--dur) var(--ease) both; }
@keyframes toastIn { from { opacity:0; transform: translateY(12px) scale(.97); } to { opacity:1; transform: none; } }
@keyframes toastOut { to { opacity:0; transform: translateY(10px) scale(.97); } }

body.drawer-open { overflow: hidden; }

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 18px;
  background: var(--scrim);
  animation: fadeIn var(--dur) var(--ease) both;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  width: min(420px, 100%);
  padding: 22px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-m);
  display: grid; gap: 10px;
  animation: popIn var(--dur) var(--ease-out) both;
}
@keyframes popIn { from { opacity: 0; transform: scale(.95) translateY(8px); } }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 4px; }

/* ---------- Папки Чатов (магазин) ---------- */
.folders-card {
  padding: var(--sp-m);
  border-radius: var(--r-l);
  display: grid;
  gap: var(--sp-s);
}
.folders-list { display: grid; gap: 8px; }
.folder-pack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-s);
  flex-wrap: wrap;
  padding: 11px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.folder-pack:hover { border-color: var(--line-strong); background: var(--surface-3); }
.folder-pack-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.folder-pack-info > div { display: grid; line-height: 1.35; }
.folder-pack-info .muted { font-size: var(--fs-xs); }
.folder-pack-count {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-weight: 700;
  font-size: var(--fs-m);
  color: var(--accent-onsoft);
  background: var(--accent-soft);
}
.folder-pack-actions { display: flex; align-items: center; gap: 12px; }
.folder-pack-price {
  font-variant-numeric: tabular-nums;
  font-weight: 580;
  white-space: nowrap;
}

/* ---------- Drawer: панель чатов аккаунта ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  justify-items: end;
  align-items: stretch;
  padding: max(10px, var(--safe-top)) 0 max(10px, var(--safe-bottom));
  background: var(--scrim);
  animation: fadeIn var(--dur) var(--ease) both;
}
.drawer-card {
  width: min(440px, calc(100vw - 16px));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  padding: 18px;
  border-radius: 22px 0 0 22px;
  border: 1px solid var(--line);
  border-right: 0;
  background: var(--surface);
  box-shadow: var(--shadow-m);
  animation: drawerIn var(--dur-slow) var(--ease-out) both;
  min-height: 0;
}
@keyframes drawerIn { from { transform: translateX(48px); opacity: 0; } }
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.drawer-head h3 {
  font-size: var(--fs-l);
  overflow-wrap: anywhere;
}
.drawer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-search {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--r-round);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-s);
}
.drawer-search::placeholder { color: var(--ink-3); }
.drawer-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.drawer-count {
  flex: none;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  white-space: nowrap;
}
.drawer-list, .drawer-toolbar, .chat-item, .chat-item-main { min-width:0; }
.drawer-list, .drawer-toolbar, .chat-item, .chat-item-main { min-width:0; }
.drawer-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  align-content: start;
  gap: 8px;
  padding-right: 2px;
  min-height: 120px;
}
.drawer-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-3);
  padding: 28px 0;
}
.drawer-loading .icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; animation: spin 1s linear infinite; }
.drawer-foot { border-top: 1px solid var(--line); padding-top: 10px; }
.drawer-foot .hint { margin: 0; }

/* ---------- Элемент списка чатов ---------- */
.chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chat-item:hover { background: var(--surface-3); }
.chat-item-avatar {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-weight: 700;
  font-size: var(--fs-s);
  color: var(--ink-2);
  background: var(--surface-3);
}
.chat-item-who {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 1.3;
}
.chat-item-title {
  font-weight: 600;
  font-size: var(--fs-s);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-user {
  font-size: var(--fs-2xs);
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.chat-send { padding: 7px 12px; font-size: var(--fs-xs); }
.chat-star {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-round);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 19px;
  line-height: 1;
}
.chat-star:hover { color: var(--ink); border-color: var(--line-strong); }
.chat-star.active { color: var(--star); border-color: var(--star); }
.chat-star:disabled { opacity: .5; }

/* ---------- Анимация смены темы (лёгкая вспышка, только при переключении) ---------- */
html.theme-flash::after {
  content: "";
  position: fixed; inset: 0; z-index: 120;
  pointer-events: none;
  background: radial-gradient(120% 120% at 50% 0%, rgb(128 140 160 / .10), transparent 60%);
  animation: themeFlash .45s var(--ease-out) both;
}
@keyframes themeFlash { from { opacity: 1; } to { opacity: 0; } }

/* ---------- Смеси и защитные правила ---------- */
.modes b, .hint code { white-space: nowrap; }
.shop-plan-heading .btn, .btn[data-shop-plan] { white-space: nowrap; }
@media (max-width: 480px) {
  .btn-lg { width: 100%; }
  .start-block .btn-lg { width: auto; }
  .donate-total > div:last-child dd { font-size: var(--fs-m); }
  .shop-hero-mark { display: none; }
  .page-head { margin-top: var(--sp-2xs); }
}

/* Дисплей с большим контрастом и сокращённым движением */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .live-dot::after, .skeleton::after, .progress-bar span { animation: none !important; }
  html.theme-flash::after { display: none; }
  .piar-start-card { animation: none !important; }
}

/* CTA в чекауте: читаемая ширина на десктопе */
.checkout-card > .btn-lg { justify-self: start; width: min(100%,420px); }
.checkout-summary select { max-width:320px; }

/* Кнопки в истории и drawer — не меньше комфортной зоны касания */
.order-check { min-height:36px; padding:6px 10px; font-size: var(--fs-xs); }
@media (max-width:1023px) {
 .chat-star { width:44px; height:44px; }
 .order-check { min-height:44px; }
}

/* Донат на десктопе: текст слева, форма справа — без пустой половины */
@media (min-width:900px) {
 .donate-card { grid-template-columns: minmax(0,1fr) minmax(360px,460px); align-items:start; }
 .donate-form { max-width: none; }
}
.field-error { color: var(--danger); margin:0; }

/* ==========================================================================
   UserBOT: мастер подключения + управление (новый раздел)
   ========================================================================== */
.ub-hero {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 16px; align-items: center;
  padding: 20px;
  border-radius: var(--r-2xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 160% at 100% 0%, var(--accent-soft) 0%, transparent 55%),
    var(--surface);
}
.ub-hero-icon {
  display: grid; place-items: center;
  width: 54px; height: 54px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent);
}
.ub-hero-icon .icon { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.ub-hero h2 { font-size: var(--fs-l); margin-bottom: 4px; }
.ub-hero .btn { flex: none; }
@media (max-width: 620px) {
  .ub-hero { grid-template-columns: 1fr; }
  .ub-hero .btn { width: 100%; }
}

.ub-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: var(--sp-m); }
.ub-method {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ub-method:hover { border-color: var(--accent); transform: translateY(-1px); }
.ub-method-icon {
  flex: none; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--surface-3); color: var(--ink-2);
}
.ub-method-icon .icon { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.ub-method strong { display: block; font-size: var(--fs-s); }
.ub-method small { display: block; color: var(--ink-3); font-size: var(--fs-2xs); margin-top: 2px; }

.ub-wizard { max-width: 560px; margin-top: var(--sp-m); }
.ub-step { display: grid; gap: 12px; }
.ub-step .eyebrow { margin-bottom: 0; }
.ub-step h2 { font-size: var(--fs-l); }
.ub-loading {
  display: grid; place-items: center; gap: 10px;
  padding: 28px; color: var(--ink-3);
}
.ub-loading::before {
  content: ""; width: 26px; height: 26px;
  border: 3px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ub-error {
  margin: 0;
  padding: 11px 13px;
  border-radius: var(--r-l);
  border: 1px solid var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-s);
}
.ub-error::before { content: "⚠ "; }
/* ---- QR в стиле NeverLost: тёмная карта, скруглённые дотсы,
        акцентные глаза (цвета классов .m/.eye/.eye-dot приходят из rustcore),
        уголки-кронштейны и бегущая линия сканирования ---- */
.qr-box {
  justify-self: center;
  position: relative;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(150deg, #1a1e29 0%, #0a0c11 78%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    0 22px 44px -20px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
/* уголки-кронштейны (TS-сканер-стиль) */
.qr-box::before {
  content: "";
  position: absolute; inset: 9px;
  border-radius: 16px;
  background:
    linear-gradient(var(--accent), var(--accent)) top left / 16px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) top left / 2px 16px no-repeat,
    linear-gradient(var(--accent), var(--accent)) top right / 16px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) top right / 2px 16px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom left / 16px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom left / 2px 16px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom right / 16px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) bottom right / 2px 16px no-repeat;
  opacity: 0.65;
  pointer-events: none;
}
.qr-box svg.nl-qr {
  display: block;
  width: 212px; height: 212px;
  background: #fff;
  border-radius: 13px;
  padding: 9px;
}
.qr-box svg.nl-qr .m { fill: #10131b; }
.qr-box svg.nl-qr .eye { stroke: var(--accent); }
.qr-box svg.nl-qr .eye-dot { fill: var(--accent); }
/* бегущая линия сканирования поверх кода */
.qr-box::after {
  content: "";
  position: absolute;
  left: 20px; right: 20px; top: 18px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  box-shadow: 0 0 14px var(--accent);
  opacity: 0.55;
  pointer-events: none;
  animation: nl-qr-scan 2.6s ease-in-out infinite;
}
@keyframes nl-qr-scan {
  0%, 100% { transform: translateY(0); opacity: 0.25; }
  45% { opacity: 0.7; }
  50% { transform: translateY(214px); }
}
@media (prefers-reduced-motion: reduce) {
  .qr-box::after { animation: none; opacity: 0.2; }
}
.hint.center { text-align: center; }

.file-drop {
  display: grid; place-items: center; gap: 6px;
  padding: 26px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-xl);
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.file-drop:hover { border-color: var(--accent); }
.file-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-drop-ico { font-size: 1.4rem; color: var(--accent); }
.file-drop strong { font-size: var(--fs-s); }
.file-drop small { font-size: var(--fs-2xs); }
.ub-file-status { min-height: 1em; }

.choose-list { display: grid; gap: 8px; }
.choose-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left; cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.choose-item:hover { border-color: var(--accent); background: var(--surface-2); }
.choose-avatar {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  font-weight: 700; font-size: var(--fs-m);
  background: var(--accent-soft); color: var(--accent);
}
.choose-avatar.lg { width: 54px; height: 54px; }
.choose-main { display: grid; gap: 2px; min-width: 0; }
.choose-main strong { font-size: var(--fs-s); }
.choose-main small { font-size: var(--fs-2xs); color: var(--ink-3); }

.ub-identity {
  display: flex; align-items: center; gap: 13px;
  padding: 14px;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.ub-identity > div { display: grid; gap: 2px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 2px;
}
.switch-row strong { display: block; font-size: var(--fs-s); }
.switch-row small { display: block; color: var(--ink-3); font-size: var(--fs-2xs); margin-top: 2px; }

.text-btn {
  background: none; border: none; color: var(--accent);
  font: inherit; font-size: inherit; cursor: pointer;
  padding: 0; text-decoration: underline; text-underline-offset: 2px;
}

.ub-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.ub-actions .btn { flex: 1 1 auto; justify-content: center; }

/* Блок «Что умеет UserBOT» */
.ub-info {
  margin-top: var(--sp-m);
  padding: var(--sp-m);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--surface);
}
.ub-info .section-heading { margin-bottom: 10px; }
.ub-info-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ub-info-list li { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-s); }
.ub-info-list li .icon {
  width: 18px; height: 18px; flex: none; margin-top: 2px;
  stroke: var(--accent); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  border-radius: 50%;
}
.ub-info-list li strong { font-weight: 650; }
.ub-info-list li span { color: var(--ink-2); }
.ub-info .hint { margin-top: 10px; }

/* Живой предпросмотр нормализованного номера */
.field-suggest {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-2xs); color: var(--ink-3);
  min-height: 1.2em;
}
.field-suggest .mono { font-size: var(--fs-2xs); color: var(--accent); }

/* Счётчик обновления QR */
.qr-countdown { font-variant-numeric: tabular-nums; }

/* Топ-чаты в статистике */
.order-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border-radius: var(--r-l);
  border: 1px solid var(--line);
  background: var(--surface);
}
.order-item-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.order-item-main strong { font-size: var(--fs-s); overflow-wrap: anywhere; }
.order-item-main small { font-size: var(--fs-2xs); color: var(--ink-3); }

/* ==========================================================================
   Раздел «Бонусы» (Рулетка / Колесо фортуны)
   ========================================================================== */
.bonuses-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-l);
}
@media (min-width: 900px) {
  .bonuses-layout {
    grid-template-columns: 420px 1fr;
    align-items: start;
  }
}

.roulette-main-card {
  display: grid;
  gap: var(--sp-m);
  padding: var(--sp-l);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  text-align: center;
}

.roulette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.spins-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-s);
}

.free-badge {
  font-size: var(--fs-2xs);
  font-weight: 650;
  padding: 5px 10px;
  border-radius: 999px;
}
.free-badge.available {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.free-badge.cooldown {
  background: var(--surface-2);
  color: var(--ink-3);
  border: 1px solid var(--line);
}

/* Колесо */
.wheel-stage {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 10px auto;
  display: grid;
  place-items: center;
}
@media (max-width: 380px) {
  .wheel-stage {
    width: 280px;
    height: 280px;
  }
}

.roulette-wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(0, 0, 0, 0.5);
  will-change: transform;
}

.wheel-pointer {
  position: absolute;
  top: -12px;
  left: 50%;
  translate: -50% 0;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 24px solid #f59e0b;
  z-index: 10;
  filter: drop-shadow(0 4px 8px rgba(245, 158, 11, 0.6));
}
.wheel-pointer::after {
  content: "";
  position: absolute;
  top: -24px;
  left: -4px;
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px #fff;
}

.wheel-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb, 99, 102, 241), 0.18) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.wheel-center-cap {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #090b10;
  border: 2.5px solid rgba(248, 250, 252, 0.92);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.72), 0 0 18px rgba(99, 102, 241, 0.45);
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  z-index: 6;
}

.wheel-center-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.roulette-actions {
  display: grid;
  gap: 10px;
}

.pulse-btn {
  font-size: var(--fs-m);
  padding: 14px 24px;
  border-radius: var(--r-l);
  box-shadow: 0 0 20px rgba(var(--accent-rgb, 99, 102, 241), 0.35);
  transition: transform var(--dur-fast), box-shadow var(--dur-fast);
}
.pulse-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(var(--accent-rgb, 99, 102, 241), 0.5);
}

/* Карточка покупки */
.buy-spins-card {
  display: grid;
  gap: var(--sp-m);
  padding: var(--sp-l);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.spins-packs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 600px) {
  .spins-packs-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.spins-pack-btn {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.spins-pack-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: var(--surface-3);
}
.spins-pack-btn.popular {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.05);
}
.spins-pack-btn.premium {
  border-color: rgba(234, 179, 8, 0.4);
  background: rgba(234, 179, 8, 0.05);
}

.pack-badge {
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.pack-badge.hot {
  background: #22c55e;
  color: #fff;
  border: none;
}
.pack-badge.crown {
  background: #eab308;
  color: #000;
  border: none;
}

.pack-spins {
  font-size: var(--fs-s);
  color: var(--ink-2);
}
.pack-price {
  font-size: var(--fs-l);
  color: var(--ink-1);
}
.pack-save {
  font-size: var(--fs-2xs);
  color: var(--accent);
}

/* Своё количество */
.custom-spins-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--r-l);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.custom-spins-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-s);
}
.custom-spins-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.custom-spins-row .input {
  width: 90px;
  padding: 8px 12px;
}
.custom-spins-calc {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
}
.custom-spins-calc strong {
  font-size: var(--fs-m);
  color: var(--accent);
}

/* Таблица призов */
.prizes-table-box h3, .history-box h3 {
  font-size: var(--fs-s);
  margin-bottom: 8px;
  color: var(--ink-2);
}
.prizes-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.p-chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.p-chip.legendary { border-color: rgba(234, 179, 8, 0.4); color: #eab308; }
.p-chip.epic { border-color: rgba(168, 85, 247, 0.4); color: #a855f7; }
.p-chip.rare { border-color: rgba(56, 189, 248, 0.4); color: #38bdf8; }
.p-chip.common { color: var(--ink-2); }
.p-chip.muted { color: var(--ink-3); opacity: 0.7; }

/* История */
.history-list {
  display: grid;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  font-size: var(--fs-xs);
}

/* Модалка выигрыша */
.prize-modal-card {
  text-align: center;
  display: grid;
  gap: 12px;
  place-items: center;
  max-width: 360px;
}
.prize-modal-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #eab308;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.3);
  padding: 4px 12px;
  border-radius: 999px;
}
.prize-modal-icon {
  font-size: 54px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.3));
  animation: prizeBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
@keyframes prizeBounce {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Навигация подразделов бонусов (Рулетка / Кейсы / 30 дней) */
.bonuses-nav-seg {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px;
  border-radius: var(--r-xl);
  overflow-x: auto;
  max-width: 100%;
}
.bonuses-seg-btn {
  flex: 1 1 auto;
  padding: 10px 16px;
  border-radius: var(--r-l);
  font-size: var(--fs-s);
  font-weight: 650;
  color: var(--ink-2);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.bonuses-seg-btn:hover {
  color: var(--ink-1);
}
.bonuses-seg-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(var(--accent-rgb, 99, 102, 241), 0.35);
}

.luck-badge {
  font-size: var(--fs-2xs);
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(16, 185, 129, 0.2));
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

/* ==========================================================================
   Кейсы (Каталог и рулетка открытия в стиле CS:GO)
   ========================================================================== */
.cases-intro-box {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-m);
  padding: var(--sp-m);
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 4px;
}
.cases-intro-text h2 {
  font-size: var(--fs-l);
  margin-top: 2px;
}

.cases-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-m);
}

.case-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--sp-m);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.case-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-m);
}
.case-card.hot {
  border-color: rgba(168, 85, 247, 0.4);
}
.case-card.crown {
  border-color: rgba(245, 158, 11, 0.4);
}

.case-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.case-badge.hot {
  background: #a855f7;
  color: #fff;
  border: none;
}
.case-badge.crown {
  background: #f59e0b;
  color: #000;
  border: none;
}

.case-icon-box {
  width: 74px;
  height: 74px;
  margin: 10px auto 0;
  border-radius: 22px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.02) 70%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  font-size: 40px;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.35));
}

.case-card h3 {
  font-size: var(--fs-m);
  margin: 0;
  text-align: center;
}
.case-card p {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  margin: 0;
  text-align: center;
  line-height: 1.4;
  flex: 1 1 auto;
}

.case-meta {
  display: flex;
  justify-content: center;
  font-size: var(--fs-xs);
  padding: 6px 10px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  margin-top: auto;
}

.case-card-actions {
  display: flex;
  gap: 8px;
}
.case-card-actions .btn {
  flex: 1 1 50%;
  padding: 9px 10px;
  font-size: var(--fs-xs);
}

/* Панель открытия кейса (CS:GO рулетка) */
.case-opener-panel {
  display: grid;
  gap: var(--sp-m);
  padding: var(--sp-l);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-m);
}

.case-opener-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.case-roulette-container {
  position: relative;
  height: 154px;
  background: radial-gradient(ellipse at center, #111827 0%, #080c14 100%);
  border: 2px solid var(--line-strong);
  border-radius: var(--r-l);
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.85);
}

/* Затемнение по краям (Виньетка CS:GO) */
.case-roulette-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #080c14 0%, transparent 20%, transparent 80%, #080c14 100%);
  pointer-events: none;
  z-index: 6;
}

.case-roulette-pointer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  translate: -50% 0;
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  z-index: 10;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.9);
}
.case-roulette-pointer::before {
  content: "";
  position: absolute;
  top: 0;
  left: -7px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid #fbbf24;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}
.case-roulette-pointer::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -7px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid #fbbf24;
  filter: drop-shadow(0 -2px 4px rgba(0,0,0,0.6));
}

.case-roulette-track {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 0;
  display: flex;
  gap: 10px;
  will-change: transform;
}

.case-card-tile {
  width: 116px;
  height: 114px;
  flex: none;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(var(--c-rgb, 56, 189, 248), 0.12) 100%), #121824;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 4px solid var(--c, #38bdf8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 14px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 6px;
  gap: 6px;
}
.case-card-tile.legendary { border-bottom-color: #eab308; }
.case-card-tile.epic { border-bottom-color: #a855f7; }
.case-card-tile.rare { border-bottom-color: #38bdf8; }

.tile-icon {
  font-size: 34px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}
.tile-title {
  font-size: 10.5px;
  line-height: 1.25;
  font-weight: 650;
  color: #ffffff;
  max-width: 104px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: break-word;
}

.case-opener-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.case-opener-actions .btn {
  flex: 1 1 200px;
}

.case-drops-preview h3 {
  font-size: var(--fs-s);
  margin-bottom: 10px;
  color: var(--ink-2);
}
.case-drops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.drop-item-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-2xs);
  overflow-wrap: anywhere;
}
.drop-item-card.legendary { border-color: rgba(234, 179, 8, 0.4); color: #eab308; }
.drop-item-card.epic { border-color: rgba(168, 85, 247, 0.4); color: #a855f7; }
.drop-item-card.rare { border-color: rgba(56, 189, 248, 0.4); color: #38bdf8; }

/* ==========================================================================
   30 Дней ежедневной регистрации (Daily Check-in)
   ========================================================================== */
.checkin-panel {
  display: grid;
  gap: var(--sp-l);
  padding: var(--sp-l);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.checkin-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: var(--sp-m);
  border-bottom: 1px solid var(--line);
}
.checkin-hero-info {
  flex: 1 1 300px;
}
.checkin-hero-action {
  display: grid;
  gap: 6px;
  text-align: center;
}

/* Карточка прогресса серии */
.checkin-progress-card {
  display: grid;
  gap: 10px;
  padding: var(--sp-m);
  border-radius: var(--r-l);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.checkin-streak-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-s);
}
.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}
.streak-fire {
  font-size: 20px;
}
.streak-percent {
  font-size: var(--fs-xs);
  color: var(--accent);
  font-weight: 650;
}
.checkin-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.checkin-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #10b981 100%);
  transition: width 0.6s var(--ease);
}
.streak-milestones {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-2xs);
  color: var(--ink-3);
  flex-wrap: wrap;
  gap: 6px;
}

.checkin-calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}
@media (min-width: 768px) {
  .checkin-calendar-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.checkin-day-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--r-l);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-align: center;
  transition: all var(--dur) var(--ease);
  min-height: 108px;
}
.checkin-day-card.claimed {
  opacity: 0.55;
  background: var(--surface-3);
  border-color: transparent;
}
.checkin-day-card.current {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.14);
  box-shadow: 0 0 18px rgba(var(--accent-rgb, 99, 102, 241), 0.3);
  transform: scale(1.03);
  z-index: 2;
}
.checkin-day-card.upcoming {
  border-color: rgba(var(--accent-rgb, 99, 102, 241), 0.4);
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.05);
}
.checkin-day-card.special {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.06);
}

.day-num {
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-3);
}
.day-icon {
  font-size: 28px;
  line-height: 1;
}
.day-title {
  font-size: var(--fs-2xs);
  color: var(--ink-1);
  line-height: 1.25;
  hyphens: auto;
  word-break: break-word;
}
.day-status {
  font-size: 10px;
  font-weight: 700;
  color: #22c55e;
  margin-top: auto;
}
.day-status.ready {
  color: var(--accent);
  animation: pulseReady 1.4s infinite;
}
.day-status.upcoming-text {
  color: var(--ink-3);
}
@keyframes pulseReady {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.96); }
}

/* Единый официальный футер Mini App и watermark правообладателя. */
.official-ownership {
  margin-left: var(--sidebar-w);
  padding: 24px clamp(14px, 3vw, 44px) 32px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  line-height: 1.65;
  text-align: center;
}
.official-watermark {
  margin-bottom: 6px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.official-ownership-line { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 14px; color: var(--ink); }
.official-ownership-line span { color: var(--ink-3); }
.official-ownership a { color: var(--accent); }

/* Футер находится после .content, поэтому его нельзя защищать только
   внутренним padding-bottom контента. Оставляем место под fixed-навигацию
   Mini App и safe-area Telegram. */
@media (max-width: 1023px) {
  .official-ownership {
    margin-left: 0;
    margin-bottom: calc(96px + var(--safe-bottom));
  }
}
.official-docs-link { color: var(--ink-2); text-decoration: none; }
.official-docs-link:hover { color: var(--accent); text-decoration: underline; }

/* ==========================================================================
   Поделиться чатами (Модалка + Ссылки + Гостевая страница + Фото-лайтбокс)
   ========================================================================== */

/* Фото внутри чата (без кнопки скачивания, с зумом по клику) */
.chat-photo-card {
  margin: 4px 0 6px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-3);
  max-width: min(320px, 100%);
  position: relative;
}
.chat-media-preview {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.2s var(--ease);
}
.chat-media-preview:hover {
  transform: scale(1.015);
}
.chat-video-preview {
  display: block;
  width: 100%;
  max-width: min(320px, 100%);
  max-height: 300px;
  border-radius: 12px;
  margin: 4px 0 6px;
  background: #000;
}
.chat-audio-preview {
  display: block;
  width: min(280px, 100%);
  height: 38px;
  margin: 4px 0 6px;
}

/* Полноэкранный лайтбокс для просмотра фото */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(8, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  grid-template-rows: auto 1fr;
  animation: fadeIn 0.18s var(--ease) both;
}
.photo-lightbox[hidden] { display: none !important; }
.photo-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, var(--safe-top)) 18px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #f5f5f7;
}
.photo-lightbox-caption {
  font-size: var(--fs-s);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.photo-lightbox-stage {
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: auto;
}
.photo-lightbox-stage img {
  max-width: min(94vw, 1100px);
  max-height: 82vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
  object-fit: contain;
}

/* Кнопки редактирования, удаления и быстрого шеринга в чате */
.chat-edit-msg-btn,
.chat-del-msg-btn {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.chat-edit-msg-btn:hover {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--line);
}
.chat-del-msg-btn:hover {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

/* Главная кнопка «Поделиться чатами» в шапке раздела Чаты */
.chat-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.btn-share-chats {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 8px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line-strong));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface-2)), var(--surface));
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 18px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
  text-align: left;
}
.btn-share-chats:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 32%, var(--surface-2)), var(--surface-2));
  box-shadow: 0 10px 24px -6px var(--accent-glow);
}
.btn-share-chats:active {
  transform: scale(0.98);
}
.btn-share-chats-ico {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 10px -2px var(--accent-glow);
}
.btn-share-chats-ico .icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.btn-share-chats-copy {
  display: grid;
  line-height: 1.18;
  gap: 1px;
}
.btn-share-chats-copy strong {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.btn-share-chats-copy small {
  font-size: 0.66rem;
  color: var(--accent-onsoft);
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .chat-head-actions {
    width: 100%;
  }
  .btn-share-chats {
    flex: 1 1 auto;
    justify-content: center;
    padding: 8px 12px;
  }
}

/* Быстрая кнопка «Поделиться» в шапке открытого диалога */
.chat-share-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line-strong));
  background: color-mix(in srgb, var(--accent-soft) 75%, var(--surface));
  color: var(--accent-onsoft);
  font-size: var(--fs-2xs);
  font-weight: 680;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.chat-share-quick-btn .icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.1;
  flex: none;
}
.chat-share-quick-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
@media (max-width: 480px) {
  .chat-share-quick-btn span {
    display: none;
  }
  .chat-share-quick-btn {
    padding: 7px 9px;
  }
}
.chat-compose-banner.edit-banner .chat-compose-banner-accent {
  background: var(--warn, #f59e0b);
}

/* ==========================================================================
   Модалка «Поделиться чатами»
   ========================================================================== */
.share-modal-card {
  width: min(600px, 100%);
  max-height: min(90dvh, 840px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 20px;
  gap: 12px;
  overflow: hidden;
}
@media (max-width: 640px) {
  #chat-share-modal.modal {
    padding: 0;
    align-items: end;
  }
  .share-modal-card {
    width: 100%;
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
    padding: 16px 14px calc(16px + var(--safe-bottom));
    gap: 10px;
  }
}
.share-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.share-modal-head h3 {
  font-size: var(--fs-l);
  margin: 2px 0;
}
.share-modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.share-modal-tabs .modal-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--r-s);
  border: 1px solid transparent;
  background: transparent;
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.share-modal-tabs .modal-tab-btn.active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.share-modal-body {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 2px;
}
#share-create-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.share-section {
  display: grid;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
}
.share-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.share-counter-pill {
  padding: 3px 10px;
  border-radius: var(--r-round);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent-onsoft);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
}
.share-scope-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.share-scope-btn {
  padding: 9px 8px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 650;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.share-scope-btn:hover {
  color: var(--ink);
  border-color: var(--accent-ring);
}
.share-scope-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 12px -4px var(--accent-glow);
}

/* Пикер одного или нескольких чатов */
.share-chats-picker-wrap {
  display: grid;
  gap: 8px;
}
.share-selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 76px;
  overflow-y: auto;
  padding: 6px 8px;
  border-radius: var(--r-s);
  background: var(--surface);
  border: 1px dashed var(--accent-ring);
}
.share-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid var(--accent-ring);
  background: var(--accent-soft);
  color: var(--accent-onsoft);
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.share-selected-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}
.share-selected-chip b {
  font-size: 0.68rem;
  opacity: 0.8;
}
.share-selected-chip:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.share-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.share-picker-search-wrap {
  position: relative;
  flex: 1 1 180px;
  min-width: 0;
}
.share-picker-search {
  width: 100%;
  padding: 8px 12px 8px 34px !important;
  border-radius: var(--r-s) !important;
  border: 1px solid var(--line-strong) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  font-size: var(--fs-xs) !important;
}
.share-bulk-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.btn-xs {
  padding: 6px 10px;
  font-size: var(--fs-2xs);
  min-height: 32px;
  border-radius: var(--r-xs);
}

.share-chats-picker-list {
  max-height: 240px;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--bg);
}
.share-chat-pick-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 8px 11px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.share-chat-pick-item:hover {
  border-color: var(--accent-ring);
  background: var(--surface-2);
}
.share-chat-pick-item:active {
  transform: scale(0.99);
}
.share-chat-pick-item.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}
.share-chat-pick-item input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.share-pick-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid var(--line-strong);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  transition: all 0.15s var(--ease);
}
.share-pick-check.is-radio {
  border-radius: 50%;
}
.share-pick-check::after {
  content: "✓";
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-ink);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.15s var(--ease);
}
.share-chat-pick-item.is-selected .share-pick-check {
  background: var(--accent);
  border-color: var(--accent);
}
.share-chat-pick-item.is-selected .share-pick-check::after {
  opacity: 1;
  transform: scale(1);
}

.tg-avatar.tg-avatar-sm {
  width: 34px;
  height: 34px;
  font-size: 0.74rem;
}
.tg-avatar.tg-avatar-xs {
  width: 24px;
  height: 24px;
  font-size: 0.62rem;
}
.share-chat-pick-info {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 2px;
  line-height: 1.25;
}
.share-chat-pick-info strong {
  font-size: var(--fs-xs);
  font-weight: 680;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-chat-pick-info small {
  font-size: var(--fs-2xs);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Права доступа (2x2 сетка) */
.share-perms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 500px) {
  .share-perms-grid { grid-template-columns: 1fr; }
}
.share-perm-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.share-perm-card:has(input:checked) {
  border-color: var(--accent-ring);
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
}
.share-perm-card.is-locked {
  opacity: 0.9;
  cursor: default;
}
.share-perm-card input {
  margin-top: 2px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex: none;
}
.share-perm-info {
  display: grid;
  gap: 2px;
  line-height: 1.28;
}
.share-perm-info strong { font-size: var(--fs-xs); color: var(--ink); }
.share-perm-info small { font-size: var(--fs-2xs); color: var(--ink-2); }

/* Чипы выбора срока действия ссылки */
.share-ttl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.share-ttl-chip {
  padding: 7px 12px;
  border-radius: var(--r-round);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-2xs);
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s;
}
.share-ttl-chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.share-custom-ttl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.share-custom-ttl-row input {
  width: 96px;
  padding: 7px 10px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.share-custom-ttl-row select {
  padding: 7px 28px 7px 10px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background-color: var(--surface);
  color: var(--ink);
}

.share-two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 520px) {
  .share-two-cols { grid-template-columns: 1fr; }
}
.share-pass-row {
  display: flex;
  gap: 6px;
}
.share-pass-row input { flex: 1; min-width: 0; }

/* Результат создания ссылки и карточки активных ссылок */
.share-created-box {
  padding: 16px;
  border-radius: var(--r-l);
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface-2));
  display: grid;
  gap: 10px;
}
.share-created-badge {
  justify-self: start;
  padding: 3px 10px;
  border-radius: var(--r-round);
  background: var(--ok-soft);
  color: var(--ok);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
}
.share-created-sub {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  margin: 0;
}
.share-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.share-url-input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-xs);
}
.share-created-meta {
  font-size: var(--fs-2xs);
  color: var(--ink-2);
}
.share-created-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-links-list {
  display: grid;
  gap: 10px;
}
.share-link-card {
  padding: 13px 15px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  display: grid;
  gap: 8px;
}
.share-link-card.is-expired { opacity: 0.65; }
.share-link-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.share-link-sub { font-size: var(--fs-2xs); word-break: break-all; }
.share-link-pills,
.shared-perms-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.share-perm-pill,
.share-meta-pill {
  padding: 3px 9px;
  border-radius: var(--r-round);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink);
}
.share-meta-pill.warn {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--line));
  color: var(--warn);
}
.share-link-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.danger-text { color: var(--danger) !important; }

/* ==========================================================================
   Гостевая страница расшаренных чатов (/chats/{token}/)
   ========================================================================== */
.shared-chats-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.shared-topbar {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 10px) clamp(12px, 2.5vw, 24px) 10px;
}
.shared-topbar-end {
  gap: 8px;
}
.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.theme-swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.theme-swatch span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: block;
}
.theme-swatch.active,
.theme-swatch[aria-checked="true"] {
  border-color: var(--accent);
  transform: scale(1.08);
}

.shared-main-shell {
  flex: 1 1 auto;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 0 clamp(10px, 2.5vw, 24px) clamp(10px, 2vw, 20px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.shared-gate-wrap {
  flex: 1 1 auto;
  min-height: calc(100dvh - 120px);
  display: grid;
  place-items: center;
  padding: 16px 6px;
}
.shared-gate-card {
  width: min(440px, 100%);
  padding: clamp(20px, 4vw, 32px);
  border-radius: var(--r-2xl);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-m);
  display: grid;
  gap: 12px;
  text-align: center;
}
.shared-gate-card.is-danger {
  border-color: color-mix(in srgb, var(--danger) 50%, var(--line));
}
.shared-gate-ico {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 2px;
}
.shared-attempts-pill {
  padding: 8px 12px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-2);
}
.shared-unlock-form {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}
.shared-pass-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-m);
  text-align: center;
}
.shared-gate-error {
  padding: 9px 12px;
  border-radius: var(--r-s);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.shared-ban-timer {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: var(--r-l);
  background: var(--danger-soft);
  color: var(--danger);
}
.shared-ban-timer strong {
  font-size: 1.9rem;
  letter-spacing: 0.06em;
}

.shared-chats-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.shared-info-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--r-l);
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.shared-info-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}
.shared-info-left strong {
  font-size: var(--fs-s);
  color: var(--ink);
}
.shared-info-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Панель быстрого переключения между несколькими расшаренными чатами */
.shared-chats-quickbar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 6px;
  scrollbar-width: thin;
}
.shared-quick-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 220px;
  padding: 5px 11px 5px 6px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.shared-quick-pill:hover {
  border-color: var(--accent-ring);
  color: var(--ink);
}
.shared-quick-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 12px -3px var(--accent-glow);
}
.shared-quick-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shared-quick-del {
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--danger-soft);
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}
.shared-quick-pill.active .shared-quick-del {
  background: rgba(0, 0, 0, 0.22);
  color: #ffffff;
}

.shared-chat-browser {
  flex: 1 1 auto;
  height: calc(100dvh - 185px);
  min-height: 500px;
  max-height: 860px;
}
@media (max-width: 860px) {
  .shared-topbar {
    margin-bottom: 6px;
    padding: calc(var(--safe-top) + 8px) 10px 8px;
  }
  .shared-main-shell {
    padding: 0 8px calc(8px + var(--safe-bottom));
  }
  .shared-info-strip {
    padding: 8px 11px;
    gap: 8px;
  }
  .shared-info-left strong {
    font-size: var(--fs-xs);
  }
  .shared-chat-browser {
    height: calc(100dvh - 170px);
    min-height: 440px;
  }
}

.shared-readonly-bar {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 560;
  text-align: center;
}
.toast-box {
  position: fixed;
  z-index: 250;
  left: 50%;
  translate: -50% 0;
  bottom: 24px;
  display: grid;
  gap: 8px;
  width: min(400px, calc(100vw - 28px));
  pointer-events: none;
}

/* ==========================================================================
   Игры И Бонусы · Валюта «Нивик» · Краш (Ракета) · Переводы · Топ-100
   ========================================================================== */

#tab-bonuses,
#tab-bonuses * {
  box-sizing: border-box;
}
#tab-bonuses {
  max-width: 100%;
  overflow-x: hidden;
}
#tab-bonuses .bonuses-layout,
#tab-bonuses .roulette-main-card,
#tab-bonuses .buy-spins-card,
#tab-bonuses .checkin-panel,
#tab-bonuses .cases-catalog-grid,
#tab-bonuses .case-opener-panel {
  min-width: 0;
  max-width: 100%;
}
#tab-bonuses .wheel-stage {
  width: min(320px, 100%);
  height: auto;
  aspect-ratio: 1 / 1;
}
@media (max-width: 480px) {
  #tab-bonuses .roulette-main-card,
  #tab-bonuses .buy-spins-card,
  #tab-bonuses .checkin-panel,
  #tab-bonuses .transfer-card,
  #tab-bonuses .transfer-history-card,
  #tab-bonuses .leaderboard-panel,
  #tab-bonuses .crash-main-card,
  #tab-bonuses .crash-players-card {
    padding: 14px 12px;
  }
}

/* Навигация внутри «Игры И Бонусы» — адаптивная сетка без вылезания за края */
.bonuses-nav-seg {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 6px;
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.bonuses-seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 10px 8px;
  border-radius: var(--r-l);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  transition: all var(--dur) var(--ease);
}
.bonuses-seg-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.bonuses-seg-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(var(--accent-rgb, 99, 102, 241), 0.35);
}
@media (max-width: 820px) {
  .bonuses-nav-seg {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 420px) {
  .bonuses-nav-seg {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
  }
  .bonuses-seg-btn {
    padding: 9px 6px;
    font-size: 0.74rem;
  }
}

/* Баннер кошелька «Нивик» (только в разделе Игры И Бонусы) */
.nivik-wallet-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: clamp(14px, 2.5vw, 22px);
  border-radius: var(--r-xl);
  border: 1px solid rgba(245, 158, 11, 0.45);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(245, 158, 11, 0.18) 0%, transparent 55%),
    radial-gradient(100% 120% at 100% 100%, rgba(16, 185, 129, 0.14) 0%, transparent 60%),
    var(--surface);
  box-shadow: 0 10px 30px -12px rgba(245, 158, 11, 0.25);
  min-width: 0;
  max-width: 100%;
}
.nivik-wallet-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 260px;
  min-width: 0;
}
.nivik-coin-emblem {
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(234, 179, 8, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 18px rgba(245, 158, 11, 0.25);
}
.nivik-wallet-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.nivik-wallet-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f59e0b;
}
.nivik-wallet-amount-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.nivik-balance-num {
  font-size: clamp(1.25rem, 3.2vw, 1.65rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}
.nivik-rub-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.nivik-wallet-hint {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  line-height: 1.35;
}
.nivik-wallet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
.nivik-wallet-actions .btn {
  flex: 1 1 130px;
  justify-content: center;
  text-align: center;
}
@media (max-width: 420px) {
  .nivik-coin-emblem {
    width: 44px;
    height: 44px;
    font-size: 24px;
    border-radius: 14px;
  }
  .nivik-wallet-actions .btn {
    flex: 1 1 calc(50% - 6px);
    padding: 8px 8px;
    font-size: 0.74rem;
  }
}

/* Метод оплаты «Оплатить в Нивиках» */
.payment-method.payment-method-nivik {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), var(--surface-2));
}
.payment-method.payment-method-nivik.active {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.28);
}

/* ==========================================================================
   Игра «КРАШ» (Crash Rocket Game)
   ========================================================================== */
.crash-game-layout {
  display: grid;
  gap: var(--sp-m);
  min-width: 0;
  max-width: 100%;
}
.crash-main-card,
.crash-players-card {
  display: grid;
  gap: 14px;
  padding: var(--sp-l);
  border-radius: var(--r-xl);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  min-width: 0;
  max-width: 100%;
}
.crash-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.crash-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.crash-history-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
}
.crash-hist-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
}
.crash-hist-chip.low {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}
.crash-hist-chip.mid {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
}
.crash-hist-chip.high {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.12);
}
.crash-hist-chip.epic {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(168, 85, 247, 0.2));
}

.crash-stage-wrap {
  position: relative;
  width: 100%;
  height: clamp(220px, 42vw, 310px);
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background:
    radial-gradient(circle at 20% 85%, rgba(56, 189, 248, 0.14), transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.18), transparent 55%),
    linear-gradient(180deg, #060913 0%, #0d1326 60%, #111827 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.65);
}
.crash-stage-wrap[data-phase="crashed"] {
  border-color: rgba(239, 68, 68, 0.6);
  background:
    radial-gradient(circle at 50% 50%, rgba(239, 68, 68, 0.24), transparent 60%),
    linear-gradient(180deg, #14070b 0%, #1c0b12 65%, #111827 100%);
}
.crash-stage-wrap[data-phase="flying"] {
  border-color: rgba(16, 185, 129, 0.55);
}
.crash-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.crash-hud-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  gap: 6px;
  z-index: 2;
}
.crash-phase-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  backdrop-filter: blur(6px);
}
.crash-stage-wrap[data-phase="flying"] .crash-phase-badge {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.45);
}
.crash-stage-wrap[data-phase="crashed"] .crash-phase-badge {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(127, 29, 29, 0.45);
}
.crash-mult-display {
  font-size: clamp(2.3rem, 8vw, 3.8rem);
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 6px 28px rgba(56, 189, 248, 0.55);
  letter-spacing: -0.03em;
  transition: color 0.15s ease, transform 0.12s ease;
}
.crash-stage-wrap[data-phase="flying"] .crash-mult-display {
  color: #4ade80;
  text-shadow: 0 6px 32px rgba(74, 222, 128, 0.55);
}
.crash-stage-wrap[data-phase="crashed"] .crash-mult-display {
  color: #f87171;
  text-shadow: 0 6px 28px rgba(239, 68, 68, 0.65);
}
.crash-substatus {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: rgba(226, 232, 240, 0.88);
  background: rgba(15, 23, 42, 0.68);
  padding: 4px 12px;
  border-radius: 999px;
}

.crash-controls-card {
  padding: 14px;
  border-radius: var(--r-l);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.crash-bet-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
  align-items: center;
}
@media (max-width: 680px) {
  .crash-bet-row {
    grid-template-columns: 1fr;
  }
}
.crash-bet-input-wrap {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.crash-bet-field {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-m);
  padding: 4px 10px;
  gap: 8px;
}
.crash-coin-prefix {
  font-size: 1.1rem;
  flex: none;
}
.crash-bet-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 6px 4px !important;
  font-size: var(--fs-m) !important;
  font-weight: 700;
  width: 100%;
  min-width: 0;
  color: var(--ink);
}
.crash-bet-suffix {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
}
.crash-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.crash-chip {
  flex: 1 1 auto;
  min-width: 42px;
  padding: 6px 9px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-2xs);
  font-weight: 750;
  cursor: pointer;
  transition: all 0.15s;
}
.crash-chip:hover {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--surface-3);
}
.crash-action-col {
  display: grid;
  gap: 6px;
}
.crash-action-btn {
  width: 100%;
  min-height: 54px;
  font-size: var(--fs-m);
  font-weight: 800;
  border-radius: var(--r-l);
  justify-content: center;
  text-align: center;
}
.crash-action-btn.is-cancel {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border-color: #f59e0b;
  box-shadow: 0 8px 22px -6px rgba(245, 158, 11, 0.55);
}
.crash-action-btn.is-cashout {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border-color: #10b981;
  box-shadow: 0 8px 26px -4px rgba(16, 185, 129, 0.65);
  animation: cashoutPulse 1s infinite alternate;
}
@keyframes cashoutPulse {
  from { transform: scale(1); }
  to { transform: scale(1.02); }
}

/* Список игроков в текущем раунде Краша */
.crash-players-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.crash-players-head h3 {
  margin: 2px 0 0;
  font-size: var(--fs-m);
}
.crash-players-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.crash-stat-pill {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.crash-stat-pill.gold {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.1);
}
.crash-players-list {
  display: grid;
  gap: 7px;
  max-height: 310px;
  overflow-y: auto;
}
.crash-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
}
.crash-player-row.is-me {
  border-color: rgba(var(--accent-rgb, 99, 102, 241), 0.55);
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.1);
}
.crash-player-row.cashed {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
}
.crash-player-row.lost {
  border-color: rgba(239, 68, 68, 0.35);
  opacity: 0.72;
}
.crash-player-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 650;
  color: var(--ink);
}
.crash-player-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crash-player-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.crash-player-mult {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  background: var(--surface-3);
  color: var(--ink-2);
}
.crash-player-row.cashed .crash-player-mult {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}
.crash-player-row.lost .crash-player-mult {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

/* ==========================================================================
   Перевод Нивиков и Топ-100 Богачей
   ========================================================================== */
.transfer-card,
.transfer-history-card,
.leaderboard-panel {
  display: grid;
  gap: var(--sp-m);
  padding: var(--sp-l);
  border-radius: var(--r-xl);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  min-width: 0;
  max-width: 100%;
}
.transfer-limit-box {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--r-l);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.transfer-limit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--fs-xs);
}
.transfer-form {
  display: grid;
  gap: 12px;
}

.leaderboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.leaderboard-my-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--r-l);
  background: var(--surface-2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: var(--fs-xs);
}
.leaderboard-list {
  display: grid;
  gap: 8px;
  max-height: 540px;
  overflow-y: auto;
}
.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-s);
}
.leaderboard-row.is-me {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb, 99, 102, 241), 0.12);
}
.leaderboard-row.rank-1 {
  border-color: rgba(234, 179, 8, 0.55);
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.14), var(--surface-2));
}
.leaderboard-row.rank-2 {
  border-color: rgba(148, 163, 184, 0.5);
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.12), var(--surface-2));
}
.leaderboard-row.rank-3 {
  border-color: rgba(217, 119, 6, 0.5);
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.12), var(--surface-2));
}
.leaderboard-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.leaderboard-rank {
  min-width: 34px;
  height: 28px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 800;
  background: var(--surface-3);
  color: var(--ink-2);
  flex: none;
}
.leaderboard-row.rank-1 .leaderboard-rank { background: #eab308; color: #000; }
.leaderboard-row.rank-2 .leaderboard-rank { background: #94a3b8; color: #000; }
.leaderboard-row.rank-3 .leaderboard-rank { background: #d97706; color: #fff; }
.leaderboard-name {
  font-weight: 650;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leaderboard-balance {
  font-family: var(--font-mono);
  font-weight: 800;
  color: #fbbf24;
  white-space: nowrap;
  flex: none;
}

/* ==========================================================================
   Магазин Нивиков (покупка валюты по 0.6 ₽ за Нивик)
   ========================================================================== */
.niviks-buy-card {
  border-color: rgba(245, 158, 11, 0.38);
  background:
    radial-gradient(ellipse at 10% 0%, rgba(245, 158, 11, 0.14), transparent 55%),
    var(--surface);
}
.niviks-buy-wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: var(--fs-xs);
  color: var(--ink);
}
.niviks-buy-wallet-pill strong {
  color: #fbbf24;
  font-weight: 800;
}

/* ==========================================================================
   Общий каркас аркадных игр: Мины (5x5), Башня (15 этажей), Upgrader
   ========================================================================== */
.arcade-game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-l);
  min-width: 0;
  max-width: 100%;
}
.arcade-main-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-m);
  padding: var(--sp-l);
  border-radius: var(--r-xl);
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.12), transparent 65%),
    var(--surface);
  box-shadow: var(--shadow-s);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.arcade-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.arcade-badge-group,
.arcade-mult-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.arcade-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.arcade-status-pill.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}
.arcade-status-pill.won {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}
.arcade-status-pill.lost {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.48);
  color: #f87171;
}
.arcade-info-pill,
.arcade-mult-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-2);
}
.arcade-mult-pill strong {
  color: var(--ink);
}
.arcade-mult-pill.next {
  border-color: rgba(16, 185, 129, 0.38);
  background: rgba(16, 185, 129, 0.1);
}
.arcade-mult-pill.next strong {
  color: #34d399;
}

/* Лента множителей по шагам (Мины) */
.arcade-ladder-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding: 4px 2px 6px;
  scrollbar-width: thin;
}
.arcade-ladder-chip {
  flex: 0 0 auto;
  display: grid;
  gap: 2px;
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-align: center;
  min-width: 72px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.arcade-ladder-chip .ladder-step {
  font-size: 0.66rem;
  color: var(--ink-3);
  font-weight: 650;
}
.arcade-ladder-chip .ladder-mult {
  font-size: var(--fs-xs);
  color: var(--ink);
  font-weight: 800;
}
.arcade-ladder-chip.done {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.12);
}
.arcade-ladder-chip.done .ladder-mult {
  color: #34d399;
}
.arcade-ladder-chip.current {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.22);
}
.arcade-ladder-chip.next {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.12);
}
.arcade-ladder-chip.next .ladder-mult {
  color: #fbbf24;
}

/* ==========================================================================
   Игра «Мины» (5x5)
   ========================================================================== */
.mines-board-stage {
  display: grid;
  place-items: center;
  padding: clamp(12px, 2.5vw, 22px);
  border-radius: var(--r-xl);
  background:
    radial-gradient(circle at 50% 45%, rgba(16, 185, 129, 0.08), rgba(7, 9, 14, 0.94) 75%);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.55);
}
.mines-grid {
  width: min(390px, 100%);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(7px, 1.8vw, 11px);
  aspect-ratio: 1 / 1;
}
.mines-cell {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.11);
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.96));
  box-shadow: 0 5px 0 rgba(7, 10, 19, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 4px;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  user-select: none;
}
.mines-cell:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.65);
  background: linear-gradient(160deg, rgba(45, 58, 84, 0.95), rgba(23, 33, 56, 0.98));
}
.mines-cell:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(7, 10, 19, 0.85);
}
.mines-cell.is-idle {
  opacity: 0.85;
  cursor: default;
}
.mines-cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.05;
}
.mines-cell-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}
.mines-cell-icon {
  font-size: clamp(1.15rem, 3.8vw, 1.5rem);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}
.mines-cell-mult {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #d1fae5;
}
.mines-cell.is-opening {
  animation: minesPulseOpen 0.35s ease infinite alternate;
}
.mines-cell.is-safe {
  border-color: rgba(16, 185, 129, 0.75);
  background: radial-gradient(circle at 50% 30%, rgba(16, 185, 129, 0.38), rgba(6, 78, 59, 0.92));
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  animation: minesPopIn 0.32s cubic-bezier(0.18, 1.3, 0.4, 1) both;
}
.mines-cell.is-bomb-hit {
  border-color: #ef4444;
  background: radial-gradient(circle at 50% 35%, rgba(239, 68, 68, 0.55), rgba(127, 29, 29, 0.95));
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.55);
  animation: minesBombBlast 0.44s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.mines-cell.is-bomb-hit .mines-cell-mult {
  color: #fecaca;
}
.mines-cell.is-bomb-revealed {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(127, 29, 29, 0.38);
  opacity: 0.82;
}
.mines-cell.is-safe-dim {
  opacity: 0.42;
}

.mines-bombs-selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.mines-bombs-seg {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mines-bomb-btn {
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}
.mines-bomb-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--ink);
}
.mines-bomb-btn.active {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #f87171;
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.mines-bomb-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@keyframes minesPopIn {
  0% { transform: scale(0.75); opacity: 0.4; }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes minesBombBlast {
  0% { transform: scale(0.7); }
  40% { transform: scale(1.14) rotate(-4deg); }
  75% { transform: scale(0.96) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes minesPulseOpen {
  from { transform: scale(0.95); }
  to { transform: scale(1.03); }
}

/* ==========================================================================
   Игра «Башня» (15 этажей, 2 клетки на этаж)
   ========================================================================== */
.tower-stage-wrap {
  border-radius: var(--r-xl);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.14), rgba(8, 10, 16, 0.96) 72%);
  border: 1px solid var(--line-strong);
  padding: clamp(10px, 2vw, 16px);
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.55);
}
.tower-floors-list {
  display: grid;
  gap: 7px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.tower-floor-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(15, 23, 42, 0.65);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
@media (max-width: 440px) {
  .tower-floor-row {
    grid-template-columns: 74px 1fr;
    gap: 6px;
    padding: 6px 8px;
  }
}
.tower-floor-row.is-current {
  border-color: rgba(245, 158, 11, 0.75);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(30, 41, 59, 0.9));
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.2);
}
.tower-floor-row.is-passed {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(6, 78, 59, 0.25);
}
.tower-floor-row.is-failed {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(127, 29, 29, 0.28);
}
.tower-floor-row.is-locked {
  opacity: 0.68;
}
.tower-floor-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tower-floor-num {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ink-3);
  text-transform: uppercase;
}
.tower-floor-row.is-current .tower-floor-num {
  color: #fbbf24;
}
.tower-floor-mult {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--ink);
}
.tower-doors-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tower-door-btn {
  height: 40px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 41, 59, 0.85);
  color: var(--ink-2);
  font-size: clamp(0.7rem, 2.7vw, 0.8rem);
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.tower-door-btn.is-active-door {
  border-color: rgba(245, 158, 11, 0.65);
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.24), rgba(30, 41, 59, 0.95));
  color: #fef3c7;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.18);
}
.tower-door-btn.is-active-door:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #fbbf24;
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.36), rgba(30, 41, 59, 0.98));
}
.tower-door-btn.is-safe-picked {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.28);
  color: #d1fae5;
  animation: minesPopIn 0.28s ease both;
}
.tower-door-btn.is-trap-hit {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.36);
  color: #fecaca;
  animation: minesBombBlast 0.38s ease both;
}
.tower-door-btn.is-trap-revealed {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  opacity: 0.72;
}
.tower-door-btn.is-safe-revealed {
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  opacity: 0.72;
}

/* ==========================================================================
   Игра «Upgrader» (колесо с целевым сектором и вращающейся стрелкой)
   ========================================================================== */
.upgrader-stage-wrap {
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 28px);
  border-radius: var(--r-xl);
  background:
    radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.11), rgba(7, 9, 14, 0.95) 72%);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
}
.upgrader-wheel-box {
  position: relative;
  width: min(310px, 82vw);
  height: min(310px, 82vw);
  display: grid;
  place-items: center;
}
.upgrader-ambient-glow {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.16), transparent 70%);
  pointer-events: none;
  transition: background 0.35s ease, transform 0.35s ease;
}
.upgrader-wheel-box.is-win .upgrader-ambient-glow {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.42), transparent 72%);
  transform: scale(1.06);
}
.upgrader-wheel-box.is-loss .upgrader-ambient-glow {
  background: radial-gradient(circle, rgba(239, 68, 68, 0.36), transparent 72%);
}
.upgrader-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.5));
}
#upgrader-win-arc {
  transition: stroke-dasharray 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Вращающийся ротор со стрелкой */
.upgrader-rotor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
  transform: rotate(0deg);
}
.upgrader-needle {
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  width: 24px;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.upgrader-needle-tip {
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 24px solid #fbbf24;
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.85));
}
.upgrader-needle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  margin-top: -18px;
  box-shadow: 0 0 8px #fbbf24;
}

.upgrader-center-hud {
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  pointer-events: none;
}
.upgrader-hud-label {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.upgrader-hud-chance {
  font-size: clamp(1.45rem, 5vw, 1.95rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.15;
  margin-top: 2px;
}
.upgrader-hud-mult {
  font-size: var(--fs-s);
  font-weight: 800;
  color: #34d399;
  margin-top: 2px;
}
.upgrader-hud-payout {
  font-size: 0.7rem;
  color: var(--ink-2);
  margin-top: 3px;
}

.upgrader-mult-selector-box {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.upgrader-mult-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.upgrader-custom-mult-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-weight: 800;
  color: #34d399;
}
.upgrader-mult-input {
  width: 78px;
  border: none !important;
  background: transparent !important;
  padding: 2px 0 !important;
  font-size: var(--fs-s) !important;
  font-weight: 800;
  color: var(--ink);
  text-align: right;
}
.upgrader-mult-input:focus {
  outline: none;
}
.upgrader-mult-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.upgrader-mult-presets .crash-chip.active {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #34d399;
  color: #fff;
}

.shake-error {
  animation: stageShakeError 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes stageShakeError {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* ==========================================================================
   Фирменный логотип NeverLost (N), фиксы сетки, мобильной адаптивности и игр
   ========================================================================== */
html,
body {
  max-width: 100vw;
  overflow-x: clip;
}
.app-shell,
.content {
  min-width: 0;
  max-width: 100vw;
  overflow-x: clip;
}
.bonuses-subtab {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}
.bonuses-subtab:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-m);
}
.crash-game-layout,
.crash-main-card,
.crash-players-card,
.transfer-card,
.transfer-history-card,
.leaderboard-panel,
.leaderboard-list,
.tower-floors-list {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
}
.leaderboard-row {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.leaderboard-left {
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
}
.leaderboard-name {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mines-cell.is-idle {
  opacity: 0.96;
  cursor: pointer;
}
.tower-door-btn:not(:disabled) {
  cursor: pointer;
}
.tower-floor-row.is-locked .tower-door-btn:not(:disabled):hover {
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--ink);
}

@media (max-width: 480px) {
  #tab-bonuses .arcade-main-card {
    padding: 14px 12px;
  }
  .upgrader-stage-wrap {
    padding: 12px 8px;
    max-width: 100%;
    overflow: hidden;
  }
  .upgrader-wheel-box {
    width: min(268px, 100%);
    height: min(268px, 72vw);
  }
  .mines-board-stage {
    padding: 10px;
  }
  .tower-stage-wrap {
    padding: 8px;
  }
}

/* Фирменный логотип в шапке, сайдбаре, на главной и в играх */
.brand-mark.has-logo {
  padding: 0;
  overflow: hidden;
  background: #050507;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-hero-head {
  align-items: center;
}
.home-hero-brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}
.home-hero-logo-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 18px;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent), rgba(245, 158, 11, 0.85), rgba(99, 102, 241, 0.9));
  box-shadow: 0 10px 26px -6px var(--accent-glow), 0 4px 12px rgba(0, 0, 0, 0.35);
  animation: heroLogoFloat 4.5s ease-in-out infinite;
}
.home-hero-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  background: #000;
  display: block;
}
.home-hero-logo-ring {
  position: absolute;
  inset: -3px;
  border-radius: 21px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  pointer-events: none;
}
.home-hero-copy {
  min-width: 0;
  flex: 1 1 auto;
}
@keyframes heroLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@media (max-width: 480px) {
  .home-hero-logo-wrap {
    width: 54px;
    height: 54px;
    border-radius: 15px;
  }
  .home-hero-logo-img {
    border-radius: 13px;
  }
  .home-hero-brand-row {
    gap: 12px;
  }
}

.quick-card-featured {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line-strong));
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--surface);
}
.quick-icon-logo {
  padding: 0 !important;
  overflow: hidden;
  background: #000 !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
}
.quick-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nivik-coin-emblem {
  position: relative;
  overflow: visible;
  padding: 2px;
  background: linear-gradient(135deg, #f59e0b, #6366f1);
}
.nivik-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 15px;
  background: #000;
  display: block;
}
@media (max-width: 420px) {
  .nivik-logo-img {
    border-radius: 12px;
  }
}
.nivik-coin-subbadge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid rgba(245, 158, 11, 0.65);
  display: grid;
  place-items: center;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.upgrader-hud-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.18);
  margin-bottom: 3px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}

.official-ownership-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.official-footer-logo {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ================== PIXELFX GLITCH & RETRO SCANLINES ================== */
.pixelfx-glitching {
  animation: pixelfxShake 0.42s steps(4) forwards;
  filter: drop-shadow(-3px 0 0 rgba(239, 68, 68, 0.85)) drop-shadow(3px 0 0 rgba(56, 189, 248, 0.85));
}

@keyframes pixelfxShake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -1px); }
  80% { transform: translate(2px, 1px); }
  100% { transform: translate(0, 0); }
}

/* ================== ARCADE LEGAL DISCLAIMER CARD (REDESIGNED) ================== */
.arcade-legal-card {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: var(--r-lg, 16px);
  padding: 12px 16px;
  margin-bottom: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.arcade-legal-card:hover {
  background: rgba(16, 185, 129, 0.07);
  border-color: rgba(16, 185, 129, 0.3);
}
.arcade-legal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.arcade-legal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #34d399;
  text-transform: uppercase;
}
.arcade-legal-pill svg {
  width: 14px;
  height: 14px;
  stroke: #10b981;
}
.arcade-legal-link {
  font-size: 11px;
  font-weight: 600;
  color: #10b981;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.arcade-legal-link:hover {
  opacity: 1;
  text-decoration: underline;
}
.arcade-legal-text {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted, #94a3b8);
  margin: 0;
}
.arcade-legal-text strong {
  color: #f1f5f9;
  font-weight: 600;
}

/* ================== PIXELFX SHOWCASE BAR ================== */
.pixelfx-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: var(--r-md, 12px);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.2);
  backdrop-filter: blur(8px);
  scrollbar-width: none;
}
.pixelfx-bar::-webkit-scrollbar {
  display: none;
}
.pixelfx-bar-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #38bdf8;
  white-space: nowrap;
  font-family: monospace, monospace;
}
.pixelfx-bar-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pixelfx-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.pixelfx-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  transform: translateY(-1px);
}
.pixelfx-btn:active {
  transform: scale(0.95);
}

/* ================== UPGRADER ENHANCEMENTS & HISTORY STRIP ================== */
.upgrader-history-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  margin-top: 14px;
  scrollbar-width: none;
}
.upgrader-history-strip::-webkit-scrollbar {
  display: none;
}
.upgrader-history-chip {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.upgrader-history-chip.is-win {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}
.upgrader-history-chip.is-loss {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* ================== GENERAL SMOOTH ANIMATIONS & MICRO-INTERACTIONS ================== */
.tab-panel:not([hidden]) {
  animation: tabFadeSlide 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tabFadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bonuses-seg-btn {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.18s ease, color 0.18s ease;
}
.bonuses-seg-btn:active {
  transform: scale(0.95);
}
.bonuses-seg-btn.active {
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.pulse-btn {
  animation: arcadePulse 2.6s infinite ease-in-out;
}

@keyframes arcadePulse {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
  }
  50% {
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.65);
    transform: translateY(-1px);
  }
}

.btn:active,
.crash-chip:active {
  transform: scale(0.96);
}

/* ================== NEW YEAR / WINTER THEME ENHANCEMENTS (REFINED & ACCURATE) ================== */

/* Аккуратная праздничная микро-шапочка Santa Hat, идеально выровненная по логотипу */
.brand-mark.has-logo {
  position: relative;
  overflow: visible !important;
}
.brand-mark.has-logo::after {
  content: "";
  position: absolute;
  top: -7px;
  right: -5px;
  width: 17px;
  height: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='%23e11d48' d='M6 24 C10 12 18 4 27 6 C24 10 23 15 22 24 Z'/%3E%3Cpath fill='%23be123c' d='M10 24 C14 14 20 8 27 6 C24 10 23 15 22 24 Z' opacity='0.35'/%3E%3Cellipse cx='14' cy='25' rx='10' ry='3.5' fill='%23ffffff'/%3E%3Ccircle cx='28' cy='7' r='3.5' fill='%23ffffff'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  transform: rotate(6deg);
  transition: transform 0.2s ease;
  z-index: 6;
}
.brand-mark.has-logo:hover::after {
  transform: rotate(12deg) scale(1.1);
}

/* Аккуратная зимняя окантовка и морозный блеск у логотипа в герое */
.home-hero-logo-wrap {
  position: relative;
}
.home-hero-logo-wrap::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 19px;
  border: 1px solid rgba(186, 230, 253, 0.45);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
  pointer-events: none;
}

/* Аккуратная тонкая зимняя полоса под шапкой (северное сияние/хрусталь) */
.topbar {
  position: relative;
}
.topbar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(56, 189, 248, 0.2) 20%,
    rgba(16, 185, 129, 0.45) 40%,
    rgba(251, 191, 36, 0.5) 60%,
    rgba(56, 189, 248, 0.45) 80%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: nyGarland 8s linear infinite;
  pointer-events: none;
}
@keyframes nyGarland {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Элемент управления снегопадом в разделе Профиль */
.snow-toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-m, 12px);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: var(--fs-xs, 0.78rem);
  font-weight: 650;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.snow-toggle-control:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: var(--surface-3);
  transform: translateY(-1px);
}
.snow-toggle-control:active {
  transform: scale(0.97);
}
.snow-ico-wrap {
  font-size: 14px;
  line-height: 1;
}
.snow-status-indicator {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.05em;
}
.snow-status-indicator.on {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.snow-status-indicator.off {
  background: rgba(148, 163, 184, 0.15);
  color: var(--ink-3);
  border: 1px solid var(--line);
}

/* ================== BONUSES & ARCADE GROUPED NAVIGATION ================== */
.bonuses-nav-seg {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 10px;
  border-radius: var(--r-xl);
  width: 100%;
}
.bonuses-nav-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.bonuses-nav-group-label {
  width: 100%;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 2px 6px;
}
.bonuses-nav-group .bonuses-seg-btn {
  flex: 1 1 calc(25% - 6px);
  min-width: 80px;
}
@media (max-width: 480px) {
  .bonuses-nav-group .bonuses-seg-btn {
    flex: 1 1 calc(33.333% - 6px);
    font-size: 0.73rem;
    padding: 8px 4px;
  }
}

/* ================== SHARED ARCADE HISTORY STRIP ================== */
.arcade-history-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0 10px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.arcade-history-strip::-webkit-scrollbar {
  display: none;
}
.arcade-hist-chip {
  flex-shrink: 0;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 750;
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  animation: histChipIn 0.25s ease-out;
}
@keyframes histChipIn {
  from { opacity: 0; transform: scale(0.75); }
  to { opacity: 1; transform: scale(1); }
}
.arcade-hist-chip.win {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(16, 185, 129, 0.14);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}
.arcade-hist-chip.lose {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(239, 68, 68, 0.1);
}

/* ================== GAME: DICE (КОСТИ) ================== */
.dice-card {
  border-radius: var(--r-xl);
  background: radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.16), rgba(8, 10, 16, 0.96) 72%);
  border: 1px solid var(--line-strong);
  padding: clamp(14px, 2.5vw, 22px);
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.55);
}
.dice-stage {
  position: relative;
  margin: 14px 0 20px;
  padding: 22px 14px 16px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--r-lg, 16px);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
  user-select: none;
}
.dice-stage.shaking {
  animation: stageShake 0.4s ease;
}
@keyframes stageShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
.dice-track {
  position: relative;
  width: 100%;
  height: 28px;
  border-radius: 14px;
  background: #090d16;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  touch-action: none;
}
.dice-track:hover {
  border-color: rgba(99, 102, 241, 0.5);
}
.dice-track-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: left 0.15s ease, width 0.15s ease;
}
.dice-track-win {
  background: linear-gradient(90deg, #059669, #10b981);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3), 0 0 18px rgba(16, 185, 129, 0.45);
}
.dice-track-lose {
  background: linear-gradient(90deg, #7f1d1d, #dc2626);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}
.dice-target-pin {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff, 0 0 14px rgba(255, 255, 255, 0.8);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 4;
  transition: left 0.15s ease;
}
.dice-track-marker {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 42px;
  height: 40px;
  padding: 0 6px;
  background: linear-gradient(180deg, #ffffff, #e2e8f0);
  border-radius: 9px;
  border: 2px solid #0f172a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.75), 0 0 12px rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  pointer-events: none;
  transition: left 0.35s cubic-bezier(0.12, 0.8, 0.32, 1);
}
.dice-track-marker.is-rolling {
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.8), 0 0 10px #ffffff;
  animation: markerRollPulse 0.15s infinite alternate;
}
@keyframes markerRollPulse {
  from { transform: translateX(-50%) scale(1.02); }
  to { transform: translateX(-50%) scale(1.14); }
}
.dice-track-marker.is-win {
  background: linear-gradient(180deg, #34d399, #059669);
  border-color: #ecfdf5;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.9), 0 0 8px #ffffff;
  animation: markerWinBounce 0.45s ease;
}
@keyframes markerWinBounce {
  0% { transform: translateX(-50%) scale(0.9); }
  50% { transform: translateX(-50%) scale(1.3); }
  100% { transform: translateX(-50%) scale(1); }
}
.dice-track-marker.is-lose {
  background: linear-gradient(180deg, #f87171, #b91c1c);
  border-color: #fef2f2;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
  animation: markerLoseShake 0.4s ease;
}
@keyframes markerLoseShake {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(-65%); }
  75% { transform: translateX(-35%); }
}
.dice-marker-num {
  font-size: 11px;
  font-weight: 850;
  color: #0f172a;
}
.dice-track-marker.is-win .dice-marker-num,
.dice-track-marker.is-lose .dice-marker-num {
  color: #ffffff;
}
.dice-track-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  color: var(--ink-3);
}
.dice-center-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--r-m, 12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.dice-dice-face {
  font-size: 46px;
  line-height: 1;
  display: inline-block;
  transform-origin: center;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}
.dice-dice-face.rolling {
  animation: dice3dSpin 0.35s linear infinite;
}
@keyframes dice3dSpin {
  0% { transform: rotate(0deg) scale(1.05); }
  50% { transform: rotate(180deg) scale(1.25); }
  100% { transform: rotate(360deg) scale(1.05); }
}
.dice-live-roll {
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #f8fafc;
  min-width: 90px;
}
.dice-live-roll.rolling {
  color: #818cf8;
}
.dice-live-roll.win {
  color: #34d399;
  text-shadow: 0 0 14px rgba(52, 211, 153, 0.6);
}
.dice-live-roll.lose {
  color: #f87171;
  text-shadow: 0 0 14px rgba(248, 113, 113, 0.6);
}
.dice-mode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.dice-mode-seg {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--r-m, 10px);
  padding: 3px;
  gap: 4px;
}
.dice-mode-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: var(--fs-xs);
  font-weight: 750;
  background: transparent;
  color: var(--ink-2);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dice-mode-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}
.dice-target-row {
  margin-bottom: 16px;
}

/* ================== GAME: COINFLIP (МОНЕТКА) ================== */
.coinflip-card {
  border-radius: var(--r-xl);
  background: radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.16), rgba(8, 10, 16, 0.96) 72%);
  border: 1px solid var(--line-strong);
  padding: clamp(14px, 2.5vw, 22px);
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.55);
}
.coinflip-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin: 14px 0 20px;
  padding: 24px 14px 20px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-lg, 16px);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
  perspective: 1200px;
}
.coinflip-coin-wrapper {
  position: relative;
  width: 120px;
  height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.coinflip-coin {
  width: 96px;
  height: 96px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.coinflip-coin.show-heads {
  transform: rotateY(0deg);
}
.coinflip-coin.show-tails {
  transform: rotateY(180deg);
}
.coinflip-coin.toss-to-heads {
  animation: coinTossToHeads 1s cubic-bezier(0.2, 0.85, 0.35, 1.05) forwards;
}
.coinflip-coin.toss-to-tails {
  animation: coinTossToTails 1s cubic-bezier(0.2, 0.85, 0.35, 1.05) forwards;
}
@keyframes coinTossToHeads {
  0% { transform: translateY(0) rotateY(0deg) scale(1); }
  25% { transform: translateY(-75px) rotateY(540deg) scale(1.18); }
  50% { transform: translateY(-95px) rotateY(1080deg) scale(1.24); }
  75% { transform: translateY(-30px) rotateY(1620deg) scale(1.08); }
  90% { transform: translateY(0) rotateY(1800deg) scale(0.95); }
  95% { transform: translateY(-8px) rotateY(1800deg) scale(1.03); }
  100% { transform: translateY(0) rotateY(1800deg) scale(1); }
}
@keyframes coinTossToTails {
  0% { transform: translateY(0) rotateY(0deg) scale(1); }
  25% { transform: translateY(-75px) rotateY(540deg) scale(1.18); }
  50% { transform: translateY(-95px) rotateY(1080deg) scale(1.24); }
  75% { transform: translateY(-30px) rotateY(1620deg) scale(1.08); }
  90% { transform: translateY(0) rotateY(1980deg) scale(0.95); }
  95% { transform: translateY(-8px) rotateY(1980deg) scale(1.03); }
  100% { transform: translateY(0) rotateY(1980deg) scale(1); }
}
.coinflip-shadow {
  position: absolute;
  bottom: 0;
  width: 70px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.7) 0%, transparent 75%);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.coinflip-coin.toss-to-heads ~ .coinflip-shadow,
.coinflip-coin.toss-to-tails ~ .coinflip-shadow {
  animation: coinShadowToss 1s cubic-bezier(0.2, 0.85, 0.35, 1.05);
}
@keyframes coinShadowToss {
  0% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(0.35); opacity: 0.15; }
  90% { transform: scale(1.15); opacity: 0.85; }
  100% { transform: scale(1); opacity: 0.7; }
}
.coinflip-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  backface-visibility: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), inset 0 0 0 4px rgba(255, 255, 255, 0.28);
  user-select: none;
}
.coinflip-face .coin-icon {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}
.coinflip-face .coin-text {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
}
.coinflip-face-heads {
  background: radial-gradient(circle at 35% 30%, #fffbeb 0%, #fde047 30%, #eab308 65%, #ca8a04 100%);
  color: #713f12;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
  border: 3.5px solid #fef08a;
  transform: rotateY(0deg);
}
.coinflip-face-tails {
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #cbd5e1 35%, #94a3b8 70%, #475569 100%);
  color: #0f172a;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
  border: 3.5px solid #f8fafc;
  transform: rotateY(180deg);
}
.coinflip-pick-row {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}
.coinflip-pick-btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--r-m, 12px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 750;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.coinflip-pick-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--ink);
  transform: translateY(-1px);
}
.coinflip-pick-btn .pick-icon {
  font-size: 18px;
  line-height: 1;
}
.coinflip-pick-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(234, 179, 8, 0.16));
  border-color: #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

/* ================== ENHANCED GAME ANIMATIONS: WHEEL, CASES, MINES, TOWER ================== */
/* Колесо Фортуны: неоновое свечение и вибрация указателя при вращении */
.wheel-stage.is-spinning .wheel-glow {
  opacity: 1 !important;
  animation: wheelGlowPulse 1.2s infinite alternate ease-in-out;
}
@keyframes wheelGlowPulse {
  from { transform: scale(0.96); opacity: 0.5; }
  to { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 25px rgba(245, 158, 11, 0.85)); }
}
.wheel-stage.is-spinning .wheel-pointer {
  animation: wheelPointerTick 0.16s infinite alternate ease-in-out;
}
@keyframes wheelPointerTick {
  from { transform: translateX(-50%) rotate(-7deg); }
  to { transform: translateX(-50%) rotate(7deg); }
}

/* Кейсы: подсветка выигрышной плитки и пульсация визира */
.case-card-tile.winner {
  animation: caseWinnerPop 0.5s cubic-bezier(0.18, 1.3, 0.4, 1) both;
  box-shadow: 0 0 26px rgba(245, 158, 11, 0.95), 0 0 10px #ffffff, inset 0 0 16px rgba(255, 255, 255, 0.5) !important;
  border-color: #fbbf24 !important;
  z-index: 10;
}
@keyframes caseWinnerPop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1.08); }
}

/* Мины: 3D переворот ячеек и сочные взрывы */
.mines-cell {
  perspective: 600px;
}
.mines-cell.is-safe {
  animation: cellFlipSafe 0.36s cubic-bezier(0.18, 1.25, 0.4, 1) both;
}
@keyframes cellFlipSafe {
  0% { transform: scale(0.8) rotateY(-90deg); opacity: 0; }
  60% { transform: scale(1.08) rotateY(10deg); }
  100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}
.mines-cell.is-bomb-hit {
  animation: cellBombBlast 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes cellBombBlast {
  0% { transform: scale(0.7) rotate(-12deg); }
  45% { transform: scale(1.22) rotate(8deg); }
  75% { transform: scale(0.95) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}
.mines-cell.is-bomb-revealed {
  animation: bombFadeIn 0.35s ease both;
}
@keyframes bombFadeIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 0.88; transform: scale(1); }
}

/* Башня: 3D открытие дверей */
.tower-door-btn {
  perspective: 600px;
}
.tower-door-btn.is-safe-picked {
  animation: doorSafeOpen 0.38s cubic-bezier(0.18, 1.25, 0.4, 1) both;
}
@keyframes doorSafeOpen {
  0% { transform: scale(0.85); opacity: 0.5; }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}
.tower-door-btn.is-trap-hit {
  animation: doorTrapBlast 0.4s ease both;
}
@keyframes doorTrapBlast {
  0% { transform: scale(0.8); }
  40% { transform: scale(1.15) rotate(-3deg); }
  80% { transform: scale(0.95) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}








/* ================== Визуальный редактор макета цитат ================== */

.quote-editor .quote-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.quote-editor .quote-preset-btn.is-active {
  background: var(--accent, #4f8cff);
  color: #fff;
  border-color: transparent;
}

.quote-canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 20% 15%, rgba(88, 108, 180, 0.45), transparent 55%),
    linear-gradient(150deg, #131726 0%, #0d0f15 60%, #10131d 100%);
  aspect-ratio: 16 / 9;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.quote-canvas {
  position: absolute;
  inset: 0;
  touch-action: none;
}

.quote-canvas [data-quote-el] {
  position: absolute;
  cursor: grab;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.15s ease;
  will-change: transform;
}

.quote-canvas [data-quote-el]:active { cursor: grabbing; }

.quote-canvas [data-quote-el].is-selected {
  outline: 2px dashed rgba(120, 170, 255, 0.85);
  outline-offset: 6px;
  border-radius: 8px;
}

.quote-canvas [data-quote-el].is-hidden { opacity: 0.12; pointer-events: auto; }

.quote-canvas-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5a6cff, #9a5aff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.quote-canvas-name { font-size: 15px; font-weight: 600; }
.quote-canvas-time { font-size: 12px; color: #9ca3af; }

.quote-canvas-text {
  font-size: 15px;
  font-weight: 600;
  max-width: 70%;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

.quote-canvas-media {
  width: 84px;
  height: 62px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.quote-el-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 8px;
}

.quote-el-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line, #2a3040);
  background: var(--panel, #171b26);
  color: var(--ink, #e8eaf0);
  font-size: 13px;
  cursor: pointer;
}

.quote-el-chip.is-active { border-color: var(--accent, #4f8cff); background: rgba(79, 140, 255, 0.15); }
.quote-el-chip.is-hidden { opacity: 0.55; }
.quote-el-icon { font-size: 15px; }
.quote-el-eye { margin-left: 2px; font-size: 13px; opacity: 0.8; cursor: pointer; }

.quote-inspector {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line, #2a3040);
  border-radius: 12px;
}

.quote-inspector-grid { display: grid; gap: 10px; }
.quote-inspector-grid .field span {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2, #a9b1c2);
}

.quote-inspector-grid input[type="range"] { width: 100%; }

.quote-editor .cmd-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
