/* ==========================================================================
   Twipe redesign 2026 — loaded after styles.css.
   Unified dock, home switch, tab pages, list polish, motion system,
   desktop layout fixes. Respects prefers-reduced-motion and energy saver.
   ========================================================================== */

:root {
  --rd-radius: 18px;
  --rd-radius-sm: 12px;
  --rd-dock-h: 64px;
  --rd-dock-gap: 10px;
  --rd-spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --rd-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --rd-fast: 160ms;
  --rd-mid: 280ms;
  --rd-slow: 420ms;
  --rd-surface: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
  --rd-surface-strong: color-mix(in srgb, var(--bg-elevated) 94%, transparent);
  --rd-border: color-mix(in srgb, var(--line) 70%, transparent);
  --rd-shadow-1: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 14px rgba(15, 23, 42, 0.05);
  --rd-shadow-2: 0 10px 40px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.06);
  --rd-active-bg: color-mix(in srgb, var(--primary) 14%, transparent);
}

[data-theme="dark"] {
  --rd-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
  --rd-shadow-2: 0 12px 44px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
  --rd-active-bg: color-mix(in srgb, var(--primary) 22%, transparent);
}

/* ---------- old navigation is replaced by the dock ---------- */
.bottom-nav,
.desktop-quickbar {
  display: none !important;
}

/* ---------- dock ---------- */
.ui-icon--dock-market {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l1.6-4.8A2 2 0 0 1 6.5 3h11a2 2 0 0 1 1.9 1.2L21 9'/%3E%3Cpath d='M3 9h18v1.5a3 3 0 0 1-6 0 3 3 0 0 1-6 0 3 3 0 0 1-6 0z'/%3E%3Cpath d='M5 13v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6'/%3E%3Cpath d='M10 21v-5h4v5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l1.6-4.8A2 2 0 0 1 6.5 3h11a2 2 0 0 1 1.9 1.2L21 9'/%3E%3Cpath d='M3 9h18v1.5a3 3 0 0 1-6 0 3 3 0 0 1-6 0 3 3 0 0 1-6 0z'/%3E%3Cpath d='M5 13v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6'/%3E%3Cpath d='M10 21v-5h4v5'/%3E%3C/svg%3E");
}

.app-dock {
  position: fixed;
  left: 50%;
  bottom: calc(var(--rd-dock-gap) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 20px));
  z-index: 60;
  transition: transform var(--rd-slow) var(--rd-smooth), opacity var(--rd-mid) ease;
  will-change: transform;
}

.app-dock-inner {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  height: var(--rd-dock-h);
  padding: 6px;
  border-radius: 24px;
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  box-shadow: var(--rd-shadow-2);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  box-sizing: border-box;
}

.app-dock-indicator {
  position: absolute;
  top: 6px;
  left: 0;
  height: calc(100% - 12px);
  width: var(--w, 0px);
  transform: translateX(var(--x, 0px)) scale(0.6);
  border-radius: 18px;
  background: var(--rd-active-bg);
  opacity: 0;
  transition:
    transform var(--rd-slow) var(--rd-spring),
    width var(--rd-slow) var(--rd-spring),
    opacity var(--rd-mid) ease;
  pointer-events: none;
}

.app-dock-indicator.is-on {
  opacity: 1;
  transform: translateX(var(--x, 0px)) scale(1);
}

.dock-btn {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--rd-mid) ease, transform var(--rd-fast) var(--rd-smooth);
}

.dock-btn .ui-icon {
  width: 23px;
  height: 23px;
  background-color: currentColor;
  transition: transform var(--rd-mid) var(--rd-spring);
}

.dock-label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dock-btn:hover {
  color: var(--text);
}

.dock-btn:active {
  transform: scale(0.92);
}

.dock-btn.is-active {
  color: var(--primary);
}

.dock-btn.is-active .ui-icon {
  transform: translateY(-1px) scale(1.08);
}

.dock-btn:focus-visible {
  outline: none;
  box-shadow: var(--twim-focus);
}

.dock-btn--soon::after {
  content: "";
  position: absolute;
  top: 9px;
  right: calc(50% - 17px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--secondary);
  box-shadow: 0 0 0 2px var(--bg-elevated);
}

.dock-btn--shake .ui-icon {
  animation: rd-shake 0.46s var(--rd-smooth);
}

@keyframes rd-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px) rotate(-6deg); }
  40% { transform: translateX(4px) rotate(6deg); }
  60% { transform: translateX(-3px) rotate(-3deg); }
  80% { transform: translateX(2px); }
}

/* Dock hides while a chat, call or full sheet is open on phones. */
html:not(.layout-desktop).mirage-chat-open .app-dock,
html:not(.layout-desktop).mirage-call-open .app-dock,
html:not(.layout-desktop).mirage-user-search-focus .app-dock {
  transform: translate(-50%, calc(100% + 30px));
  opacity: 0;
  pointer-events: none;
}

/* Space for the dock under scrolling content. */
html:not(.layout-desktop) .app-shell {
  padding-bottom: calc(var(--rd-dock-h) + var(--rd-dock-gap) * 2 + env(safe-area-inset-bottom)) !important;
}

/* ---------- home switch (Чаты / Каналы) ---------- */
html #appShell .desktop-sidebar-nav {
  position: relative;
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 0 !important;
  padding: 4px !important;
  margin: 2px 0 12px !important;
  border-radius: 14px;
  background: color-mix(in srgb, var(--line) 42%, transparent);
}

.desktop-sidebar-nav .home-switch-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 11px;
  background: var(--bg-elevated);
  box-shadow: var(--rd-shadow-1);
  transition: transform var(--rd-slow) var(--rd-spring);
}

.app-shell--route-beacons .desktop-sidebar-nav .home-switch-pill {
  transform: translateX(100%);
}

.desktop-sidebar-nav-btn {
  position: relative;
  z-index: 1;
  height: 36px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font: inherit;
  font-size: var(--fs-14);
  font-weight: 700;
  color: var(--muted) !important;
  cursor: pointer;
  border-radius: 11px;
  transition: color var(--rd-mid) ease;
}

.desktop-sidebar-nav-btn.active {
  color: var(--text) !important;
}

html #appShell:not(.app-shell--route-home) .desktop-sidebar-nav {
  display: none !important;
}

/* ---------- tab pages (music / market) ---------- */
.tab-page {
  padding: 4px 0 24px;
}

.tab-page-head {
  margin: 4px 2px 14px;
}

.tab-page-title {
  margin: 0;
  font-size: 28px;
  font-weight: 850;
  letter-spacing: -0.035em;
}

.tab-page-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-14);
}

.tab-page-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.extras-track,
.extras-listing,
.extras-wallet {
  border-radius: var(--rd-radius-sm);
  background: var(--rd-surface-strong);
  border: 1px solid var(--rd-border);
  box-shadow: var(--rd-shadow-1);
  transition: transform var(--rd-fast) var(--rd-smooth), box-shadow var(--rd-mid) ease;
}

.extras-track:hover,
.extras-listing:hover {
  transform: translateY(-1px);
  box-shadow: var(--rd-shadow-2);
}

.extras-tabs .chip {
  transition: background var(--rd-mid) ease, color var(--rd-mid) ease, transform var(--rd-fast) var(--rd-smooth);
}

.extras-tabs .chip:active {
  transform: scale(0.95);
}

.extras-track-play {
  transition: transform var(--rd-fast) var(--rd-spring), box-shadow var(--rd-mid) ease;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent);
}

.extras-track-play:active {
  transform: scale(0.9);
}

/* ---------- chat list ---------- */
.chat-swipe {
  margin-bottom: 6px !important;
  border-radius: var(--rd-radius);
}

.chat-swipe-front.card {
  margin-bottom: 0 !important;
  min-height: 64px;
  padding: 10px 12px !important;
  border-radius: var(--rd-radius) !important;
  border: 1px solid var(--rd-border) !important;
  background: var(--rd-surface-strong) !important;
  box-shadow: var(--rd-shadow-1) !important;
  transition: transform var(--rd-fast) var(--rd-smooth), box-shadow var(--rd-mid) ease, background var(--rd-mid) ease !important;
}

.chat-swipe-front.card:hover {
  box-shadow: var(--rd-shadow-2) !important;
}

.chat-swipe-front.card:active {
  transform: scale(0.985);
}

/* ---------- motion: tab and sheet transitions ---------- */
.list.active {
  animation: rd-tab-in var(--rd-mid) var(--rd-smooth) both;
}

@keyframes rd-tab-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.app-shell--tab-back .list.active {
  animation-name: rd-tab-back;
}

@keyframes rd-tab-back {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

html:not(.layout-desktop) .sheet:not(.hidden):not(.sheet-chat) {
  animation: rd-sheet-in var(--rd-slow) var(--rd-smooth) both;
}

@keyframes rd-sheet-in {
  from { opacity: 0; transform: translateY(24px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.overlay-backdrop:not(.hidden) {
  animation: rd-fade-in var(--rd-mid) ease both;
}

@keyframes rd-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.settings-row,
.btn,
.icon-btn,
.chip,
.folder-tab {
  transition:
    transform var(--rd-fast) var(--rd-smooth),
    background-color var(--rd-mid) ease,
    border-color var(--rd-mid) ease,
    box-shadow var(--rd-mid) ease,
    color var(--rd-mid) ease;
}

.settings-row:active,
.btn:active,
.chip:active,
.folder-tab:active {
  transform: scale(0.97);
}

.msg-row {
  animation: rd-msg-in 220ms var(--rd-smooth) both;
}

@keyframes rd-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Don't replay message animation for long histories on re-render. */
.messages > .msg-row:nth-last-child(n + 12) {
  animation: none;
}

/* ---------- desktop ---------- */
html.layout-desktop .app-dock {
  left: 0;
  bottom: 0;
  transform: none;
  width: calc(var(--desktop-left) + var(--desktop-gutter));
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: linear-gradient(to top, var(--bg-soft) 70%, transparent);
  z-index: 30;
}

html.layout-desktop .app-dock-inner {
  height: 58px;
  border-radius: 18px;
  box-shadow: var(--rd-shadow-1);
}

html.layout-desktop .app-shell {
  padding-bottom: 86px !important;
}

html.layout-desktop.mirage-desktop-welcome:not(.mirage-chat-open) .desktop-welcome-pane {
  position: fixed !important;
  top: var(--desktop-topstrip-h) !important;
  left: var(--desktop-chat-x) !important;
  right: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  transform: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background:
    radial-gradient(700px 420px at 70% 20%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 70%),
    radial-gradient(600px 380px at 20% 90%, color-mix(in srgb, var(--secondary) 8%, transparent), transparent 70%),
    var(--bg-soft) !important;
}

html.layout-desktop .desktop-welcome-inner {
  border-radius: 24px !important;
  box-shadow: var(--rd-shadow-2) !important;
  animation: rd-sheet-in var(--rd-slow) var(--rd-smooth) both;
}

html.layout-desktop .content {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

html.layout-desktop .tab-page {
  padding-right: 4px;
}

/* ---------- accessibility / performance ---------- */
@media (prefers-reduced-motion: reduce) {
  .app-dock,
  .app-dock-indicator,
  .dock-btn,
  .dock-btn .ui-icon,
  .list.active,
  .msg-row,
  .sheet,
  .chat-swipe-front.card,
  .desktop-welcome-inner,
  .home-switch-pill {
    animation: none !important;
    transition: none !important;
  }
}

html[data-motion="reduced"] .list.active,
html[data-motion="reduced"] .msg-row,
html[data-motion="reduced"] .sheet {
  animation: none !important;
}

html[data-motion="reduced"] .app-dock-inner {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--bg-elevated);
}

/* ---------- desktop sidebar sizing: keep everything inside the sidebar ---------- */
html.layout-desktop #appShell {
  width: var(--desktop-chat-x) !important;
  max-width: var(--desktop-chat-x) !important;
  padding-left: 14px !important;
  padding-right: 14px !important;
  box-sizing: border-box !important;
  overflow-x: hidden;
}

html.layout-desktop #appShell > *,
html.layout-desktop #appShell .chats-toolbar > * {
  max-width: 100%;
  box-sizing: border-box;
}

html.layout-desktop #appShell .content,
html.layout-desktop #appShell .list {
  width: 100% !important;
}

html.layout-desktop #appShell .desktop-sidebar-nav {
  margin: 10px 0 10px !important;
  flex: 0 0 auto;
}

/* ---------- desktop chat pane fills the whole area right of the sidebar ---------- */
html.layout-desktop.mirage-chat-open #chatSheet.sheet-chat:not(.hidden) {
  left: var(--desktop-chat-x) !important;
  right: 0 !important;
  width: auto !important;
  max-width: none !important;
  border-left: 1px solid var(--rd-border) !important;
  animation: rd-pane-in var(--rd-mid) var(--rd-smooth) both;
}

@keyframes rd-pane-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

/* Folder tabs stay in the sidebar; the duplicate rail inside the chat is not used. */
html.layout-desktop #desktopChatFolderRail {
  display: none !important;
}

html.layout-desktop #appShell #folderTabs {
  display: flex !important;
}

/* ---------- icons that were referenced but never defined ---------- */
.ui-icon--smile {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8.5 14.5a4.5 4.5 0 0 0 7 0'/%3E%3Cpath d='M9 9.5h.01M15 9.5h.01' stroke-width='2.6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8.5 14.5a4.5 4.5 0 0 0 7 0'/%3E%3Cpath d='M9 9.5h.01M15 9.5h.01' stroke-width='2.6'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
}
.ui-icon--location {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5a7 7 0 0 1 14 0C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5a7 7 0 0 1 14 0C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
}
.ui-icon--play {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 4.5v15l12.5-7.5z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 4.5v15l12.5-7.5z' fill='black'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
}
.ui-icon--next {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5v14l10-7z' fill='black'/%3E%3Cpath d='M19 5v14'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5v14l10-7z' fill='black'/%3E%3Cpath d='M19 5v14'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
}
.ui-icon--prev {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 5v14L9 12z' fill='black'/%3E%3Cpath d='M5 5v14'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 5v14L9 12z' fill='black'/%3E%3Cpath d='M5 5v14'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* ---------- small fixes ---------- */
.desktop-welcome-row,
.desktop-welcome-row * {
  color: var(--text);
}

.desktop-welcome-row .desktop-welcome-row-preview,
.desktop-welcome-row .desktop-welcome-row-time,
.desktop-welcome-row small {
  color: var(--muted);
}

.desktop-welcome-row {
  transition: transform var(--rd-fast) var(--rd-smooth), background-color var(--rd-mid) ease;
}

.desktop-welcome-row:hover {
  transform: translateX(3px);
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-soft));
}

.extras-wallet {
  flex-wrap: nowrap !important;
}

.extras-wallet .btn {
  margin: 0 !important;
  padding: 7px 12px;
  white-space: nowrap;
}

/* Phone/tablet: dock matches the app column width. */
html:not(.layout-desktop) .app-dock {
  width: min(440px, calc(100vw - 20px));
}

html.layout-desktop #appShell .beacons-heading {
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
  box-sizing: border-box;
}

.ui-icon--pause {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 4.5h3.5v15H7zM13.5 4.5H17v15h-3.5z' fill='black' stroke='none'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 4.5h3.5v15H7zM13.5 4.5H17v15h-3.5z' fill='black' stroke='none'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
}
.ui-icon--globe {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* ==========================================================================
   Music page: local library (main) + public catalog, page player, mini-player morph
   ========================================================================== */
.music-page {
  position: relative;
  overflow-x: hidden;
}

.music-view {
  display: none;
}

.music-view.is-current {
  display: block;
  animation: rd-view-in var(--rd-slow) var(--rd-smooth) both;
}

.music-view--public.is-current {
  animation-name: rd-view-in-right;
}

@keyframes rd-view-in {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: none; }
}

@keyframes rd-view-in-right {
  from { opacity: 0; transform: translateX(22px); }
  to { opacity: 1; transform: none; }
}

.music-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.music-head > div {
  flex: 1;
  min-width: 0;
}

.music-public-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--rd-border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, var(--bg-elevated)), color-mix(in srgb, var(--secondary) 14%, var(--bg-elevated)));
  color: var(--text);
  font: inherit;
  font-size: var(--fs-14);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--rd-shadow-1);
  transition: transform var(--rd-fast) var(--rd-smooth), box-shadow var(--rd-mid) ease;
}

.music-public-link .ui-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.music-public-arrow {
  font-size: 20px;
  line-height: 1;
  transition: transform var(--rd-mid) var(--rd-spring);
}

.music-public-link:hover .music-public-arrow {
  transform: translateX(3px);
}

.music-public-link:active {
  transform: scale(0.96);
}

.music-back {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--rd-border);
  background: var(--rd-surface-strong);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--rd-shadow-1);
  transition: transform var(--rd-fast) var(--rd-smooth);
}

.music-back:active {
  transform: scale(0.92);
}

.music-lib-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.music-lib-actions .btn {
  height: 44px;
  border-radius: 14px;
  font-weight: 700;
}

.music-lib-search {
  margin: 0 0 12px;
}

.music-lib-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.music-lib-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 8px;
  border-radius: 16px;
  background: var(--rd-surface-strong);
  border: 1px solid var(--rd-border);
  box-shadow: var(--rd-shadow-1);
  animation: rd-row-in var(--rd-slow) var(--rd-smooth) both;
  animation-delay: calc(var(--i, 0) * 28ms);
  transition: background var(--rd-mid) ease, transform var(--rd-fast) var(--rd-smooth), border-color var(--rd-mid) ease;
}

@keyframes rd-row-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.music-lib-row:hover {
  transform: translateY(-1px);
}

.music-lib-row.is-playing {
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-elevated));
}

.music-lib-art {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: color-mix(in srgb, var(--primary) 18%, var(--bg-soft));
  display: grid;
  place-items: center;
  color: var(--primary);
}

.music-lib-art > *:not(.music-lib-eq) {
  width: 100%;
  height: 100%;
}

.music-lib-eq {
  position: absolute;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 12px;
  background: rgba(0, 0, 0, 0.38);
}

.music-lib-row.is-playing .music-lib-eq {
  display: flex;
}

.music-lib-eq i {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: #fff;
  transform-origin: bottom;
}

.music-lib-row.is-live .music-lib-eq i {
  animation: rd-eq 0.9s ease-in-out infinite;
}

.music-lib-eq i:nth-child(2) { animation-delay: -0.3s !important; }
.music-lib-eq i:nth-child(3) { animation-delay: -0.6s !important; }

@keyframes rd-eq {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(2.4); }
}

.music-lib-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.music-lib-title {
  max-width: 100%;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-lib-meta {
  font-size: 12px;
  color: var(--muted);
}

.music-lib-row-actions {
  display: flex;
  gap: 2px;
}

.mpp-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--rd-fast) var(--rd-spring), background var(--rd-mid) ease;
}

.mpp-btn:hover {
  background: color-mix(in srgb, var(--text) 7%, transparent);
}

.mpp-btn:active {
  transform: scale(0.88);
}

.mpp-btn .ui-icon {
  width: 18px;
  height: 18px;
}

.mpp-btn--ghost {
  color: var(--muted);
}

.mpp-btn.is-busy {
  opacity: 0.5;
  pointer-events: none;
  animation: rd-pulse 0.9s ease-in-out infinite;
}

@keyframes rd-pulse {
  50% { opacity: 0.25; }
}

.mpp-btn--play {
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 40%, transparent);
}

.mpp-btn--play:hover {
  background: color-mix(in srgb, var(--primary) 88%, #000);
}

.mpp-btn--play .ui-icon {
  width: 20px;
  height: 20px;
}

.music-empty {
  text-align: center;
  padding: 34px 16px;
  border-radius: 20px;
  border: 1px dashed var(--rd-border);
}

.music-empty-ico {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 30px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 35%, transparent);
}

.music-empty-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}

.music-empty-sub {
  margin: 0 auto 16px;
  max-width: 300px;
  color: var(--muted);
  font-size: var(--fs-14);
  line-height: 1.45;
}

/* Page player: sticky at the bottom of the music page. */
.music-page-player {
  position: sticky;
  bottom: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 10px 10px 10px 10px;
  border-radius: 20px;
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  box-shadow: var(--rd-shadow-2);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  animation: rd-player-in var(--rd-slow) var(--rd-spring) both;
}

.music-page-player.hidden {
  display: none;
}

@keyframes rd-player-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.mpp-art {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.mpp-art > * {
  width: 100%;
  height: 100%;
}

.music-page-player.is-live .mpp-art {
  animation: rd-breathe 2.4s ease-in-out infinite;
}

@keyframes rd-breathe {
  50% { transform: scale(1.04); }
}

.mpp-main {
  flex: 1;
  min-width: 0;
}

.mpp-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.mpp-seek-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mpp-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 30px;
}

.mpp-seek {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--primary) var(--p, 0%), color-mix(in srgb, var(--text) 14%, transparent) var(--p, 0%));
  cursor: pointer;
}

.mpp-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: transform var(--rd-fast) ease;
}

.mpp-seek:active::-webkit-slider-thumb {
  transform: scale(1.25);
}

.mpp-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.mpp-ctrls {
  display: flex;
  align-items: center;
  gap: 2px;
}


/* On the music tab the page player is the player: hide the other ones. */
html.twipe-music-tab #musicDock {
  display: none !important;
}

/* Desktop titlebar: the Twipe pill morphs into the mini-player and back. */
#desktopTbBrand:not(.hidden) {
  animation: none;
}

@keyframes rd-brand-in {
  from { opacity: 0; transform: scale(0.7); letter-spacing: 0.2em; }
  to { opacity: 1; transform: none; }
}

#musicDock.music-dock--titlebar:not(.hidden) {
  transform-origin: center;
}

@keyframes rd-morph {
  0% { clip-path: inset(0 calc(50% - 45px) round 999px); opacity: 0.6; }
  100% { clip-path: inset(0 0 round 999px); opacity: 1; }
}

@keyframes rd-morph-content {
  0%, 35% { opacity: 0; }
  100% { opacity: 1; }
}

/* ============================================================
   v5 · Composer: панель на всю ширину, прижата к низу окна, ничего не обрезается
   ============================================================ */
html.layout-desktop .sheet-chat { min-height: 0 !important; }
.music-fav-sheet.hidden, #musicFavoritesSheet.hidden { display: none !important; }
html.layout-desktop, html.layout-desktop body { height: 100%; overflow: hidden; }

#chatSheet .sheet-chat-footer {
  background: var(--bg-elevated, #fff);
  border-top: 1px solid var(--rd-border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + var(--keyboard-inset, 0px));
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 0 -10px 30px -24px rgba(15, 23, 42, 0.35);
}
#chatSheet #chatComposer {
  position: relative;
  align-items: flex-end;
  gap: 4px;
  margin: 0;
  padding: 10px 12px 12px;
  min-height: 68px;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  animation: none;
}
html:not(.layout-desktop) #chatSheet #chatComposer { padding-bottom: 14px; }
#chatSheet #chatComposer .composer-input-wrap {
  border: 1px solid var(--rd-border);
  background: color-mix(in srgb, var(--text) 4%, var(--bg-elevated, #fff));
  box-shadow: none !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 14px;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 6px;
  transition: border-color 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}
#chatSheet #chatComposer .composer-input-wrap:focus-within {
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
  background: var(--bg-elevated, #fff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent) !important;
}
#chatSheet #chatComposer textarea#messageInput {
  min-height: 44px;
  padding: 11px 6px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
#chatSheet.sheet-chat--wallpaper .sheet-chat-footer { background: color-mix(in srgb, var(--bg-elevated, #fff) 88%, transparent); backdrop-filter: blur(18px); }
#chatSheet #chatComposer .composer-attach,
#chatSheet #chatComposer .composer-fun-btn,
#chatSheet #chatComposer .composer-record-fab {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  opacity: 1;
  transition: background 0.2s ease, color 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3), width 0.25s ease, opacity 0.2s ease;
}
#chatSheet #chatComposer .composer-attach .ui-icon,
#chatSheet #chatComposer .composer-fun-btn .ui-icon,
#chatSheet #chatComposer .composer-record-fab .ui-icon { width: 24px; height: 24px; background-color: currentColor; }
#chatSheet #chatComposer .composer-attach:hover,
#chatSheet #chatComposer .composer-fun-btn:hover,
#chatSheet #chatComposer .composer-record-fab:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
#chatSheet #chatComposer .composer-attach:active,
#chatSheet #chatComposer .composer-fun-btn:active,
#chatSheet #chatComposer .composer-record-fab:active { transform: scale(0.88); }
#chatSheet #chatComposer.composer--typing .composer-fun-btn,
#chatSheet #chatComposer.composer--typing .composer-record-fab { width: 0; opacity: 0; transform: scale(0.6); pointer-events: none; overflow: hidden; }
#chatSheet #chatComposer #sendBtn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  margin-left: 2px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #5b8cff, #2563eb 55%, #6d5cff);
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, 0.8);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.4), filter 0.2s ease, opacity 0.2s ease;
}
#chatSheet #chatComposer:not(.composer--typing) #sendBtn { filter: saturate(0.6); opacity: 0.75; }
#chatSheet #chatComposer.composer--typing #sendBtn { animation: rd-send-pop 0.36s cubic-bezier(0.2, 0.9, 0.3, 1.5); }
#chatSheet #chatComposer #sendBtn:active { transform: scale(0.88); }
@keyframes rd-send-pop {
  0% { transform: scale(0.8) rotate(-12deg); }
  60% { transform: scale(1.08) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes rd-composer-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
#chatSheet .composer-reply-banner,
#chatSheet .composer-forward-banner {
  position: relative;
  left: auto; right: auto; bottom: auto;
  margin: 0;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--rd-border);
  border-left: 3px solid var(--primary);
  border-radius: 0;
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  box-shadow: none;
  animation: rd-composer-in 0.25s ease both;
}
#chatSheet .composer-reply-banner.hidden,
#chatSheet .composer-forward-banner.hidden { display: none; }
#chatSheet .composer-attention-bar { margin: 6px 12px 0; transform: none; border-radius: 12px; }

/* ============================================================
   v4 · Мини-плеер: не перекрывает нижнюю панель и поле ввода
   ============================================================ */
html:not(.layout-desktop) #musicDock:not(.music-dock--user-pos):not(.music-dock--titlebar) {
  bottom: calc(var(--rd-dock-h) + var(--rd-dock-gap) * 2 + env(safe-area-inset-bottom, 0px)) !important;
  max-width: min(520px, calc(100vw - 20px));
  width: min(520px, calc(100vw - 20px));
}
/* в открытом чате — под шапкой, чтобы не закрывать поле ввода */
html:not(.layout-desktop).mirage-chat-open #musicDock:not(.music-dock--titlebar) {
  top: calc(env(safe-area-inset-top, 0px) + 74px) !important;
  bottom: auto !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  animation: rd-dock-drop 0.64s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes rd-dock-drop {
  from { opacity: 0; translate: 0 -30px; scale: 0.9; filter: blur(6px); }
  60% { opacity: 1; filter: none; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}
/* веб-версия на ПК: плеер над нижней панелью в левой колонке */
html.layout-desktop:not(.twipe-client-desktop) #musicDock:not(.music-dock--user-pos):not(.music-dock--titlebar) {
  left: calc(var(--desktop-chat-x, 400px) / 2) !important;
  bottom: calc(var(--rd-dock-h) + var(--rd-dock-gap) * 2 + 6px) !important;
  width: calc(var(--desktop-chat-x, 400px) - 28px);
  max-width: calc(var(--desktop-chat-x, 400px) - 28px);
}
html:not(.layout-desktop).mirage-music-dock-open:not(.twipe-music-tab) .app-shell {
  padding-bottom: calc(var(--rd-dock-h) + var(--rd-dock-gap) * 3 + 70px + env(safe-area-inset-bottom)) !important;
}
html.twipe-client-desktop #musicDock.music-dock--titlebar {
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
}

/* ============================================================
   v4 · Плеер страницы музыки — всегда внизу страницы
   ============================================================ */
#music.active { display: flex; flex-direction: column; }
#music .music-view.is-current { flex: 0 0 auto; }
html:not(.layout-desktop) #music.active {
  min-height: calc(100dvh - var(--rd-dock-h) - var(--rd-dock-gap) * 2 - 36px - env(safe-area-inset-bottom, 0px));
}
#music .music-page-player {
  margin-top: auto;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  grid-template-areas: "art main ctrls" "seek seek seek";
  align-items: center;
  column-gap: 12px;
  row-gap: 6px;
  padding: 12px 12px 10px;
  border-radius: 24px;
  top: auto;
  bottom: 10px;
}
#music .music-page-player.hidden { display: none; }
html:not(.layout-desktop) #music .music-page-player {
  bottom: calc(var(--rd-dock-h) + var(--rd-dock-gap) * 2 + 10px + env(safe-area-inset-bottom, 0px));
}
#music .mpp-art { grid-area: art; }
#music .mpp-main { grid-area: main; }
#music .mpp-ctrls { grid-area: ctrls; }
#music .mpp-seek-row { grid-area: seek; padding: 0 2px; }
#music .mpp-title { margin-bottom: 2px; font-size: 15px; }
#music .mpp-sub { font-size: 12px; color: var(--muted); }
#music .music-page-player.is-live .mpp-sub { color: var(--primary); }
#music .mpp-time--end { text-align: right; }
#music .music-view.is-current { padding-bottom: 16px; }

/* ============================================================
   v4 · Общие компоненты страниц: чипы, поиск, формы, кошелёк
   ============================================================ */
.rd-scroll-chips {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 4px 0 2px;
  padding: 2px 0 4px;
  scroll-snap-type: x proximity;
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.rd-scroll-chips::-webkit-scrollbar { display: none; }
.rd-scroll-chips .chip {
  flex: none;
  scroll-snap-align: start;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--rd-border);
  background: var(--rd-surface);
  color: var(--text);
  font: 600 14px/1 inherit;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--rd-fast) ease, color var(--rd-fast) ease, transform var(--rd-fast) var(--rd-spring), box-shadow var(--rd-mid) ease;
}
.rd-scroll-chips .chip:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--rd-border)); }
.rd-scroll-chips .chip.active {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #7c5cff));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--primary) 80%, transparent);
}
.rd-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  margin: 8px 0 12px;
  padding: 0 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border: 1px solid transparent;
  transition: border-color var(--rd-fast) ease, background var(--rd-fast) ease, box-shadow var(--rd-mid) ease;
}
.rd-search:focus-within {
  background: var(--rd-surface);
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}
.rd-search .search-icon { position: static !important; transform: none !important; flex: none; opacity: 0.55; }
.rd-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none;
  padding: 0 !important;
  font: inherit;
  font-size: 15px;
  color: var(--text);
}
.rd-skel { animation: rd-pulse 1.2s ease-in-out infinite; }
@keyframes rd-pulse { 50% { opacity: 0.35; } }

.rd-fold {
  margin-top: 14px;
  border-radius: 20px;
  border: 1px solid var(--rd-border);
  background: var(--rd-surface);
  box-shadow: var(--rd-shadow-1, 0 4px 14px rgba(15, 23, 42, 0.06));
  overflow: hidden;
  padding: 0 !important;
}
.rd-fold-sum {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.rd-fold-sum::-webkit-details-marker { display: none; }
.rd-fold-sum > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rd-fold-sum b { font-size: 15px; }
.rd-fold-sum small { font-size: 12.5px; color: var(--muted); }
.rd-fold-ico {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #7c5cff);
  box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--primary) 80%, transparent);
  transition: transform var(--rd-mid) var(--rd-spring);
}
.rd-fold[open] .rd-fold-ico { transform: rotate(45deg); }
.rd-fold-chev { font-size: 22px; color: var(--muted); transition: transform var(--rd-mid) var(--rd-smooth); }
.rd-fold[open] .rd-fold-chev { transform: rotate(90deg); }
.rd-fold[open] .rd-form { animation: rd-view-in-down var(--rd-slow) var(--rd-smooth) both; }
@keyframes rd-view-in-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.rd-form { display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 16px; }
.rd-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.rd-field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); padding-left: 4px; }
.rd-field-row { display: flex; gap: 10px; }
.rd-field--narrow { flex: 0 0 110px; }
.rd-form .field-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--rd-border);
  background: color-mix(in srgb, var(--text) 3%, var(--bg-elevated, #fff));
  font: inherit;
  font-size: 15px;
  color: var(--text);
  transition: border-color var(--rd-fast) ease, box-shadow var(--rd-mid) ease;
}
.rd-form textarea.field-input { resize: vertical; min-height: 92px; }
.rd-form select.field-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
.rd-form .field-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}
.rd-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 16px;
  border: 1.5px dashed color-mix(in srgb, var(--primary) 35%, var(--rd-border));
  background: color-mix(in srgb, var(--primary) 4%, transparent);
  cursor: pointer;
  transition: background var(--rd-fast) ease, border-color var(--rd-fast) ease;
}
.rd-file:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.rd-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rd-file-btn {
  flex: none;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  font-weight: 600;
  font-size: 13.5px;
}
.rd-file-name { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-file.has-file { border-style: solid; border-color: color-mix(in srgb, var(--primary) 55%, transparent); }
.rd-file.has-file .rd-file-name { color: var(--text); font-weight: 600; }
.rd-wide { width: 100%; min-height: 46px; border-radius: 14px; }
.rd-hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* кошелёк — карта */
.rd-wallet {
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-items: stretch !important;
  gap: 6px !important;
  padding: 18px !important;
  border-radius: 24px !important;
  border: 0 !important;
  color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    linear-gradient(135deg, #3b6cff 0%, #5b4bff 55%, #8b3dff 100%) !important;
  box-shadow: 0 22px 40px -22px rgba(76, 70, 255, 0.85) !important;
  overflow: hidden;
  animation: rd-player-in var(--rd-slow) var(--rd-spring) both;
}
.rd-wallet::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 28px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.rd-wallet > span, .rd-wallet span { flex: initial !important; }
.rd-wallet-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rd-wallet-label { font-size: 13px; font-weight: 600; opacity: 0.85; letter-spacing: 0.02em; }
.rd-wallet-held { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); }
.rd-wallet-sum { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rd-wallet-actions { display: flex; gap: 8px; margin-top: 8px; position: relative; z-index: 1; }
.rd-wallet-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  border-radius: 14px;
  border: 0;
  background: #fff;
  color: #3b3bdb;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform var(--rd-fast) var(--rd-spring), background var(--rd-fast) ease;
}
.rd-wallet-btn:active { transform: scale(0.95); }
.rd-wallet-btn--ghost { background: rgba(255, 255, 255, 0.16); color: #fff; }
.rd-wallet-btn--ghost:hover { background: rgba(255, 255, 255, 0.24); }

.rd-safe-deal {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: color-mix(in srgb, #22c55e 8%, transparent);
  border: 1px solid color-mix(in srgb, #22c55e 22%, transparent);
}
.rd-safe-ico { font-size: 22px; line-height: 1; }
.rd-safe-deal b { font-size: 14px; }
.rd-safe-deal p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* карточки объявлений и треков */
.extras-list { gap: 10px !important; }
.extras-listing {
  padding: 14px !important;
  border-radius: 20px !important;
  gap: 8px !important;
  animation: rd-view-in-down var(--rd-mid) var(--rd-smooth) both;
}
.extras-listing .chip--static {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 0;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}
.rd-price { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.extras-listing .extras-track-title { font-size: 15.5px; }
.extras-listing .settings-row-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.extras-listing .extras-mod-actions .btn { border-radius: 12px; min-height: 36px; }
.extras-track { padding: 10px 12px !important; border-radius: 18px !important; }
.extras-track-play {
  width: 44px !important;
  height: 44px !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, var(--primary), #7c5cff) !important;
  color: #fff !important;
  font-size: 15px;
}
.extras-empty {
  text-align: center;
  padding: 26px 12px !important;
  border-radius: 20px;
  border: 1.5px dashed var(--rd-border);
  color: var(--muted);
  opacity: 1 !important;
}

/* ============================================================
   v4 · Создание группы / канала
   ============================================================ */
#createRoomSheet .cr-v4 { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; }
.cr-kind {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.cr-kind-btn {
  position: relative;
  z-index: 1;
  height: 38px;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--rd-mid) ease;
}
.cr-kind-btn.is-active { color: var(--text); }
.cr-kind-pill {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: 38px;
  border-radius: 12px;
  background: var(--bg-elevated, #fff);
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.25);
  transition: transform var(--rd-slow) var(--rd-spring);
}
#createRoomSheet.cr-is-channel .cr-kind-pill { transform: translateX(100%); }
.cr-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 6px 0 2px; }
.cr-ava {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, #34d399, #3b82f6);
  box-shadow: 0 18px 34px -16px rgba(59, 130, 246, 0.8);
  transition: background var(--rd-slow) ease, border-radius var(--rd-slow) var(--rd-spring), transform var(--rd-slow) var(--rd-spring);
}
#createRoomSheet.cr-is-channel .cr-ava {
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  box-shadow: 0 18px 34px -16px rgba(168, 85, 247, 0.85);
}
.cr-ava-ico {
  width: 38px;
  height: 38px;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: opacity var(--rd-mid) ease, transform var(--rd-mid) var(--rd-spring);
}
#createRoomSheet.cr-is-channel .cr-ava-ico {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l18-5v12L3 14v-3z'/%3E%3Cpath d='M11.6 16.8a3 3 0 1 1-5.8-1.6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l18-5v12L3 14v-3z'/%3E%3Cpath d='M11.6 16.8a3 3 0 1 1-5.8-1.6'/%3E%3C/svg%3E");
}
.cr-ava-txt { position: absolute; opacity: 0; transform: scale(0.6); transition: opacity var(--rd-mid) ease, transform var(--rd-mid) var(--rd-spring); }
.cr-ava.has-text .cr-ava-ico { opacity: 0; transform: scale(0.5); }
.cr-ava.has-text .cr-ava-txt { opacity: 1; transform: none; }
#createRoomSheet .create-room-kind-line { margin: 0; max-width: 320px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.cr-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  box-shadow: none;
}
.cr-field { display: flex; flex-direction: column; gap: 6px; }
.cr-label { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.cr-label em { font-style: normal; font-weight: 500; opacity: 0.7; font-variant-numeric: tabular-nums; }
.cr-label--block { padding: 0 4px 2px; }
#createRoomSheet .create-room-input {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--rd-border);
  background: color-mix(in srgb, var(--text) 3%, var(--bg-elevated, #fff));
  font-size: 16px;
  transition: border-color var(--rd-fast) ease, box-shadow var(--rd-mid) ease;
}
#createRoomSheet .create-room-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}
.cr-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  border: 1.5px solid var(--rd-border);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--rd-fast) ease, background var(--rd-fast) ease, transform var(--rd-fast) var(--rd-spring);
}
.cr-opt:active { transform: scale(0.98); }
.cr-opt.is-active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, transparent); }
.cr-opt-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, var(--text) 6%, transparent); }
.cr-opt-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cr-opt-txt b { font-size: 15px; }
.cr-opt-txt small { font-size: 12.5px; color: var(--muted); }
.cr-opt-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--rd-border); transition: border-color var(--rd-fast) ease, box-shadow var(--rd-fast) ease; }
.cr-opt.is-active .cr-opt-dot { border-color: var(--primary); box-shadow: inset 0 0 0 5px var(--primary); }
#createRoomSheet .create-room-submit {
  min-height: 52px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  transition: opacity var(--rd-fast) ease, transform var(--rd-fast) var(--rd-spring), filter var(--rd-fast) ease;
}
#createRoomSheet .create-room-submit:disabled { opacity: 0.45; filter: saturate(0.6); cursor: not-allowed; }
#createRoomSheet .create-room-submit.is-busy { opacity: 0.7; }
#createRoomSheet .create-room-hint { text-align: center; margin: 0; }

/* ============================================================
   v4 · Стартовый сайт (лендинг)
   ============================================================ */
#introScreen.lp {
  display: block;
  padding: 0;
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--text);
}
#introScreen.lp.hidden { display: none; }
.lp-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; background: var(--bg) !important; }
.lp-blob {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  animation: lp-float 18s ease-in-out infinite alternate;
}
.lp-blob--1 { left: -12vmax; top: -16vmax; background: radial-gradient(circle, #60a5fa, transparent 65%); }
.lp-blob--2 { right: -14vmax; top: 8vmax; background: radial-gradient(circle, #a78bfa, transparent 65%); animation-duration: 22s; }
.lp-blob--3 { left: 20vw; bottom: -22vmax; background: radial-gradient(circle, #f472b6, transparent 65%); opacity: 0.28; animation-duration: 26s; }
[data-theme="dark"] .lp-blob { opacity: 0.32; }
.lp-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}
@keyframes lp-float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(6vmax, 4vmax) scale(1.12); }
}
.lp-wrap { position: relative; z-index: 1; width: min(1160px, 100%); margin: 0 auto; padding: 0 20px calc(24px + env(safe-area-inset-bottom)); box-sizing: border-box; }

.lp-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -20px;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  transition: background var(--rd-mid) ease, box-shadow var(--rd-mid) ease, backdrop-filter var(--rd-mid) ease;
}
#introScreen.lp-scrolled .lp-nav {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent);
}
.lp-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.lp-brand img { border-radius: 9px; }
.lp-links { display: flex; gap: 4px; margin: 0 auto; }
.lp-links .landing-top-link {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--rd-fast) ease, color var(--rd-fast) ease;
}
.lp-links .landing-top-link:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.lp-login {
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--rd-border);
  background: var(--rd-surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--rd-fast) var(--rd-spring);
}
.lp-login:active { transform: scale(0.95); }
@media (max-width: 720px) {
  .lp-links { display: none; }
  .lp-login { margin-left: auto; }
}

.lp-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 40px;
  min-height: min(760px, calc(100dvh - 70px));
  padding: 24px 0 40px;
}
.lp-rise { animation: lp-rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--d, 0) * 90ms + 120ms); }
@keyframes lp-rise { from { opacity: 0; transform: translateY(24px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.lp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--rd-border);
  background: var(--rd-surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.lp-eyebrow i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2); animation: lp-ping 2s ease-in-out infinite; }
@keyframes lp-ping { 50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.05); } }
.lp-title {
  margin: 18px 0 14px;
  font-size: clamp(38px, 5.4vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
  text-align: left;
}
.lp-grad {
  background: linear-gradient(100deg, #3b82f6, #8b5cf6 45%, #ec4899 90%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: lp-shine 6s ease-in-out infinite alternate;
}
@keyframes lp-shine { to { background-position: 100% 0; } }
#introScreen .lp-sub { margin: 0; max-width: 520px; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.55; color: var(--muted); text-align: left; }
.lp-typing { margin: 18px 0 0; font-size: 16px; font-weight: 600; color: var(--muted); }
.lp-typing-word { color: var(--text); font-weight: 800; display: inline-block; }
.lp-typing-word.is-swap { animation: lp-word 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes lp-word { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.lp-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 54px;
  padding: 0 26px;
  border-radius: 18px;
  border: 0;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--rd-fast) var(--rd-spring), box-shadow var(--rd-mid) ease, background var(--rd-fast) ease;
}
.lp-btn:active { transform: scale(0.96); }
.lp-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #6366f1 60%, #8b5cf6);
  box-shadow: 0 18px 34px -14px rgba(79, 70, 229, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.lp-btn--primary:hover { box-shadow: 0 22px 40px -14px rgba(79, 70, 229, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25); transform: translateY(-1px); }
.lp-btn--ghost { color: var(--text); background: var(--rd-surface); border: 1px solid var(--rd-border); }
.lp-btn--white { color: #4338ca; background: #fff; }
.lp-btn--sm { height: 44px; padding: 0 18px; font-size: 14.5px; border-radius: 14px; width: 100%; }
.lp-stats { display: flex; gap: 28px; margin-top: 34px; }
.lp-stats div { display: flex; flex-direction: column; }
.lp-stats b { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.lp-stats span { font-size: 13px; color: var(--muted); }

.lp-mock { position: relative; display: flex; justify-content: center; }
.lp-phone {
  position: relative;
  width: min(330px, 100%);
  height: 560px;
  border-radius: 44px;
  padding: 14px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  box-shadow: 0 50px 90px -40px rgba(30, 41, 59, 0.55), 0 0 0 10px color-mix(in srgb, var(--text) 4%, transparent);
  animation: lp-bob 7s ease-in-out infinite;
}
@keyframes lp-bob { 50% { transform: translateY(-10px) rotate(-0.6deg); } }
.lp-phone-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; border-bottom: 1px solid var(--rd-border); }
.lp-phone-head b { display: block; font-size: 14px; }
.lp-phone-head small { font-size: 12px; color: var(--primary); }
.lp-ava { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; background: linear-gradient(135deg, #34d399, #3b82f6); }
.lp-phone-body { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 12px 4px; overflow: hidden; }
.lp-msg {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.35;
  opacity: 0;
  animation: lp-msg 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
  animation-delay: calc(var(--m) * 0.7s + 0.9s);
}
@keyframes lp-msg { from { opacity: 0; transform: translateY(12px) scale(0.94); } to { opacity: 1; transform: none; } }
.lp-msg--in { align-self: flex-start; background: color-mix(in srgb, var(--text) 7%, transparent); border-bottom-left-radius: 6px; transform-origin: bottom left; }
.lp-msg--out { align-self: flex-end; color: #fff; background: linear-gradient(135deg, #3b82f6, #6366f1); border-bottom-right-radius: 6px; transform-origin: bottom right; }
.lp-msg--voice { display: flex; align-items: center; gap: 8px; }
.lp-msg--voice > i { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); flex: none; position: relative; }
.lp-msg--voice > i::after { content: ""; position: absolute; left: 10px; top: 8px; border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.lp-msg--voice small { font-size: 11px; color: var(--muted); }
.lp-wave { display: flex; align-items: center; gap: 2px; height: 20px; }
.lp-wave b { width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--primary) 70%, transparent); animation: lp-wave 1.1s ease-in-out infinite; }
.lp-wave b:nth-child(odd) { animation-delay: -0.4s; }
.lp-wave b:nth-child(3n) { animation-delay: -0.8s; }
@keyframes lp-wave { 0%, 100% { height: 5px; } 50% { height: 18px; } }
.lp-msg--music { display: flex; gap: 10px; align-items: center; }
.lp-msg--music > i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-style: normal; background: linear-gradient(135deg, #f43f5e, #f59e0b); flex: none; }
.lp-msg--music b { display: block; font-size: 13px; }
.lp-msg--music small { font-size: 11px; color: var(--muted); }
.lp-phone-composer { display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 6px 0 16px; border-radius: 999px; border: 1px solid var(--rd-border); background: var(--bg); font-size: 14px; color: var(--muted); }
.lp-phone-composer i { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #6366f1); }
.lp-float {
  position: absolute;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  box-shadow: var(--rd-shadow-2);
  font-size: 13.5px;
  font-weight: 700;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  animation: lp-bob 6s ease-in-out infinite;
}
.lp-float--1 { left: 0; top: 18%; animation-delay: -2s; }
.lp-float--2 { right: 0; bottom: 16%; animation-delay: -4s; }

.lp-section { padding: 72px 0 8px; scroll-margin-top: 70px; }
.lp-h2 { margin: 0 0 10px; font-size: clamp(30px, 4vw, 46px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 800; text-align: center; }
.lp-lead { margin: 0 auto 32px; max-width: 560px; color: var(--muted); font-size: 17px; line-height: 1.55; text-align: center; }
.lp-h2--left, .lp-lead--left { text-align: left; margin-left: 0; }
.lp-reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); transition-delay: calc(var(--i, 0) * 70ms); }
.lp-reveal.is-in { opacity: 1; transform: none; }
html[data-motion="reduced"] .lp-reveal { opacity: 1; transform: none; transition: none; }
.lp-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lp-card {
  padding: 22px;
  border-radius: 26px;
  background: var(--rd-surface);
  border: 1px solid var(--rd-border);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: transform var(--rd-mid) var(--rd-spring), box-shadow var(--rd-mid) ease, opacity 0.7s ease;
}
.lp-card:hover { transform: translateY(-4px); box-shadow: 0 26px 50px -30px rgba(30, 41, 59, 0.5); }
.lp-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 12px 24px -12px var(--c1); }
.lp-card h3 { margin: 16px 0 6px; font-size: 18px; letter-spacing: -0.01em; }
.lp-card p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); }

.lp-split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.lp-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.lp-checks li { position: relative; padding-left: 34px; font-size: 16px; font-weight: 600; }
.lp-checks li::before { content: "✓"; position: absolute; left: 0; top: -2px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: #fff; background: linear-gradient(135deg, #22c55e, #10b981); }
.lp-privacy { padding: 10px; border-radius: 28px; background: var(--rd-surface); border: 1px solid var(--rd-border); box-shadow: 0 40px 80px -50px rgba(30, 41, 59, 0.6); }
.lp-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px; font-size: 15px; font-weight: 600; }
.lp-toggle-row + .lp-toggle-row { border-top: 1px solid var(--rd-border); }
.lp-toggle-row b { color: var(--primary); font-size: 14px; }
.lp-switch { width: 46px; height: 28px; border-radius: 999px; background: color-mix(in srgb, var(--text) 15%, transparent); position: relative; }
.lp-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.3s var(--rd-spring); }
.lp-switch.is-on { background: #22c55e; }
.lp-switch.is-on::after { transform: translateX(18px); }

.lp-apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lp-app { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 24px; border-radius: 26px; background: var(--rd-surface); border: 1px solid var(--rd-border); }
.lp-app-ico { font-size: 34px; }
.lp-app h3 { margin: 4px 0 0; font-size: 20px; }
.lp-app p { margin: 0 0 6px; flex: 1; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.lp-link { align-self: center; border: 0; background: none; padding: 4px; font: inherit; font-size: 14px; font-weight: 600; color: var(--primary); text-decoration: none; cursor: pointer; }

.lp-faq { max-width: 760px; margin: 24px auto 0; display: flex; flex-direction: column; gap: 10px; }
.lp-faq details { border-radius: 20px; background: var(--rd-surface); border: 1px solid var(--rd-border); overflow: hidden; }
.lp-faq summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; font-weight: 700; font-size: 16px; cursor: pointer; list-style: none; }
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary::after { content: "+"; font-size: 22px; font-weight: 500; color: var(--muted); transition: transform var(--rd-mid) var(--rd-spring); }
.lp-faq details[open] summary::after { transform: rotate(45deg); }
.lp-faq details p { margin: 0; padding: 0 20px 18px; color: var(--muted); line-height: 1.55; animation: rd-view-in-down 0.35s ease both; }

.lp-final {
  margin: 80px 0 24px;
  padding: 48px 24px;
  border-radius: 34px;
  text-align: center;
  color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, 0.2), transparent 50%), linear-gradient(135deg, #3b82f6, #6366f1 50%, #a855f7);
  box-shadow: 0 40px 80px -40px rgba(79, 70, 229, 0.8);
}
.lp-final h2 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.03em; }
.lp-final p { margin: 0 0 22px; opacity: 0.85; font-size: 17px; }
.lp-foot { display: flex; justify-content: center; align-items: center; gap: 20px; padding: 10px 0 20px; font-size: 13.5px; color: var(--muted); }
.lp-foot a, .lp-foot button { color: var(--muted); text-decoration: none; border: 0; background: none; font: inherit; cursor: pointer; }

@media (max-width: 900px) {
  .lp-hero { grid-template-columns: 1fr; gap: 28px; min-height: 0; padding-top: 18px; }
  .lp-mock { order: 2; }
  .lp-features, .lp-apps { grid-template-columns: 1fr 1fr; }
  .lp-split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .lp-features, .lp-apps { grid-template-columns: 1fr; }
  .lp-cta .lp-btn { flex: 1 1 100%; }
  .lp-stats { gap: 20px; }
  .lp-phone { height: 500px; }
  .lp-float--1 { left: -4px; }
  .lp-float--2 { right: -4px; }
  .lp-section { padding-top: 56px; }
}

/* ============================================================
   v4 · Настройки — главная страница
   ============================================================ */
#settings { padding-top: 6px; }
#settings .st-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "ava main" "act act";
  align-items: center;
  gap: 14px 14px;
  margin: 4px 0 12px;
  padding: 18px;
  border-radius: 26px;
  text-align: left;
  background:
    radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 60%),
    var(--rd-surface);
  border: 1px solid var(--rd-border);
  box-shadow: var(--rd-shadow-1, 0 6px 20px rgba(15, 23, 42, 0.06));
  animation: rd-player-in var(--rd-slow) var(--rd-spring) both;
}
#settings .st-hero-ava { grid-area: ava; }
#settings .st-hero-ava .settings-hero-avatar,
#settings .st-hero-ava .settings-hero-avatar-letter {
  width: 72px !important;
  height: 72px !important;
  margin: 0 !important;
  border-radius: 24px !important;
  font-size: 28px !important;
  display: grid;
  place-items: center;
  object-fit: cover;
  box-shadow: 0 12px 24px -12px color-mix(in srgb, var(--primary) 80%, transparent);
}
#settings .st-hero-ava .settings-hero-avatar-btn { padding: 0; border: 0; background: none; border-radius: 24px; }
#settings .st-hero-main { grid-area: main; min-width: 0; }
#settings .st-hero .profile-hero-name { margin: 0 0 4px; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 6px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#settings .st-hero .profile-hero-badge { display: inline-flex; margin: 0; }
#settings .st-hero .profile-hero-meta { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); text-align: left; }
.st-plan { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.st-plan--plus { color: #fff; background: linear-gradient(135deg, #f59e0b, #ec4899 60%, #8b5cf6); }
#settings .st-hero-actions { grid-area: act; display: flex; gap: 8px; }
.st-hero-btn {
  flex: 1;
  height: 40px;
  border-radius: 13px;
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #7c5cff));
  box-shadow: 0 10px 20px -12px color-mix(in srgb, var(--primary) 90%, transparent);
  cursor: pointer;
  transition: transform var(--rd-fast) var(--rd-spring), filter var(--rd-fast) ease;
}
.st-hero-btn:active { transform: scale(0.95); }
.st-hero-btn--ghost { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); box-shadow: none; }
.st-hero-btn--icon { flex: 0 0 40px; color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); box-shadow: none; font-size: 18px; }

.st-plus {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 6px;
  padding: 14px 16px;
  border: 0;
  border-radius: 22px;
  color: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: radial-gradient(120% 160% at 0% 0%, rgba(255, 255, 255, 0.25), transparent 50%), linear-gradient(120deg, #f59e0b, #ec4899 50%, #8b5cf6);
  background-size: 160% 100%;
  box-shadow: 0 18px 32px -18px rgba(236, 72, 153, 0.8);
  animation: lp-shine 6s ease-in-out infinite alternate;
  transition: transform var(--rd-fast) var(--rd-spring);
}
.st-plus:active { transform: scale(0.98); }
.st-plus-star { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 20px; background: rgba(255, 255, 255, 0.22); }
.st-plus-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.st-plus-txt b { font-size: 16px; }
.st-plus-txt small { font-size: 12.5px; opacity: 0.9; }
.st-plus-go { font-size: 24px; opacity: 0.85; }

#settings .st-group-title { margin: 18px 8px 8px; font-size: 12.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
#settings .st-cluster {
  margin: 0;
  padding: 4px !important;
  border-radius: 22px !important;
  background: var(--rd-surface) !important;
  border: 1px solid var(--rd-border) !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  gap: 0 !important;
}
#settings .st-cluster .settings-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin: 0 !important;
  padding: 8px 10px !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: background var(--rd-fast) ease, transform var(--rd-fast) var(--rd-spring);
}
#settings .st-cluster .settings-row + .settings-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 60px;
  right: 12px;
  height: 1px;
  background: var(--rd-border);
}
#settings .st-cluster .settings-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent) !important; }
#settings .st-cluster .settings-row:hover + .settings-row::before,
#settings .st-cluster .settings-row:hover::before { opacity: 0; }
#settings .st-cluster .settings-row:active { transform: scale(0.985); background: color-mix(in srgb, var(--text) 7%, transparent) !important; }
#settings .st-ico {
  flex: none;
  width: 36px !important;
  height: 36px !important;
  border-radius: 11px !important;
  display: grid !important;
  place-items: center;
  color: #fff !important;
  background: linear-gradient(145deg, color-mix(in srgb, var(--ic) 82%, #fff), var(--ic)) !important;
  box-shadow: 0 6px 14px -8px var(--ic);
}
#settings .st-ico svg { width: 20px !important; height: 20px !important; stroke: #fff !important; stroke-width: 2; }
#settings .st-cluster .settings-row-title { font-size: 15.5px; font-weight: 600; }
#settings .st-cluster .settings-row-desc { font-size: 12.5px; margin-top: 1px; }
#settings .st-value { font-size: 14px; color: var(--muted); font-weight: 600; }
#settings .settings-row-arrow { font-size: 22px; line-height: 1; color: color-mix(in srgb, var(--muted) 70%, transparent); transform: none !important; }
#settings .st-logout {
  width: 100%;
  margin: 22px 0 6px;
  height: 50px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, #ef4444 25%, transparent);
  background: color-mix(in srgb, #ef4444 7%, transparent);
  color: #ef4444;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
#settings .st-version { margin: 6px 0 12px; text-align: center; font-size: 12px; color: var(--muted); opacity: 0.7; }

/* ============================================================
   v4 · Звуковые темы в «Уведомления и звуки»
   ============================================================ */
.sound-packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 6px 0 14px; }
.sound-pack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
  border-radius: 18px;
  border: 1.5px solid var(--rd-border);
  background: var(--rd-surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--rd-fast) ease, transform var(--rd-fast) var(--rd-spring), box-shadow var(--rd-mid) ease;
}
.sound-pack:active { transform: scale(0.96); }
.sound-pack.is-active { border-color: var(--primary); box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--primary) 80%, transparent); }
.sound-pack.is-active::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  animation: rd-send-pop 0.3s ease;
}
.sound-pack-wave { display: flex; align-items: center; gap: 3px; height: 26px; margin-bottom: 4px; }
.sound-pack-wave i { width: 4px; height: 8px; border-radius: 2px; background: color-mix(in srgb, var(--primary) 55%, transparent); }
.sound-pack-wave i:nth-child(2) { height: 18px; }
.sound-pack-wave i:nth-child(3) { height: 24px; }
.sound-pack-wave i:nth-child(4) { height: 14px; }
.sound-pack[data-sound-pack="soft"] .sound-pack-wave i { background: color-mix(in srgb, #10b981 60%, transparent); }
.sound-pack[data-sound-pack="classic"] .sound-pack-wave i { background: color-mix(in srgb, #f59e0b 65%, transparent); }
.sound-pack.is-playing .sound-pack-wave i { animation: lp-wave 0.7s ease-in-out 2; }
.sound-pack.is-playing .sound-pack-wave i:nth-child(2n) { animation-delay: -0.3s; }
.sound-pack-name { font-weight: 800; font-size: 15px; }
.sound-pack-desc { font-size: 12px; line-height: 1.35; color: var(--muted); }
.sound-volume-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: var(--rd-surface); border: 1px solid var(--rd-border); }
.sound-volume-row .ui-icon { flex: none; width: 20px; height: 20px; }
.ui-icon--volume-low {
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M15.5 8.5a5 5 0 010 7M19 5a10 10 0 010 14'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M15.5 8.5a5 5 0 010 7M19 5a10 10 0 010 14'/%3E%3C/svg%3E") center / contain no-repeat;
  color: var(--muted);
}
#soundVolumeRange {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--primary) var(--fill, 70%), color-mix(in srgb, var(--text) 14%, transparent) var(--fill, 70%));
  cursor: pointer;
}
#soundVolumeRange::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
#soundVolumeRange::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.sound-volume-val { min-width: 40px; text-align: right; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.sound-preview-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.chip-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--rd-border);
  background: var(--rd-surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--rd-fast) var(--rd-spring), background var(--rd-fast) ease;
}
.chip-btn:hover { background: color-mix(in srgb, var(--primary) 8%, var(--rd-surface)); }
.chip-btn:active { transform: scale(0.94); }
@media (max-width: 380px) { .sound-packs { grid-template-columns: 1fr; } }

/* ============================================================
   v4 · Главная со списком чатов: аккуратнее и компактнее
   ============================================================ */
.chat-create-bar { display: flex; gap: 8px; }
.chat-create-bar .chat-create-btn,
#newChannelBtnBeacons {
  flex: 1;
  height: 42px;
  border-radius: 14px !important;
  border: 0 !important;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary) !important;
  background: color-mix(in srgb, var(--primary) 9%, transparent) !important;
  box-shadow: none !important;
  transition: background var(--rd-fast) ease, transform var(--rd-fast) var(--rd-spring);
}
#newChannelBtn, #newChannelBtnBeacons { color: #8b5cf6 !important; background: color-mix(in srgb, #8b5cf6 10%, transparent) !important; }
.chat-create-bar .chat-create-btn:hover { background: color-mix(in srgb, var(--primary) 15%, transparent) !important; }
#newChannelBtn:hover { background: color-mix(in srgb, #8b5cf6 16%, transparent) !important; }
#newChannelBtnBeacons { flex: none; padding: 0 16px; }
.user-search-card {
  border-radius: 16px !important;
  min-height: 46px;
  border: 1px solid transparent !important;
  background: color-mix(in srgb, var(--text) 5%, transparent) !important;
  box-shadow: none !important;
  transition: border-color var(--rd-fast) ease, background var(--rd-fast) ease, box-shadow var(--rd-mid) ease;
}
.user-search-card:focus-within {
  background: var(--rd-surface) !important;
  border-color: color-mix(in srgb, var(--primary) 45%, transparent) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent) !important;
}
.chat-filter-inner {
  border-radius: 16px !important;
  min-height: 44px;
  border: 1px solid transparent !important;
  background: color-mix(in srgb, var(--text) 4%, transparent) !important;
  box-shadow: none !important;
}
.chat-filter-inner:focus-within { border-color: color-mix(in srgb, var(--primary) 45%, transparent) !important; background: var(--rd-surface) !important; }
.story-add .story-ring-dashed {
  border-color: color-mix(in srgb, var(--primary) 45%, transparent) !important;
  color: var(--primary) !important;
  background: color-mix(in srgb, var(--primary) 6%, transparent) !important;
}
#chats, #beacons { gap: 6px !important; }
#chats .chat-swipe, #beacons .chat-swipe { margin-bottom: 0 !important; }
#chats .chat-swipe-front, #beacons .chat-swipe-front { min-height: 66px; border-radius: 18px !important; }
html.layout-desktop #chatSheet.sheet-chat { padding-bottom: 0 !important; }
html.twipe-client-desktop #chatSheet.sheet-chat:not(.hidden) { height: calc(100dvh - var(--desktop-topstrip-h, 40px)) !important; max-height: none !important; }

/* ============================================================
   v5 · Экран звонка
   ============================================================ */
#callSheet.call-sheet { position: fixed; inset: 0; z-index: 2147482500; color: #fff; }
#callSheet .call-sheet-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 60% at 20% 10%, rgba(99, 102, 241, 0.45), transparent 60%),
    radial-gradient(70% 60% at 90% 90%, rgba(236, 72, 153, 0.35), transparent 60%),
    linear-gradient(160deg, #0b1020, #141a33 55%, #1b1030);
  animation: rd-call-bg 14s ease-in-out infinite alternate;
}
@keyframes rd-call-bg { to { filter: hue-rotate(25deg); } }
#callSheet .call-screen {
  position: relative;
  height: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: none;
  border: 0;
  box-shadow: none;
}
#callSheet .call-head { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; z-index: 3; position: relative; }
.call-peer-ava {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 38px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #60a5fa, #8b5cf6);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.06), 0 0 0 22px rgba(255, 255, 255, 0.03), 0 24px 60px -20px rgba(99, 102, 241, 0.9);
  animation: rd-call-pulse 2.4s ease-in-out infinite;
}
.call-peer-ava img { width: 100%; height: 100%; object-fit: cover; }
@keyframes rd-call-pulse { 50% { box-shadow: 0 0 0 16px rgba(255, 255, 255, 0.08), 0 0 0 32px rgba(255, 255, 255, 0.03), 0 24px 60px -20px rgba(99, 102, 241, 0.9); } }
#callSheet.call-sheet--video .call-peer-ava { display: none; }
#callSheet .call-sheet-title { margin: 10px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
#callSheet .call-sheet-status { margin: 0; font-size: 14px; color: rgba(255, 255, 255, 0.7); min-height: 18px; }
.call-secure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.call-secure.is-e2e { border-color: rgba(34, 197, 94, 0.45); color: #bbf7d0; }
.call-secure.is-warn { border-color: rgba(250, 204, 21, 0.6); color: #fde68a; background: rgba(250, 204, 21, 0.12); }
.call-secure-code { letter-spacing: 2px; }
.call-secure-pop {
  position: absolute;
  top: 100%;
  margin-top: 8px;
  width: min(340px, 90vw);
  padding: 16px;
  border-radius: 20px;
  text-align: center;
  background: rgba(15, 18, 35, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: rd-view-in-down 0.3s ease both;
  z-index: 10;
}
.call-secure-pop b { font-size: 15px; }
.call-secure-emoji { font-size: 34px; letter-spacing: 6px; margin: 10px 0 4px; }
.call-secure-digits { font-family: ui-monospace, monospace; font-size: 15px; letter-spacing: 1px; color: rgba(255, 255, 255, 0.8); }
.call-secure-pop p { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: rgba(255, 255, 255, 0.7); }
.call-secure-trust { margin-top: 12px; width: 100%; height: 40px; border: 0; border-radius: 12px; background: #22c55e; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }

#callSheet .call-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 14px 0;
  border-radius: 28px;
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: none;
}
#callSheet:not(.call-sheet--video) .call-stage { margin: 0; }
#callSheet.call-sheet--video .call-stage { background: #000; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9); }
#callSheet .call-video-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
#callSheet:not(.call-sheet--video) .call-video-remote { display: none; }
#callSheet .call-video-local {
  position: absolute;
  right: 14px;
  bottom: 14px;
  top: auto;
  width: min(30%, 200px);
  aspect-ratio: 3 / 4;
  height: auto;
  object-fit: cover;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 16px 34px -12px rgba(0, 0, 0, 0.8);
  z-index: 2;
}
#callSheet.call-sheet--video .call-head {
  position: absolute;
  top: calc(26px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

#callSheet .call-dock {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}
#callSheet .call-quick-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
#callSheet .call-chip {
  width: 68px;
  height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: none;
  font: inherit;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.25s var(--rd-spring, ease);
}
#callSheet .call-chip.hidden { display: none; }
#callSheet .call-chip:hover { background: rgba(255, 255, 255, 0.18); }
#callSheet .call-chip:active { transform: scale(0.92); }
#callSheet .call-chip .call-chip-ico { width: 24px; height: 24px; background-color: #fff; color: #fff; filter: none; }
#callSheet .call-chip .call-chip-label { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
#callSheet .call-chip-emoji { font-size: 22px; line-height: 1; }
#callSheet .call-chip.active-off { background: #fff; }
#callSheet .call-chip.active-off .call-chip-ico { background-color: #111827; }
#callSheet .call-chip.active-off .call-chip-label { color: #111827; }
#callSheet .call-chip.active { background: rgba(99, 102, 241, 0.6); }
#callSheet .call-chip--fx.is-on { box-shadow: inset 0 0 0 2px #a78bfa; }
#callSheet .call-hangup {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f43f5e, #dc2626);
  box-shadow: 0 18px 36px -12px rgba(244, 63, 94, 0.9);
  cursor: pointer;
  transition: transform 0.25s var(--rd-spring, ease);
}
#callSheet .call-hangup:hover { transform: scale(1.06); }
#callSheet .call-hangup:active { transform: scale(0.92); }
#callSheet .call-hangup .ui-icon { width: 30px; height: 30px; background-color: #fff; }

/* выезжающая панель: голос / звуки / громкость */
.call-drawer {
  position: relative;
  flex: none;
  margin: 0 auto 14px;
  width: min(560px, 100%);
  max-height: min(48vh, 420px);
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  background: rgba(14, 17, 34, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  z-index: 6;
  overflow: hidden;
  animation: rd-drawer-up 0.34s var(--rd-spring, ease) both;
}
.call-drawer.hidden { display: none; }
@keyframes rd-drawer-up { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }
.call-drawer-tabs { display: flex; align-items: center; gap: 4px; padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.call-drawer-tab { height: 36px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; color: rgba(255, 255, 255, 0.65); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.call-drawer-tab.is-active { background: rgba(255, 255, 255, 0.12); color: #fff; }
.call-drawer-close { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 20px; cursor: pointer; }
.call-drawer-page { display: none; padding: 14px; overflow-y: auto; }
.call-drawer-page.is-active { display: block; animation: rd-composer-in 0.25s ease both; }
.call-drawer-hint { margin: 0 0 12px; font-size: 13px; color: rgba(255, 255, 255, 0.6); }
.call-voice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.call-voice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border-radius: 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s var(--rd-spring, ease), border-color 0.2s ease, background 0.2s ease;
}
.call-voice:active { transform: scale(0.94); }
.call-voice.is-active { border-color: #a78bfa; background: rgba(139, 92, 246, 0.25); }
.call-voice-ico { font-size: 26px; }
.call-drawer-sec { margin-top: 12px; }
.call-drawer-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.call-mini-btn { height: 30px; padding: 0 12px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.12); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
#callSheet .call-sound-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
#callSheet .call-sound-row { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.07); }
#callSheet .call-sound-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: #fff; }
#callSheet .call-sound-play, #callSheet .call-sound-del { width: 30px; height: 30px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; }
#callSheet .call-sound-play { background: linear-gradient(135deg, #6366f1, #a855f7); }
.call-music-list { display: flex; flex-direction: column; gap: 6px; }
.call-track { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, 0.05); color: #fff; font: inherit; text-align: left; cursor: pointer; transition: background 0.2s ease; }
.call-track:hover { background: rgba(255, 255, 255, 0.12); }
.call-track-art { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg, hsl(var(--h) 70% 55%), hsl(calc(var(--h) + 40) 70% 45%)); flex: none; }
.call-track-art img { width: 100%; height: 100%; object-fit: cover; }
.call-track-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.call-track-play { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: rgba(255, 255, 255, 0.14); }
.call-now { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(168, 85, 247, 0.35)); }
.call-now[hidden] { display: none; }
.call-now-eq { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.call-now-eq i { width: 3px; background: #fff; border-radius: 2px; animation: lp-wave 0.9s ease-in-out infinite; }
.call-now-eq i:nth-child(2) { animation-delay: -0.3s; }
.call-now-eq i:nth-child(3) { animation-delay: -0.6s; }
.call-now-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 700; }
.call-now-vol { width: 90px; }
.call-now-stop { width: 32px; height: 32px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.2); color: #fff; cursor: pointer; }
#callSheet .call-slider-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
#callSheet .call-slider-label { width: 120px; font-size: 14px; color: rgba(255, 255, 255, 0.8); }
#callSheet .call-range { flex: 1; accent-color: #a78bfa; }
@media (max-width: 520px) {
  #callSheet .call-chip { width: 58px; height: 60px; border-radius: 17px; }
  #callSheet .call-quick-row { gap: 6px; padding: 8px; }
  .call-voice-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
#callSheet .call-secure, #callSheet .call-secure-pop { pointer-events: auto; }

/* ================= v5 · Desktop: музыка и биржа на всю правую область ================= */
html.layout-desktop .app-shell--route-music #chats,
html.layout-desktop .app-shell--route-market #chats {
  display: flex;
  animation: none;
}
html.layout-desktop #music.active,
html.layout-desktop #market.active {
  position: fixed;
  top: var(--desktop-topstrip-h, 0px);
  left: var(--desktop-chat-x);
  right: 0;
  bottom: 0;
  z-index: 30;
  width: auto !important;
  max-width: none;
  height: auto;
  margin: 0;
  padding: 28px max(32px, calc((100% - 1080px) / 2)) 40px;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  border-left: 1px solid var(--line);
  animation: rd-pane-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes rd-pane-in {
  from { opacity: 0; transform: translateX(26px); }
  to { opacity: 1; transform: none; }
}
html.layout-desktop.desk-side-pane .desktop-welcome-pane { visibility: hidden; }
html.layout-desktop #appShell.app-shell--route-music .desktop-sidebar-nav,
html.layout-desktop #appShell.app-shell--route-market .desktop-sidebar-nav { display: flex !important; }
html.layout-desktop.desk-side-pane #chatSheet { visibility: hidden !important; pointer-events: none !important; }

/* ================= v5 · Создание группы/канала — модальное окно ================= */
.cr-modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(2, 6, 23, 0.46);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  backdrop-filter: blur(6px) saturate(140%);
  animation: cr-scrim-in 0.24s ease both;
}
.cr-modal-scrim.hidden { display: none !important; }
.cr-modal-scrim.cr-leaving { animation: cr-scrim-out 0.2s ease both; }
@keyframes cr-scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cr-scrim-out { from { opacity: 1; } to { opacity: 0; } }

html body #createRoomSheet.cr-modal {
  position: fixed !important;
  inset: auto !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 9001 !important;
  width: min(480px, calc(100vw - 24px)) !important;
  max-width: none !important;
  height: auto !important;
  max-height: min(760px, calc(100dvh - 32px)) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column;
  border-radius: 26px !important;
  border: 1px solid color-mix(in srgb, var(--text) 9%, transparent) !important;
  background: var(--bg-elevated, var(--bg)) !important;
  box-shadow: 0 30px 80px -20px rgba(2, 6, 23, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03) inset !important;
  overflow: hidden !important;
  transform: translate(-50%, -50%) !important;
  opacity: 1 !important;
  animation: cr-modal-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
html body #createRoomSheet.cr-modal.hidden { display: none !important; }
html body #createRoomSheet.cr-modal.cr-leaving { animation: cr-modal-out 0.2s ease both; }
@keyframes cr-modal-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes cr-modal-out {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
}
#createRoomSheet .cr-modal-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 14px 56px 6px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#createRoomSheet .cr-modal-head .sheet-title { font-size: 18px; font-weight: 750; letter-spacing: -0.01em; text-align: center; }
#createRoomSheet .cr-modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
#createRoomSheet .cr-modal-close:hover { background: color-mix(in srgb, var(--text) 11%, transparent); color: var(--text); transform: rotate(90deg); }
#createRoomSheet.cr-modal .sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 22px 22px !important;
  background: transparent !important;
}
html[data-theme="dark"] body #createRoomSheet.cr-modal { background: color-mix(in srgb, var(--bg-elevated, #111827) 96%, #fff 4%) !important; }
@media (max-width: 560px) {
  html body #createRoomSheet.cr-modal {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-height: calc(100dvh - 40px) !important;
    border-radius: 26px 26px 0 0 !important;
    transform: none !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    animation-name: cr-modal-up;
  }
  html body #createRoomSheet.cr-modal.cr-leaving { animation-name: cr-modal-down; }
  @keyframes cr-modal-up { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes cr-modal-down { from { transform: none; } to { transform: translateY(100%); } }
}
#createRoomSheet.cr-modal .create-room-submit { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -14px 24px 6px var(--bg-elevated, var(--bg)), 0 10px 24px -10px rgba(59, 130, 246, 0.6); }
#createRoomSheet.cr-modal .cr-ava { width: 76px; height: 76px; }
#createRoomSheet.cr-modal .create-room-submit:disabled { opacity: 1; filter: none; background: color-mix(in srgb, #3b82f6 32%, var(--bg-elevated, var(--bg))) !important; color: color-mix(in srgb, #fff 80%, transparent) !important; }

/* ================= v5 · Поля ввода в окнах настроек ================= */
.sheet-settings .sheet-body > input.field-input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
.sheet-settings .sheet-body > textarea.field-input,
.sheet-settings .sheet-body > select.field-input {
  box-sizing: border-box;
  min-height: 46px;
  padding: 11px 14px;
  margin: 4px 0 10px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--text) 11%, transparent);
  background: var(--rd-surface, var(--bg-elevated));
  font-size: 15px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.sheet-settings .sheet-body > input.field-input:focus,
.sheet-settings .sheet-body > textarea.field-input:focus,
.sheet-settings .sheet-body > select.field-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px color-mix(in srgb, #3b82f6 16%, transparent);
}

/* ================= v5 · Стартовый сайт (/) ================= */
body.site-body { margin: 0; font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
.lp-links a.landing-top-link { display: inline-flex; align-items: center; text-decoration: none; }
a.lp-login, a.lp-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.lp-foot a { text-decoration: none; }

/* ================= v5 · Обновления приложения ================= */
#desktopTbVersionWrap .desktop-tb-update-indicator.show,
#desktopTbVersionWrap .desktop-tb-info-btn:not(.hidden) {
  position: static;
  opacity: 1;
  transform: none;
}
#desktopTbVersionWrap.has-update {
  border-color: color-mix(in srgb, #22c55e 55%, transparent);
  background: color-mix(in srgb, #22c55e 12%, var(--bg-elevated));
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  animation: upd-pill-pulse 2.4s ease-out infinite;
  cursor: pointer;
}
#desktopTbVersionWrap.has-update .desktop-tb-ver { color: var(--text); }
#desktopTbVersionWrap .desktop-tb-update-indicator { cursor: pointer; }
#desktopTbVersionWrap .desktop-tb-update-indicator.show svg { animation: none; }
#desktopTbVersionWrap .desktop-tb-update-indicator.is-spinning svg { animation: upd-spin 1s linear infinite; }
#desktopTbVersionWrap .desktop-tb-update-indicator.is-ready svg { color: #3b82f6; }
#desktopTbVersionWrap .desktop-tb-info-btn {
  width: auto;
  height: 20px;
  padding: 0 8px 0 6px;
  gap: 4px;
  border: 0;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  font-size: 11px;
}
#desktopTbVersionWrap .desktop-tb-info-btn svg { width: 12px; height: 12px; }
#desktopTbVersionWrap .desktop-tb-info-btn::after { content: attr(data-label); font-weight: 750; }
#desktopTbVersionWrap .desktop-tb-info-btn:hover { background: #16a34a; }
@keyframes upd-pill-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@keyframes upd-spin { to { transform: rotate(360deg); } }

/* статус в «Истории версий» */
.desktop-ver-pop-upd {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  font-size: 12.5px;
}
.desktop-ver-pop-upd.is-new { background: color-mix(in srgb, #22c55e 12%, transparent); }
.desktop-ver-pop-upd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.desktop-ver-pop-upd.is-new .desktop-ver-pop-upd-dot { background: #22c55e; box-shadow: 0 0 0 4px color-mix(in srgb, #22c55e 25%, transparent); }
.desktop-ver-pop-upd-text { flex: 1; min-width: 0; font-weight: 600; }
.desktop-ver-pop-upd-btn { border: 0; border-radius: 999px; padding: 5px 11px; font: inherit; font-weight: 700; cursor: pointer; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.desktop-ver-pop-upd.is-new .desktop-ver-pop-upd-btn { background: #22c55e; color: #fff; }

/* окно обновления */
html body :is(#updateInfoSheet, #serverSheet).upd-modal {
  position: fixed !important;
  inset: auto !important;
  top: 50% !important;
  left: 50% !important;
  z-index: 9001 !important;
  width: min(440px, calc(100vw - 24px)) !important;
  max-width: none !important;
  height: auto !important;
  max-height: min(640px, calc(100dvh - 32px)) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column;
  border-radius: 26px !important;
  border: 1px solid color-mix(in srgb, var(--text) 9%, transparent) !important;
  background: var(--bg-elevated, var(--bg)) !important;
  box-shadow: 0 30px 80px -20px rgba(2, 6, 23, 0.45) !important;
  overflow: hidden !important;
  transform: translate(-50%, -50%) !important;
  opacity: 1 !important;
  animation: cr-modal-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
html body :is(#updateInfoSheet, #serverSheet).upd-modal.hidden { display: none !important; }
:is(#updateInfoSheet, #serverSheet) .cr-modal-head { position: relative; display: flex; align-items: center; justify-content: center; min-height: 58px; padding: 14px 56px 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
:is(#updateInfoSheet, #serverSheet) .cr-modal-head .sheet-title { font-size: 16px; font-weight: 700; color: var(--muted); }
:is(#updateInfoSheet, #serverSheet) .cr-modal-close { position: absolute; right: 14px; top: 12px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 12px; background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--muted); cursor: pointer; transition: background .18s, transform .18s; }
:is(#updateInfoSheet, #serverSheet) .cr-modal-close:hover { transform: rotate(90deg); color: var(--text); }
:is(#updateInfoSheet, #serverSheet) .upd { flex: 1 1 auto; min-height: 0; overflow-y: auto; max-height: none !important; padding: 4px 24px 22px !important; background: transparent !important; }
.upd-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 0 14px; }
.upd-ico { position: relative; width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, #3b82f6 18%, transparent), color-mix(in srgb, #8b5cf6 18%, transparent)); margin-bottom: 14px; }
.upd-hero.is-new .upd-ico { animation: upd-float 3s ease-in-out infinite; }
.upd-ico img { width: 56px; height: 56px; border-radius: 16px; }
.upd-ico-badge { position: absolute; right: -6px; bottom: -6px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #94a3b8; color: #fff; font-weight: 800; font-size: 15px; border: 3px solid var(--bg-elevated, var(--bg)); }
.upd-hero.is-new .upd-ico-badge { background: #22c55e; }
.upd-ico-badge.is-ready { background: #3b82f6 !important; }
@keyframes upd-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.upd-ver { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.upd-sub { margin-top: 4px; font-size: 14px; color: var(--muted); }
.upd-title { margin: 4px 0 8px; font-weight: 750; font-size: 15px; }
.upd-notes { list-style: none; margin: 0 0 12px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--text) 4%, transparent); display: grid; gap: 7px; }
.upd-notes li { position: relative; padding-left: 20px; font-size: 14px; line-height: 1.45; }
.upd-notes li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.upd-progress { height: 8px; border-radius: 99px; overflow: hidden; background: color-mix(in srgb, var(--text) 8%, transparent); margin: 6px 0 8px; }
.upd-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3b82f6, #8b5cf6); transition: width .35s ease; position: relative; overflow: hidden; }
.upd-progress i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: upd-shine 1.2s linear infinite; }
@keyframes upd-shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.upd-status { margin: 0 0 10px; text-align: center; font-size: 13px; color: var(--muted); }
.upd-status--err { color: #ef4444; }
.upd-actions { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.upd-btn { height: 46px; border: 0; border-radius: 14px; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); transition: transform .15s, filter .15s, opacity .15s; }
.upd-btn:active { transform: scale(0.98); }
.upd-btn:disabled { opacity: .7; cursor: default; }
.upd-btn--primary { color: #fff; background: linear-gradient(135deg, #3b82f6, #6366f1); box-shadow: 0 10px 24px -10px rgba(59, 130, 246, .7); }
.upd-btn--ghost { background: transparent; color: var(--muted); }
.upd-btn--small { height: 40px; padding: 0 14px; font-size: 14px; flex: none; }
.upd-adv { border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent); padding-top: 10px; }
.upd-adv summary { cursor: pointer; font-size: 13px; font-weight: 650; color: var(--muted); list-style: none; }
.upd-adv summary::-webkit-details-marker { display: none; }
.upd-adv summary::before { content: "⚙ "; }
.upd-hint { font-size: 12.5px; color: var(--muted); margin: 8px 0; line-height: 1.45; }
.upd-feed { display: flex; gap: 8px; }
.upd-input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--text) 12%, transparent); background: var(--rd-surface, var(--bg)); color: var(--text); font: inherit; font-size: 14px; outline: none; }
.upd-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 4px color-mix(in srgb, #3b82f6 16%, transparent); }
.desktop-changelog-item { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; }
.desktop-changelog-ver { font-weight: 800; font-size: 13px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, #3b82f6 14%, transparent); color: #3b82f6; justify-self: start; }
.desktop-changelog-date { font-size: 11.5px; color: var(--muted); }
.desktop-changelog-title { grid-column: 1 / -1; margin-top: 6px; font-weight: 700; font-size: 13px; }
.desktop-changelog-item ul { grid-column: 1 / -1; line-height: 1.5; }

/* ================= v5 · Регистрация в приложении для Windows ================= */
.auth-desktop-switch { margin-top: 12px; width: 100%; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; padding: 8px; border-radius: 10px; transition: background .18s, color .18s; }
.auth-desktop-switch b { color: #3b82f6; }
.auth-desktop-switch:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.auth-back-desktop { align-self: flex-start; margin: 0 0 10px; border: 0; background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.auth-back-desktop.hidden { display: none; }
html.auth-desktop-register #authMobilePanel { max-width: 440px; margin: 40px auto; }

/* 1.5.0: восстановление связи во время звонка */
.call-sheet.call-recovering .call-sheet-status {
  color: #fbbf24;
  animation: callRecoverPulse 1.2s ease-in-out infinite;
}
.call-sheet.call-recovering .call-peer-ava {
  filter: saturate(.4);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, .35);
}
@keyframes callRecoverPulse { 50% { opacity: .45; } }

/* 1.5.0: подключение к серверу (Windows) */
.srv-ico .upd-ico-badge.srv-badge { width: 32px; height: 32px; font-size: 15px; background: #64748b; }
.srv-ico .upd-ico-badge.srv-badge.is-remote { background: linear-gradient(135deg, #22c55e, #10b981); }
.srv-ver { font-size: 21px; }
.srv-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 12px; }
.srv-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border-radius: 16px; border: 1.5px solid color-mix(in srgb, var(--text) 10%, transparent); background: color-mix(in srgb, var(--text) 3%, transparent); color: var(--text); font: inherit; cursor: pointer; transition: border-color .18s, background .18s, transform .15s, box-shadow .2s; }
.srv-opt:hover { border-color: color-mix(in srgb, #3b82f6 45%, transparent); }
.srv-opt:active { transform: scale(.98); }
.srv-opt.is-on { border-color: #3b82f6; background: color-mix(in srgb, #3b82f6 10%, transparent); box-shadow: 0 10px 26px -16px rgba(59, 130, 246, .9); }
.srv-opt-ico { font-size: 22px; line-height: 1; }
.srv-opt-t { font-weight: 750; font-size: 14.5px; }
.srv-opt-d { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.srv-msg { margin-top: 10px; }
.srv-msg--ok { color: #22c55e; }
.srv-foot { text-align: center; margin-top: 0; }
.auth-desktop-server { display: inline-flex; align-items: center; gap: 8px; align-self: center; margin-top: 10px; padding: 6px 12px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--text) 10%, transparent); background: color-mix(in srgb, var(--text) 4%, transparent); color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; transition: background .15s, color .15s; }
.auth-desktop-server:hover { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.auth-desktop-server b { color: #3b82f6; font-weight: 700; }
.auth-desktop-server.hidden { display: none; }
.auth-srv-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.auth-desktop-server.is-remote .auth-srv-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
#devicesServerBlock .btn { margin-bottom: 8px; }

/* 1.5.1: QR всегда чёрный на белом с полем — читается любой камерой */
.auth-desktop-qr-frame { background: #fff !important; padding: 10px !important; box-shadow: 0 10px 30px -18px rgba(15, 23, 42, .45); }
#authDesktopQrImg, .privacy-qr-img { image-rendering: pixelated; background: #fff; }
.privacy-qr-stage { background: #fff !important; }
.privacy-qr-logo { width: 46px !important; height: 46px !important; }

/* 1.5.1: карточка «Документация» на главной — раньше была без стилей (синяя ссылка на тёмном фоне) */
.lp-docs-card { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 20px 22px; border-radius: 24px; background: var(--rd-surface); border: 1px solid var(--rd-border); color: var(--text); text-decoration: none; transition: transform .25s var(--rd-spring, ease), border-color .2s, box-shadow .25s; }
.lp-docs-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, #6366f1 45%, transparent); box-shadow: 0 22px 50px -28px rgba(99, 102, 241, .8); }
.lp-docs-card .lp-ico { flex: none; }
.lp-docs-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lp-docs-txt b { font-size: 18px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.lp-docs-txt small { font-size: 14px; line-height: 1.5; color: var(--muted); }
.lp-docs-go { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; color: #fff; background: linear-gradient(135deg, #0ea5e9, #6366f1); transition: transform .2s; }
.lp-docs-card:hover .lp-docs-go { transform: translateX(3px); }
@media (max-width: 640px) { .lp-docs-card { gap: 14px; padding: 16px; } .lp-docs-go { display: none; } }
.lp-foot { flex-wrap: wrap; justify-content: center; row-gap: 8px; }
.lp-foot span { white-space: nowrap; }

/* 1.8.1: статус ИИ в админке */
.admin-ai-card { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
.admin-ai-card:empty { display: none; }
.admin-ai-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.admin-ai-dot { flex: 0 0 auto; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: #9ca3af; }
.admin-ai-row--ok .admin-ai-dot { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 22%, transparent); }
.admin-ai-row--warn .admin-ai-dot { background: #f59e0b; }
.admin-ai-row--bad .admin-ai-dot { background: #ef4444; }
.admin-ai-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; line-height: 1.35; }
.admin-ai-text b { font-size: 13.5px; }
.admin-ai-text span { color: var(--text); opacity: .85; overflow-wrap: anywhere; }
.admin-ai-text small { color: var(--muted); font-size: 12px; }
