:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #0d1828;
  --panel-2: #091422;
  --surface: #12233a;
  --text: #e8f1ff;
  --muted: #93a7c0;
  --line: #223650;
  --soft: #172a43;
  --soft-hover: #203854;
  --accent: #3b82f6;
  --accent-rgb: 59, 130, 246;
  --accent-strong: #2563eb;
  --accent-soft: #102a50;
  --accent-line: #2f67c8;
  --chat-active-bg: rgba(var(--accent-rgb), 0.2);
  --chat-hover-bg: rgba(var(--accent-rgb), 0.12);
  --chat-active-border: var(--accent-line);
  --search-button-bg: var(--accent);
  --sidebar-muted-button: rgba(var(--accent-rgb), 0.15);
  --sidebar-muted-button-hover: rgba(var(--accent-rgb), 0.22);
  --message-scale: 1;
  --warm: #a78bfa;
  --warm-soft: rgba(167, 139, 250, 0.16);
  --out-bubble: linear-gradient(135deg, #4f46e5 0%, #6d28d9 48%, #9d2f7f 100%);
  --out-bubble-shadow: rgba(109, 40, 217, 0.18);
  --theme-background: url("theme-backgrounds/violet-pink.webp");
  --online: #34d399;
  --warning: #f59e0b;
  --danger: #fb7185;
  --scroll: #2b4563;
  --scroll-hover: #3a5d82;
  --scroll-size: 5px;
  --scroll-thumb: rgba(147, 167, 192, 0.28);
  --scroll-thumb-hover: rgba(147, 167, 192, 0.5);
  --link: #60a5fa;
  --link-hover: #93c5fd;
}

:root[data-chat-theme="violet-pink"] {
  --accent: #a855f7;
  --accent-rgb: 168, 85, 247;
  --accent-strong: #9333ea;
  --accent-soft: #2e174f;
  --accent-line: #c084fc;
  --chat-active-bg: #7c3aed33;
  --chat-hover-bg: #7c3aed1f;
  --chat-active-border: #a855f7;
  --search-button-bg: #a855f7;
  --sidebar-muted-button: #7c3aed26;
  --sidebar-muted-button-hover: #7c3aed33;
  --warm: #f472b6;
  --warm-soft: rgba(244, 114, 182, 0.16);
  --link: #c084fc;
  --link-hover: #f0abfc;
  --soft: #251a3a;
  --soft-hover: #352252;
  --out-bubble: linear-gradient(135deg, #4f46e5 0%, #6d28d9 48%, #9d2f7f 100%);
  --out-bubble-shadow: rgba(109, 40, 217, 0.18);
  --theme-background: url("theme-backgrounds/violet-pink.webp");
}

:root[data-chat-theme="blue-cyan"] {
  --accent: #2563eb;
  --accent-rgb: 37, 99, 235;
  --accent-strong: #1d4ed8;
  --accent-soft: #0b2c57;
  --accent-line: #38bdf8;
  --chat-active-bg: #2563eb33;
  --chat-hover-bg: #2563eb1f;
  --chat-active-border: #0ea5e9;
  --search-button-bg: #2563eb;
  --sidebar-muted-button: #2563eb26;
  --sidebar-muted-button-hover: #2563eb33;
  --warm: #22d3ee;
  --warm-soft: rgba(34, 211, 238, 0.15);
  --link: #38bdf8;
  --link-hover: #7dd3fc;
  --soft: #10233f;
  --soft-hover: #17365d;
  --out-bubble: linear-gradient(135deg, #1d4ed8 0%, #0f7ea8 48%, #1ba6b8 100%);
  --out-bubble-shadow: rgba(15, 126, 168, 0.18);
  --theme-background: url("theme-backgrounds/blue-winter.webp");
}

:root[data-chat-theme="green-moss"] {
  --accent: #16a34a;
  --accent-rgb: 22, 163, 74;
  --accent-strong: #15803d;
  --accent-soft: #102f21;
  --accent-line: #65a30d;
  --chat-active-bg: #15803d33;
  --chat-hover-bg: #15803d1f;
  --chat-active-border: #4d7c0f;
  --search-button-bg: #15803d;
  --sidebar-muted-button: #15803d26;
  --sidebar-muted-button-hover: #15803d33;
  --warm: #84cc16;
  --warm-soft: rgba(132, 204, 22, 0.15);
  --link: #86efac;
  --link-hover: #bbf7d0;
  --soft: #142a22;
  --soft-hover: #1e3b2b;
  --out-bubble: linear-gradient(135deg, #14532d 0%, #3f6212 52%, #5f8f12 100%);
  --out-bubble-shadow: rgba(63, 98, 18, 0.16);
  --theme-background: url("theme-backgrounds/green-moss.webp");
}

:root[data-chat-theme="blue-violet"] {
  --accent: #4f46e5;
  --accent-rgb: 79, 70, 229;
  --accent-strong: #4338ca;
  --accent-soft: #191b4f;
  --accent-line: #818cf8;
  --chat-active-bg: #2563eb33;
  --chat-hover-bg: #2563eb1f;
  --chat-active-border: #4f46e5;
  --search-button-bg: #2563eb;
  --sidebar-muted-button: #4f46e526;
  --sidebar-muted-button-hover: #4f46e533;
  --warm: #8b5cf6;
  --warm-soft: rgba(139, 92, 246, 0.16);
  --link: #93c5fd;
  --link-hover: #c4b5fd;
  --soft: #171d42;
  --soft-hover: #25265f;
  --out-bubble: linear-gradient(135deg, #1e40af 0%, #3730a3 48%, #581c87 100%);
  --out-bubble-shadow: rgba(55, 48, 163, 0.18);
  --theme-background: url("theme-backgrounds/violet-blue.webp");
}

:root[data-chat-theme="orange-yellow"] {
  --accent: #d97706;
  --accent-rgb: 249, 115, 22;
  --accent-strong: #b45309;
  --accent-soft: #3a2411;
  --accent-line: #d6a33f;
  --chat-active-bg: #c7661d33;
  --chat-hover-bg: #c7661d1f;
  --chat-active-border: #d9922e;
  --search-button-bg: #c7661d;
  --sidebar-muted-button: #c7661d26;
  --sidebar-muted-button-hover: #c7661d33;
  --warm: #eab65b;
  --warm-soft: rgba(234, 182, 91, 0.14);
  --link: #f0c674;
  --link-hover: #f8d99b;
  --soft: #2c2118;
  --soft-hover: #3e2c1b;
  --out-bubble: linear-gradient(135deg, #92400e 0%, #b45309 52%, #ca8a04 100%);
  --out-bubble-shadow: rgba(180, 83, 9, 0.14);
  --theme-background: url("theme-backgrounds/orange-yellow.webp");
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

body,
button,
input,
textarea,
select,
.messenger,
.sidebar,
.chat,
.chat::before,
.chat::after,
.chatHeader,
.composer,
.composerNotice,
.chatItem,
.chatItem::before,
.searchForm button,
.sidebarActions .secondary,
.settingsButton,
.bubble::before,
.bubble::after,
.messageReaction,
.settingsThemePreset,
.voicePlayButton,
.voiceWaveform span,
.readReceipt,
.profileTab,
.peerSharedTab,
.settingsRow,
.settingsAccordion,
.settingsAccordionButton,
.settingsActionButton {
  transition:
    background 0.3s ease,
    background-color 0.3s ease,
    background-image 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    color 0.3s ease,
    filter 0.3s ease;
}

*::-webkit-scrollbar {
  width: var(--scroll-size);
  height: var(--scroll-size);
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.42), var(--scroll-thumb));
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.58), var(--scroll-thumb-hover));
}

.settingsDetailBody,
.settingsAccordionPanel > div,
.composer textarea {
  scrollbar-color: rgba(147, 167, 192, 0.24) transparent;
}

.settingsDetailBody::-webkit-scrollbar,
.settingsAccordionPanel > div::-webkit-scrollbar,
.composer textarea::-webkit-scrollbar {
  width: 4px;
}

.settingsDetailBody::-webkit-scrollbar-thumb,
.settingsAccordionPanel > div::-webkit-scrollbar-thumb,
.composer textarea::-webkit-scrollbar-thumb {
  background: rgba(147, 167, 192, 0.26);
}

.settingsDetailBody::-webkit-scrollbar-thumb:hover,
.settingsAccordionPanel > div::-webkit-scrollbar-thumb:hover,
.composer textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(147, 167, 192, 0.44);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: var(--soft);
  color: var(--text);
}

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 0;
}

.loading,
.auth {
  width: min(calc(100% - 48px), 1120px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}

.loading {
  max-width: 420px;
  min-height: 260px;
  padding: 32px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.loading h1,
.loading p {
  margin: 0;
}

.loader {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid var(--soft);
  border-top-color: var(--accent);
  border-right-color: var(--warm);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.auth {
  max-width: 460px;
  padding: 28px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 30px;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

p {
  color: var(--muted);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 22px 0;
}

.tab {
  background: var(--soft);
  color: var(--text);
}

.tab.active {
  background: var(--accent);
  color: white;
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  resize: none;
  padding: 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

.hidden {
  display: none !important;
}

.messenger {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: 330px 1fr;
  background: var(--panel);
  overflow: hidden;
}

.chat::before,
.chat::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chat::before {
  z-index: 0;
  background-image: var(--theme-background);
  background-color: var(--bg);
  background-size: var(--chat-bg-size) var(--chat-bg-size);
  background-repeat: no-repeat;
  background-position: center;
  filter: saturate(0.82) brightness(0.68);
}

.chat::after {
  z-index: 1;
  background:
    radial-gradient(circle at 72% 18%, rgba(var(--accent-rgb), 0.16), transparent 34%),
    linear-gradient(135deg, rgba(3, 8, 15, 0.72), rgba(3, 8, 15, 0.58) 48%, rgba(3, 8, 15, 0.78));
}

.chat > * {
  position: relative;
  z-index: 2;
}

.sidebar {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  background: var(--panel-2);
}

.me {
  width: 100%;
  min-height: 74px;
  padding: 8px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  text-align: left;
}

.me:hover {
  background: rgba(var(--accent-rgb), 0.1);
}

.me h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

.me p {
  margin-bottom: 0;
}

.avatarButton {
  position: relative;
  width: 58px;
  height: 58px;
  min-height: 58px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  display: inline-grid;
  place-items: center;
}

.avatarButton:hover {
  background: transparent;
}

.profileSidebarStatusDot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 15px;
  height: 15px;
  border: 3px solid var(--panel-2);
  border-radius: 50%;
  background: var(--online);
}

.profileSidebarStatusDot.dnd {
  background: var(--warning);
}

.avatar {
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.avatar.avatarRounded {
  border-radius: 18px;
}

.avatarLarge {
  width: 58px;
  height: 58px;
}

.avatarSmall {
  width: 38px;
  height: 38px;
  grid-row: 1 / span 2;
}

.avatarWrap {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: max-content;
  height: max-content;
  grid-row: 1 / span 2;
}

.avatarWrap .avatarSmall {
  grid-row: auto;
}

.messageReaction .avatarWrap,
.profilePreset .avatarWrap {
  grid-row: auto;
}

.avatarStatusDot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--panel-2);
}

.avatarHeader {
  width: 46px;
  height: 46px;
}

.chatHeader .avatarWrap {
  grid-row: auto;
}

.chatHeader .avatarStatusDot {
  width: 14px;
  height: 14px;
  border-color: var(--panel);
}

.gradientGrid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.gradientChoice {
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line);
}

.gradientChoice.active {
  box-shadow:
    0 0 0 2px var(--accent),
    0 0 0 5px rgba(var(--accent-rgb), 0.2);
}

.photoPicker {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
}

.photoPicker input {
  display: none;
}

.searchForm {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.searchForm button {
  background: var(--search-button-bg);
}

.searchForm button:hover {
  background: var(--accent-strong);
}

.searchResult {
  margin-top: 10px;
}

.searchResult.isAppearing {
  animation: softPanelIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.searchResult.isHiding {
  animation: softPanelOut 0.17s ease-in both;
}

.foundUser,
.chatItem {
  width: 100%;
  min-height: 62px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 3px;
  align-items: center;
  justify-items: start;
  text-align: left;
}

.foundUser:hover {
  background: var(--accent-soft);
}

.chatItem {
  position: relative;
  grid-template-columns: auto minmax(0, 1fr) auto;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  min-height: calc(62px * var(--message-scale));
  padding-left: calc(18px * var(--message-scale));
  padding-right: calc(18px * var(--message-scale));
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

.chatItem:hover {
  background: var(--chat-hover-bg);
}

.chatItem.active {
  background: var(--chat-active-bg);
}

.chatItem::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: var(--chat-active-border);
  opacity: 0;
  transform: translateX(-4px);
  transition: background 0.3s ease, opacity 0.3s ease, transform 0.18s ease;
}

.chatItem.active::before {
  opacity: 1;
  transform: translateX(0);
}

.chatItem strong {
  grid-column: 2;
  color: var(--text);
  font-size: calc(15px * var(--message-scale));
}

.chatItem.active strong {
  color: white;
}

.foundUser span,
.chatPreviewText {
  max-width: 100%;
  color: var(--muted);
  font-size: calc(13px * var(--message-scale));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chatItem.active .chatPreviewText {
  color: var(--muted);
}

.chatPinnedIcon {
  position: absolute;
  top: 9px;
  right: 12px;
  z-index: 2;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--link);
  font-size: 10px;
  pointer-events: none;
}

.chatPreviewLine {
  grid-column: 2;
  max-width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.chatUnreadBadge {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.chatList {
  margin-left: -18px;
  margin-right: -18px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 0;
}

.chatList:has(.emptyList) {
  align-content: center;
}

.sidebarActions {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
}

.sidebarActions .secondary {
  background: var(--sidebar-muted-button);
  color: var(--muted);
}

.sidebarActions .secondary:hover {
  background: var(--sidebar-muted-button-hover);
  color: var(--text);
}

.settingsButton {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sidebar-muted-button);
  color: var(--muted);
}

.settingsButton:hover {
  background: var(--sidebar-muted-button-hover);
  color: var(--text);
}

.emptyList {
  margin: 0;
  padding: 24px 28px;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.emptyList span {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--link);
  font-size: 20px;
}

.emptyList strong {
  color: var(--text);
  font-size: 15px;
}

.emptyList p {
  max-width: 220px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.chat {
  position: relative;
  min-width: 0;
  min-height: 0;
  --chat-header-height: 78px;
  --chat-overlays-height: 0px;
  --pinned-panel-height: 58px;
  --chat-bg-min-size: 1040px;
  --chat-bg-size: max(100%, var(--chat-bg-min-size));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: transparent;
  overflow: hidden;
}

.chatHeader {
  min-height: 78px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(9, 20, 34, 0.68);
}

.chatHeaderIdentity {
  min-width: 0;
  flex: 1;
  display: flex;
  gap: 12px;
  align-items: center;
}

.chatHeaderIdentity > div {
  min-width: 0;
}

.chatHeader.clickable {
  cursor: pointer;
}

.chatHeader h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 22px;
}

.chatHeader p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0;
}

.chatHeaderSearchButton {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(var(--accent-rgb), 0.15);
  color: rgba(255, 255, 255, 0.9);
  transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.chatHeaderSearchButton:hover,
.chatHeaderSearchButton.active {
  background: rgba(var(--accent-rgb), 0.24);
  color: white;
}

.chatHeaderSearchButton:active {
  transform: scale(0.96);
}

.pinnedPanel {
  position: absolute;
  top: var(--chat-header-height);
  left: 0;
  right: 0;
  z-index: 12;
  min-height: 58px;
  padding: 8px 22px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  border-top: 0;
  display: grid;
  grid-template-columns: 3px 34px minmax(0, 1fr) 34px;
  gap: 11px;
  align-items: center;
  background: rgba(9, 20, 34, 0.68);
  color: var(--text);
  text-align: left;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  cursor: pointer;
}

.pinnedPanel:hover {
  background: rgba(9, 20, 34, 0.78);
}

.pinnedPanel.pinAppearing {
  animation: pinnedPanelDrop 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.selectionPanel {
  position: absolute;
  top: var(--chat-header-height);
  left: 0;
  right: 0;
  z-index: 13;
  min-height: 50px;
  padding: 8px 22px;
  border-bottom: 1px solid rgba(34, 54, 80, 0.72);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(90deg, rgba(13, 24, 40, 0.98), rgba(18, 35, 58, 0.98));
  color: var(--text);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
}

.selectionPanel.isAppearing {
  animation: selectionPanelIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.selectionPanel.isHiding {
  animation: selectionPanelOut 0.18s ease-in both;
}

.selectionPanel.afterPinned {
  top: calc(var(--chat-header-height) + var(--pinned-panel-height));
}

.selectionPanelText {
  font-size: 14px;
  font-weight: 700;
}

.selectionPanelActions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.selectionPanelActions button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--text);
}

.selectionPanelActions button:hover {
  background: rgba(var(--accent-rgb), 0.24);
}

.selectionDeleteButton {
  color: #fecdd3 !important;
}

@keyframes pinnedPanelDrop {
  from {
    opacity: 0;
    transform: translateY(-18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes selectionPanelIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes selectionPanelOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.pinnedStripe {
  width: 3px;
  height: 36px;
  display: grid;
  gap: 4px;
  align-content: stretch;
}

.pinnedStripe i {
  min-height: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--warm));
}

.pinnedStripe.animateSegments i {
  animation: pinnedStripeIn 0.28s ease-out both;
}

.pinnedStripe.animateSegments i:nth-child(2) {
  animation-delay: 0.04s;
}

.pinnedStripe.animateSegments i:nth-child(3) {
  animation-delay: 0.08s;
}

.pinnedStripe.animateSegments i:nth-child(4) {
  animation-delay: 0.12s;
}

@keyframes pinnedStripeIn {
  from {
    opacity: 0;
    transform: scaleY(0.35);
  }

  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

.pinnedIcon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--link);
  font-size: 14px;
}

.pinnedText {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.pinnedText strong,
.pinnedText span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinnedText strong {
  color: var(--link);
  font-size: 13px;
  line-height: 1.1;
}

.pinnedText span {
  color: white;
  font-size: 14px;
  line-height: 1.2;
}

.pinnedText span.muted {
  color: var(--muted);
}

.pinnedListButton,
.pinnedClose {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
}

.pinnedListButton:hover,
.pinnedClose:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.pinnedListPanel {
  position: absolute;
  inset: 0;
  z-index: 32;
  background: rgba(7, 17, 31, 0.76);
  backdrop-filter: blur(14px);
  display: grid;
  animation: modalBackdropIn 0.18s ease-out;
  opacity: 1;
  transition: opacity 0.22s ease, backdrop-filter 0.22s ease;
}

.pinnedListPanel.closing {
  opacity: 0;
  backdrop-filter: blur(0);
}

.pinnedListSheet {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: linear-gradient(180deg, rgba(13, 24, 40, 0.98), rgba(9, 20, 34, 0.98));
  transform: translateY(0);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.pinnedListPanel.closing .pinnedListSheet {
  transform: translateY(10px);
}

.pinnedListHeader {
  min-height: 78px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pinnedListHeader h2,
.pinnedListHeader p {
  margin: 0;
}

.pinnedListHeader h2 {
  font-size: 22px;
}

.pinnedListHeader p {
  color: var(--muted);
  font-size: 14px;
}

.pinnedListHeader button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--text);
}

.pinnedList {
  min-height: 0;
  padding: 18px 22px 28px;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
}

.pinnedListItem {
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto 32px;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  text-align: left;
}

.pinnedListItem:hover {
  background: rgba(255, 255, 255, 0.085);
}

.pinnedListIcon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--link);
}

.pinnedListText {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.pinnedListText strong,
.pinnedListText span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinnedListText strong {
  font-size: 14px;
}

.pinnedListText span {
  color: white;
  font-size: 14px;
}

.pinnedListText span.muted,
.pinnedListItem time {
  color: var(--muted);
}

.pinnedListItem time {
  font-size: 12px;
}

.pinnedListRemove {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.pinnedListRemove:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.emptyPinnedList {
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
}

.presenceOnline {
  color: var(--online);
  font-weight: 600;
}

.messages {
  min-height: 0;
  padding: calc(20px + var(--chat-overlays-height)) 22px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overscroll-behavior: contain;
  background: transparent;
  transition: padding-top 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.emptyChatState {
  margin: auto;
  max-width: 360px;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.emptyChatState i {
  font-size: 46px;
  color: var(--warm);
}

.emptyChatState h2,
.emptyChatState p {
  margin: 0;
}

.messageGroup {
  max-width: min(700px, 84%);
  display: grid;
  gap: 6px;
  justify-items: start;
}

.messageGroup.out {
  align-self: flex-end;
  justify-items: end;
}

.messageGroup.in {
  align-self: flex-start;
}

.messageAuthor {
  color: var(--muted);
  font-size: 13px;
  padding: 0 2px;
}

.messageGroup.out .messageAuthor {
  text-align: right;
}

.bubble {
  --bubble-bg: linear-gradient(135deg, #172333 0%, #132031 55%, #18283a 100%);
  position: relative;
  isolation: isolate;
  overflow: visible;
  width: fit-content;
  max-width: 100%;
  display: inline-grid;
  grid-template-columns: minmax(0, auto) auto;
  gap: calc(12px * var(--message-scale));
  align-items: end;
  padding: calc(10px * var(--message-scale)) calc(13px * var(--message-scale));
  border-radius: 14px 14px 14px 5px;
  border: 0;
  background: transparent;
  box-shadow: none;
  transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

.bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--bubble-bg);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

.bubble::after {
  content: "";
  position: absolute;
  z-index: -2;
  bottom: 0;
  width: 28px;
  height: 20px;
  background: var(--bubble-bg);
  background-size: calc(100% + 28px) 100%;
  pointer-events: none;
}

.bubble > * {
  position: relative;
  z-index: 1;
}

.messageGroup.in .bubble::after {
  left: -13px;
  background-position: left bottom;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 18'%3E%3Cpath d='M22 0C18.6 8.8 11.3 15.2 0 18H22V0Z' fill='black'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 18'%3E%3Cpath d='M22 0C18.6 8.8 11.3 15.2 0 18H22V0Z' fill='black'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.messageGroup.out .bubble::after {
  right: -13px;
  background-position: right bottom;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 18'%3E%3Cpath d='M0 0C3.4 8.8 10.7 15.2 22 18H0V0Z' fill='black'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 18'%3E%3Cpath d='M0 0C3.4 8.8 10.7 15.2 22 18H0V0Z' fill='black'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.replyInMessage {
  grid-column: 1 / -1;
  min-width: 180px;
  padding: 7px 9px;
  border-left: 3px solid rgba(var(--accent-rgb), 0.72);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  display: grid;
  gap: 2px;
}

.replyInMessage strong,
.replyInMessage span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replyInMessage strong {
  color: var(--link);
  font-size: 13px;
}

.replyInMessage span {
  color: var(--muted);
  font-size: 13px;
}

.messageGroup.out .replyInMessage {
  border-left-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.12);
}

.messageGroup.out .replyInMessage strong,
.messageGroup.out .replyInMessage span {
  color: rgba(255, 255, 255, 0.82);
}

.bubble.deleting {
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  filter: blur(2px);
  pointer-events: none;
}

.bubble.pinnedTarget {
  position: relative;
  isolation: isolate;
}

.bubble.pinnedTarget::before {
  animation: pinnedHighlight 1s ease-out;
}

.bubble.searchTarget::before {
  background: linear-gradient(135deg, rgba(244, 202, 71, 0.82), rgba(196, 139, 20, 0.76));
  box-shadow: 0 0 0 2px rgba(255, 220, 100, 0.48), 0 10px 24px rgba(206, 158, 30, 0.26);
}

.bubble.searchTarget::after {
  background: linear-gradient(135deg, rgba(244, 202, 71, 0.82), rgba(196, 139, 20, 0.76));
}

.bubble.searchTarget:has(.imageMessage)::before {
  display: block;
  z-index: 2;
  inset: -2px;
  background: transparent;
  box-shadow: 0 0 0 2px rgba(255, 220, 100, 0.82), 0 10px 24px rgba(206, 158, 30, 0.3);
  pointer-events: none;
}

.bubble.selectable {
  cursor: pointer;
}

.bubble.selected {
  filter: brightness(1.08);
}

.bubble.selected::before {
  box-shadow:
    0 0 0 2px rgba(var(--accent-rgb), 0.48),
    0 10px 24px rgba(var(--accent-rgb), 0.18);
}

.messageSelectToggle {
  position: absolute;
  left: -30px;
  top: 50%;
  z-index: 6;
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(232, 241, 255, 0.72);
  display: grid;
  place-items: center;
  background: rgba(9, 20, 34, 0.82);
  color: white;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
  transform: translateY(-50%);
}

.messageGroup.in .messageSelectToggle {
  left: auto;
  right: -30px;
}

.messageSelectToggle.checked {
  border-color: var(--accent);
  background: var(--accent);
}

.messageSelectToggle i {
  font-size: 11px;
}

.pinSystemMessage {
  align-self: center;
  max-width: min(78%, 520px);
  min-height: 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  background: rgba(18, 35, 58, 0.82);
  color: rgba(232, 241, 255, 0.8);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.pinSystemMessage:hover {
  background: rgba(18, 35, 58, 0.82);
  transform: none;
}

.pinSystemMessage span {
  color: var(--link);
  font-size: 12px;
}

.pinSystemMessage p {
  margin: 0;
  min-width: 0;
  color: inherit;
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinSystemMessage strong {
  color: white;
  font-weight: 650;
}

.pinSystemMessage em {
  color: var(--muted);
  font-style: normal;
}

@keyframes pinnedHighlight {
  0%,
  100% {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  }

  22%,
  68% {
    box-shadow:
      0 0 0 3px rgba(var(--accent-rgb), 0.34),
      0 12px 28px rgba(var(--accent-rgb), 0.18);
  }
}

@keyframes pinnedWideHighlight {
  0%,
  100% {
    background: rgba(255, 255, 255, 0);
  }

  18%,
  72% {
    background: rgba(255, 255, 255, 0.11);
  }
}

.messageGroup.out .bubble {
  --bubble-bg: var(--out-bubble);
  border-radius: 14px 14px 5px 14px;
}

.messageGroup.out .bubble::before {
  box-shadow: 0 8px 20px var(--out-bubble-shadow);
}

.messageGroup.out .messageContent,
.messageGroup.out .messageTime {
  color: white;
}

.messageContent {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-width: 0;
  font-size: calc(15px * var(--message-scale));
  line-height: 1.35;
}

.voiceMessage {
  min-width: min(calc(410px * var(--message-scale)), 62vw);
  display: grid;
  grid-template-columns: calc(58px * var(--message-scale)) minmax(calc(170px * var(--message-scale)), 1fr);
  gap: calc(14px * var(--message-scale));
  align-items: center;
  white-space: normal;
}

.bubble:has(.voiceMessage),
.bubble:has(.fileMessage) {
  grid-template-columns: minmax(0, 1fr) auto;
}

.bubble:has(.imageMessage) {
  padding: 0;
  gap: 0;
  display: block;
  background: transparent;
}

.bubble:has(.imageMessage)::before {
  display: none;
}

.bubble:has(.imageMessage)::after {
  z-index: 0;
  background: var(--bubble-bg);
}

.messageReactions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
  transform-origin: top center;
  overflow: hidden;
}

.messageReactions.new {
  animation: reactionsBlockDrop 0.34s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.messageReactions.removing {
  animation: reactionsBlockCollapse 0.32s cubic-bezier(0.7, 0, 0.84, 0) both;
}

.bubble:has(.messageReactions):not(:has(.imageMessage)) {
  row-gap: 6px;
}

.bubble:has(.messageReactions):not(:has(.imageMessage)) .messageTime {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  justify-self: end;
}

.bubble:has(.messageReactions):not(:has(.imageMessage)) .messageReactions {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  margin-top: 0;
}

.messageReaction {
  min-height: 25px;
  padding: 3px 4px 3px 8px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.messageReaction:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 10px 22px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px) scale(1.03);
}

.messageReaction:disabled {
  cursor: default;
  opacity: 1;
}

.messageReaction.removing {
  pointer-events: none;
  animation: reactionChipRemove 0.24s ease-in both;
}

.reactionEmoji {
  display: inline-block;
  font-size: 15px;
  line-height: 1;
  transform-origin: 50% 80%;
}

.messageReaction.new .reactionEmoji {
  animation: reactionIconPopSwing 0.78s cubic-bezier(0.18, 1.2, 0.28, 1) 0.16s both;
}

.messageReaction.removing .reactionEmoji {
  animation: reactionIconRemove 0.22s ease-in both;
}

.reactionAvatar {
  width: 19px;
  height: 19px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.22);
}

@keyframes reactionIconPopSwing {
  0% {
    opacity: 0;
    transform: scale(0.35) translateY(5px);
  }
  45% {
    opacity: 1;
    transform: scale(1.18) translateY(-2px);
  }
  68% {
    transform: scale(0.96) translateY(1px);
  }
  86% {
    transform: scale(1.04) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes reactionsBlockDrop {
  0% {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    transform: translateY(-8px) scaleY(0.72);
  }
  70% {
    max-height: 36px;
    margin-top: 2px;
  }
  100% {
    opacity: 1;
    max-height: 72px;
    margin-top: 2px;
    transform: translateY(0) scaleY(1);
  }
}

@keyframes reactionsBlockCollapse {
  0% {
    opacity: 1;
    max-height: 72px;
    margin-top: 2px;
    transform: translateY(0) scaleY(1);
  }
  100% {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    transform: translateY(-6px) scaleY(0.72);
  }
}

@keyframes reactionChipRemove {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.82) translateY(-3px);
  }
}

@keyframes reactionIconRemove {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.35) translateY(-4px);
  }
}

.voicePlayButton {
  width: calc(58px * var(--message-scale));
  height: calc(58px * var(--message-scale));
  min-height: calc(58px * var(--message-scale));
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-size: calc(22px * var(--message-scale));
  box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.2);
}

.voicePlayButton:hover {
  background: var(--accent-strong);
}

.voicePlayButton i {
  transform: translateX(2px);
}

.voiceMessage.playing .voicePlayButton i {
  transform: none;
}

.voiceBody {
  min-width: 0;
  display: grid;
  gap: calc(7px * var(--message-scale));
}

.voiceWaveform {
  height: calc(32px * var(--message-scale));
  display: flex;
  align-items: center;
  gap: calc(2px * var(--message-scale));
  overflow: hidden;
}

.voiceWaveform span {
  width: calc(3px * var(--message-scale));
  flex: 0 0 calc(3px * var(--message-scale));
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.42);
  transition: background 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.messageGroup.out .voicePlayButton {
  background: rgba(255, 255, 255, 0.18);
}

.messageGroup.out .voicePlayButton:hover {
  background: rgba(255, 255, 255, 0.24);
}

.messageGroup.out .voiceWaveform span {
  background: rgba(148, 163, 184, 0.42);
}

.voiceMessage.playing .voiceWaveform span {
  background: rgba(148, 163, 184, 0.42);
}

.voiceMessage.playing .voiceWaveform span.played,
.messageGroup.out .voiceMessage.playing .voiceWaveform span.played {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.18);
}

.voiceInfo {
  color: var(--muted);
  font-size: calc(16px * var(--message-scale));
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
}

.messageGroup.out .voiceInfo {
  color: rgba(255, 255, 255, 0.68);
}

.voiceUnlistenedDot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.14),
    0 0 8px rgba(255, 255, 255, 0.28);
  flex: 0 0 auto;
}

.voiceMessage audio {
  display: none;
}

.fileMessage {
  min-width: min(calc(360px * var(--message-scale)), 58vw);
  display: grid;
  grid-template-columns: calc(42px * var(--message-scale)) minmax(0, 1fr) calc(38px * var(--message-scale));
  gap: calc(12px * var(--message-scale));
  align-items: center;
  white-space: normal;
  cursor: pointer;
}

.fileMessage:hover .fileIcon,
.fileMessage:hover .fileDownloadButton {
  background: rgba(255, 255, 255, 0.14);
}

.fileIcon,
.fileDownloadButton {
  width: calc(38px * var(--message-scale));
  height: calc(38px * var(--message-scale));
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.fileIcon {
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--link);
}

.fileDetails {
  min-width: 0;
  display: grid;
  gap: calc(3px * var(--message-scale));
}

.fileDetails strong,
.fileDetails span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fileDetails span {
  color: var(--muted);
  font-size: 13px;
}

.fileDownloadButton {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.fileDownloadButton:hover {
  background: rgba(255, 255, 255, 0.14);
}

.messageGroup.out .fileIcon,
.messageGroup.out .fileDownloadButton {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.messageGroup.out .fileDetails span {
  color: rgba(255, 255, 255, 0.68);
}

.fileCaption {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 2px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.messageGroup.out .fileCaption {
  color: rgba(255, 255, 255, 0.9);
}

.imageMessage {
  width: min(360px, 64vw);
  white-space: normal;
}

.imagePreviewButton {
  position: relative;
  z-index: 1;
  isolation: isolate;
  width: 100%;
  min-height: 220px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    var(--bubble-bg) border-box;
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.imagePreviewButton:hover,
.imagePreviewButton:focus-visible {
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    var(--bubble-bg) border-box;
}

.uploadingMedia .imagePreviewButton {
  cursor: default;
}

.uploadingMedia .imagePreviewButton::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(8, 15, 26, 0.28);
  pointer-events: none;
}

.imagePreviewButton img,
.imagePreviewButton video {
  width: 100%;
  min-height: 120px;
  max-height: 420px;
  display: block;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.18);
}

.imagePreviewButton video {
  pointer-events: none;
}

.videoMessage {
  width: fit-content;
  max-width: min(360px, 64vw);
}

.videoMessage .imagePreviewButton {
  width: fit-content;
  min-height: 0;
  display: block;
}

.videoMessage .imagePreviewButton video {
  width: auto;
  max-width: min(360px, 64vw);
  height: auto;
  min-height: 0;
  max-height: 420px;
  object-fit: contain;
}

.uploadingMedia .imagePreviewButton video {
  filter: blur(10px) saturate(0.86) brightness(0.62);
  transform: scale(1.04);
}

.videoPlayOverlay {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(8, 15, 26, 0.58);
  color: white;
  font-size: 22px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 12px 32px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(10px);
  transform: translate(-50%, -50%);
}

.videoPlayOverlay i {
  transform: translateX(2px);
}

@property --upload-progress {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.uploadProgressOverlay {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(
    rgba(255, 255, 255, 0.92) var(--upload-progress),
    rgba(255, 255, 255, 0.2) 0
  );
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%);
  transition:
    --upload-progress 0.32s linear,
    opacity 0.18s ease,
    transform 0.18s ease;
}

.uploadProgressRing {
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  background: rgba(8, 15, 26, 0.68);
  backdrop-filter: blur(10px);
}

.uploadCancelButton {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  color: white;
  font-size: 17px;
}

.uploadCancelButton:hover {
  background: rgba(251, 113, 133, 0.34);
}

.imageCaption {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  padding: 8px 10px 9px;
  border-radius: 0 0 13px 13px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.42));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.88);
}

.messageGroup.out .imageCaption {
  color: rgba(255, 255, 255, 0.88);
}

.imageMessageTime {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(10, 18, 31, 0.42);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(5px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.imagePreviewButton:hover .imageMessageTime,
.imagePreviewButton:focus-visible .imageMessageTime {
  opacity: 1;
  transform: translateY(0);
}

.imagePreviewButton:has(.imageCaption) .imageMessageTime {
  bottom: 34px;
}

.attachmentDraftPanel {
  display: grid;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}

.draftHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.draftHeader strong {
  color: var(--text);
}

.draftList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.draftItem {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 30px;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.draftItem img,
.draftFileIcon {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--soft);
}

.draftFileIcon {
  display: grid;
  place-items: center;
  color: var(--link);
}

.draftItem div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.draftItem strong,
.draftItem span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draftItem strong {
  font-size: 13px;
}

.draftItem span {
  color: var(--muted);
  font-size: 12px;
}

.draftItem button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.draftItem button:hover {
  background: rgba(251, 113, 133, 0.18);
  color: var(--danger);
}

.imageViewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px;
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(14px);
  animation: modalBackdropIn 0.18s ease-out;
}

.imageViewer.hidden {
  display: none;
}

.imageViewer img,
.imageViewer video {
  max-width: min(100%, 1180px);
  max-height: 100%;
  border-radius: 18px;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.imageViewer video {
  width: min(100%, 1180px);
  background: black;
}

.imageViewerClose,
.imageViewerDownload {
  position: fixed;
  top: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  text-decoration: none;
}

.imageViewerClose {
  right: 22px;
}

.imageViewerDownload {
  right: 76px;
}

.imageViewerClose:hover,
.imageViewerDownload:hover {
  background: rgba(255, 255, 255, 0.18);
}

.messageTime {
  color: var(--muted);
  font-size: calc(12px * var(--message-scale));
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: calc(5px * var(--message-scale));
}

.readReceipt {
  position: relative;
  width: 21px;
  height: 13px;
  display: inline-block;
  color: rgba(255, 255, 255, 0.68);
  flex: 0 0 21px;
}

.checkMark {
  position: absolute;
  width: 13px;
  height: 10px;
  border: 0;
  transform: none;
}

.checkMark::before,
.checkMark::after {
  content: "";
  position: absolute;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: left center;
}

.checkMark::before {
  width: 5px;
  left: 0;
  top: 6px;
  transform: rotate(45deg);
}

.checkMark::after {
  width: 11px;
  left: 3px;
  top: 9px;
  transform: rotate(-52deg);
}

.readReceipt .checkFirst {
  left: 0;
  top: 1px;
}

.readReceipt .checkSecond {
  left: 7px;
  top: 1px;
  opacity: 0;
  transform: translateX(-4px);
}

.readReceipt.read {
  color: rgba(255, 255, 255, 0.68);
}

.readReceipt.read .checkSecond {
  opacity: 1;
  transform: translateX(0);
}

.readReceipt.justRead .checkSecond {
  animation: secondCheckIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes secondCheckIn {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.composer {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--line);
  background: rgba(9, 20, 34, 0.68);
  align-items: end;
}

.chatSearchMode .composerNotice {
  display: none !important;
}

.chatSearchPanel {
  position: relative;
  min-height: 74px;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 38px auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  justify-content: stretch;
  background: rgba(9, 20, 34, 0.72);
  backdrop-filter: blur(12px);
}

.chatSearchBox {
  grid-column: 3;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(80, 106, 139, 0.55);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(5, 12, 23, 0.52);
  color: var(--muted);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.chatSearchBox:focus-within {
  border-color: rgba(var(--accent-rgb), 0.68);
  background: rgba(5, 12, 23, 0.68);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}

.chatSearchBox input {
  min-width: 0;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.chatSearchBox input:focus {
  box-shadow: none;
}

.chatSearchFilterButton {
  grid-column: 1;
  grid-row: 1;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  box-shadow: none;
  backdrop-filter: none;
  transition: color 0.16s ease, transform 0.16s ease;
}

.chatSearchFilterButton:hover,
.chatSearchFilterButton.active {
  background: transparent;
  color: rgba(var(--accent-rgb), 1);
  transform: scale(1.06);
}

.chatSearchNavigation {
  grid-column: 2;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.chatSearchCounter {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.chatSearchFiltersPopover {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(5px);
  animation: modalBackdropIn 0.18s ease-out;
}

.chatSearchFiltersDialog {
  position: relative;
  width: min(100%, 330px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(10, 18, 31, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  display: grid;
  gap: 16px;
  animation: modalSheetIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatSearchFiltersDialog h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.chatSearchFiltersDialog p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chatSearchFilterField {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.chatSearchFilterField select,
.chatSearchFilterField input {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid rgba(80, 106, 139, 0.55);
  border-radius: 10px;
  background: rgba(4, 10, 20, 0.72);
  color: var(--text);
  outline: none;
}

.chatSearchFilterField select:focus,
.chatSearchFilterField input:focus {
  border-color: rgba(var(--accent-rgb), 0.72);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
}

.chatSearchDateRange {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chatSearchFilterTypes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chatSearchFilterTypes button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(95, 119, 151, 0.4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
}

.chatSearchFilterTypes button:hover,
.chatSearchFilterTypes button.active {
  border-color: rgba(var(--accent-rgb), 0.56);
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--text);
}

.chatSearchFilterActions {
  display: flex;
  justify-content: end;
  gap: 9px;
}

.chatSearchFilterActions button {
  min-height: 38px;
  padding: 0 14px;
}

.chatSearchStepButton {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.chatSearchStepButton:not(:disabled):hover {
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--text);
}

.chatSearchStepButton:disabled {
  opacity: 0.36;
  cursor: default;
}

.chatSearchFiltersClose {
  top: 9px;
  right: 9px;
}

.chatSearchFiltersPopover.hidden {
  display: none;
}

.chatSearchFiltersPopover .modalClose {
  color: var(--muted);
}

.chatSearchFiltersPopover .modalClose:hover {
  color: var(--text);
}

.chatSearchFiltersPopover .hidden {
  display: none;
}

.chatSearchFiltersDialog .secondary {
  background: rgba(255, 255, 255, 0.08);
}

.chatSearchFiltersDialog .secondary:hover {
  background: rgba(255, 255, 255, 0.13);
}

.chatSearchFiltersDialog .chatSearchFilterActions button:last-child {
  background: rgba(var(--accent-rgb), 0.82);
  color: white;
}

.chatSearchFiltersDialog .chatSearchFilterActions button:last-child:hover {
  background: rgba(var(--accent-rgb), 0.98);
}

.chatSearchFiltersDialog .chatSearchFilterField span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.versionUpdateNotice {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  width: min(420px, calc(100vw - 32px));
  padding: 13px 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.42);
  border-radius: 16px;
  background: rgba(10, 19, 33, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  animation: softPanelIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.versionUpdateNotice > i {
  color: rgb(var(--accent-rgb));
  font-size: 18px;
}

.versionUpdateNotice > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.versionUpdateNotice strong {
  color: var(--text);
  font-size: 14px;
}

.versionUpdateNotice span {
  color: var(--muted);
  font-size: 12px;
}

.versionUpdateNotice button {
  min-height: 34px;
  padding: 0 11px;
  white-space: nowrap;
}

.versionUpdateNotice .secondary {
  background: rgba(255, 255, 255, 0.08);
}

.chatSearchEmpty {
  align-self: center;
  justify-self: center;
}

.composerNotice {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: rgba(9, 20, 34, 0.68);
  overflow: hidden;
}

.composerNotice.isAppearing {
  animation: composerNoticeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.composerNotice.isHiding {
  animation: composerNoticeOut 0.18s ease-in both;
}

.replyComposerPreview {
  min-width: 0;
  padding-left: 11px;
  border-left: 3px solid var(--accent);
}

.composerNotice strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.composerNotice p {
  margin: 0;
  max-height: 38px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
}

.recordingDot {
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  display: inline-block;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(251, 113, 133, 0.35);
  animation: recordingPulse 1.2s ease-out infinite;
  vertical-align: 1px;
}

.recordingWaveform {
  height: 24px;
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}

.recordingWaveform span {
  width: 3px;
  flex: 0 0 3px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.78;
  transition: height 0.11s ease, opacity 0.11s ease;
}

@keyframes recordingPulse {
  to {
    box-shadow: 0 0 0 9px rgba(251, 113, 133, 0);
  }
}

.composerNotice button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--text);
}

.composerNotice button:hover {
  background: var(--soft-hover);
}

.composer textarea {
  min-height: 42px;
  max-height: 120px;
  overflow-y: auto;
}

.composerIconButton {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--text);
}

.composerIconButton:hover {
  background: var(--soft-hover);
}

.composerIconButton.recording {
  background: var(--danger);
  color: white;
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.16);
}

.composerIconButton.recording:hover {
  background: #e11d48;
}

.sendIconButton {
  background: var(--accent);
  color: white;
}

.sendIconButton:hover {
  background: var(--accent-strong);
}

.composer.disabled {
  opacity: 0.55;
}

.status {
  min-height: 20px;
  margin: 0;
  padding: 0 18px;
  color: var(--muted);
}

.chat > .status {
  display: none;
}

.auth .status {
  margin-top: 12px;
  padding: 0;
}

.status.error {
  color: var(--danger);
}

.toastStack {
  position: absolute;
  top: 92px;
  left: 50%;
  z-index: 28;
  width: min(360px, calc(100% - 48px));
  display: grid;
  gap: 10px;
  justify-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toastStack.withPinned {
  top: 154px;
}

.toast {
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 999px;
  background: rgba(18, 35, 58, 0.9);
  color: var(--text);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.error {
  background: rgba(58, 28, 42, 0.92);
}

.toastIcon {
  color: var(--link);
  display: grid;
  place-items: center;
}

.toast.error .toastIcon {
  color: var(--danger);
}

.profileModal,
.peerProfileModal,
.settingsModal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.56);
  animation: modalBackdropIn 0.18s ease-out;
}

.profileModal.isClosing,
.peerProfileModal.isClosing,
.settingsModal.isClosing {
  animation: modalBackdropOut 0.22s ease-in both;
}

.profileSheet,
.peerProfileSheet,
.settingsSheet {
  position: relative;
  width: min(100%, 390px);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
  padding: 26px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  display: grid;
  gap: 18px;
  animation: modalSheetIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.profileModal.isClosing .profileSheet,
.peerProfileModal.isClosing .peerProfileSheet,
.settingsModal.isClosing .settingsSheet {
  animation: modalSheetOut 0.2s ease-in both;
}

@keyframes modalBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalBackdropOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes modalSheetIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalSheetOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@keyframes softPanelIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes softPanelOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
}

@keyframes composerNoticeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
    max-height: 0;
  }

  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 120px;
  }
}

@keyframes composerNoticeOut {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 120px;
  }

  to {
    opacity: 0;
    transform: translateY(8px);
    max-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profileModal,
  .peerProfileModal,
  .settingsModal,
  .profileSheet,
  .peerProfileSheet,
  .settingsSheet,
  .profileModal.isClosing,
  .peerProfileModal.isClosing,
  .settingsModal.isClosing,
  .profileModal.isClosing .profileSheet,
  .peerProfileModal.isClosing .peerProfileSheet,
  .settingsModal.isClosing .settingsSheet,
  .searchResult.isAppearing,
  .searchResult.isHiding,
  .selectionPanel.isAppearing,
  .selectionPanel.isHiding,
  .composerNotice.isAppearing,
  .composerNotice.isHiding,
  .profileView.panelAppearing,
  .profileEditor.panelAppearing,
  .profileTabPanel.panelAppearing,
  .peerSharedCategory.panelAppearing,
  .messageContextMenu.isAppearing,
  .messageContextMenu.isHiding,
  .chatContextMenu.isAppearing,
  .chatContextMenu.isHiding {
    animation: none;
  }
}

.settingsSheet {
  width: min(100%, 460px);
  padding-bottom: 0;
  overflow: hidden;
}

.modalClose {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--text);
}

.modalClose:hover {
  background: var(--soft-hover);
}

.profileSheet {
  width: min(100%, 430px);
  height: min(760px, calc(100dvh - 48px));
  max-height: min(760px, calc(100dvh - 48px));
  padding: 0;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

.peerProfileSheet {
  width: min(100%, 430px);
  height: min(560px, calc(100dvh - 48px));
  max-height: min(560px, calc(100dvh - 48px));
  padding: 0;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
}

.profileView {
  min-height: 0;
  padding: 30px 26px 24px;
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 18px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.22), transparent 36%),
    linear-gradient(135deg, rgba(18, 35, 58, 0.98), rgba(9, 20, 34, 0.98));
}

.profileViewHero {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.profileViewHero h2,
.profileViewInfo p {
  margin: 0;
}

.profileViewHero h2 {
  font-size: 24px;
  line-height: 1.12;
}

.profileViewInfo {
  display: grid;
  border: 1px solid rgba(142, 160, 179, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.022);
  overflow: hidden;
}

.profileViewRow {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(142, 160, 179, 0.13);
}

.profileViewRow:last-child {
  border-bottom: 0;
}

.profileViewRow span {
  color: var(--muted);
  font-size: 12px;
}

.profileViewRow strong,
.profileViewRow p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.peerShared {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.peerSharedTabs {
  min-width: 0;
  padding: 6px;
  border-radius: 999px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.045);
}

.peerSharedTabs::-webkit-scrollbar {
  height: 3px;
}

.peerSharedTab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}

.peerSharedTab:hover {
  background: transparent;
}

.peerSharedTab.active {
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--link-hover);
}

.peerSharedCategory {
  display: grid;
  min-height: 0;
}

.peerSharedCategory.panelAppearing {
  animation: softPanelIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.peerSharedCategory h3 {
  display: none;
}

.peerSharedList {
  display: grid;
  max-height: min(260px, 34dvh);
  border: 1px solid rgba(142, 160, 179, 0.16);
  border-radius: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.022);
}

.peerSharedList::-webkit-scrollbar {
  width: 4px;
}

.peerSharedList::-webkit-scrollbar-track {
  background: transparent;
}

.peerSharedList::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
}

.peerSharedList::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.42);
}

.peerSharedItem {
  min-height: 54px;
  padding: 9px 12px;
  border-radius: 0;
  border-bottom: 1px solid rgba(142, 160, 179, 0.12);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.peerSharedItem:last-child {
  border-bottom: 0;
}

.peerSharedItem:hover {
  background: rgba(var(--accent-rgb), 0.08);
}

.peerSharedIcon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--link);
}

.peerSharedItem span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.peerSharedItem strong,
.peerSharedItem small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peerSharedItem strong {
  font-size: 14px;
}

.peerSharedItem small {
  color: var(--muted);
  font-size: 12px;
}

.profilePreviewAvatarWrap {
  position: relative;
  width: 112px;
  height: 112px;
}

.profileModalAvatar {
  width: 112px;
  height: 112px;
}

.profileEditor {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.profileBackButton {
  justify-self: start;
  margin: 16px 18px 0;
  min-height: 38px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.profileEditorDemo {
  margin: 12px 18px 0;
  padding: 12px;
  border: 1px solid rgba(142, 160, 179, 0.16);
  border-radius: 8px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  background:
    radial-gradient(circle at 15% 0%, rgba(var(--accent-rgb), 0.18), transparent 42%),
    rgba(255, 255, 255, 0.02);
}

.profileEditorDemoAvatarWrap {
  position: relative;
  width: 58px;
  height: 58px;
}

.profileEditorDemoAvatar {
  width: 58px;
  height: 58px;
}

.profileEditorDemo .profileStatusDot {
  width: 16px;
  height: 16px;
  border-width: 3px;
}

.profileEditorDemo div:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.profileEditorDemo strong,
.profileEditorDemo span,
.profileEditorDemo p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profileEditorDemo strong {
  font-size: 16px;
}

.profileEditorDemo span,
.profileEditorDemo p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.profileStatusDot,
.presenceDot,
.avatarStatusDot {
  display: inline-block;
  border-radius: 50%;
  background: var(--online);
}

.profileStatusDot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 24px;
  height: 24px;
  border: 4px solid var(--panel);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.profileStatusDot.dnd,
.presenceDot.dnd,
.avatarStatusDot.dnd {
  background: var(--warning);
}

.profileTabs {
  padding: 14px 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-bottom: 1px solid rgba(142, 160, 179, 0.16);
  background: var(--panel-2);
}

.profileTab {
  min-height: 40px;
  background: var(--soft);
  color: var(--text);
}

.profileTab.active {
  background: var(--accent);
  color: white;
}

.profileTabPanel {
  min-height: 0;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
}

.profileView.panelAppearing,
.profileEditor.panelAppearing,
.profileTabPanel.panelAppearing {
  animation: softPanelIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.profileView.isHiding,
.profileEditor.isHiding {
  animation: softPanelOut 0.17s ease-in both;
}

.profileSection {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(142, 160, 179, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
}

.profileSectionTitle {
  display: grid;
  gap: 4px;
}

.profileSectionTitle h3,
.profileSectionTitle p {
  margin: 0;
}

.profileSectionTitle h3 {
  font-size: 16px;
}

.profileSectionTitle p {
  font-size: 13px;
  line-height: 1.35;
}

.copyUsernameButton {
  justify-self: start;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--link);
  font-weight: 600;
}

.copyUsernameButton:hover {
  background: transparent;
  color: var(--link-hover);
  text-decoration: underline;
}

.descriptionRow {
  display: grid;
  gap: 6px;
}

.descriptionRow textarea {
  min-height: 108px;
}

#profileDescriptionCounter {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
}

.manualGradient {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.manualGradient input[type="color"] {
  height: 42px;
  padding: 4px;
}

.photoCropper {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px 16px;
  align-items: center;
}

.photoCropper canvas {
  grid-row: span 5;
  width: 180px;
  height: 180px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.photoCropper label {
  gap: 8px;
}

.photoCropper input[type="range"] {
  height: auto;
  padding: 0;
  accent-color: var(--accent);
}

.presenceChoices,
.shapeChoices,
.presetActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.presenceChoice,
.shapeChoice {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--soft);
}

.presenceChoice.active,
.shapeChoice.active {
  background: var(--accent);
}

.presenceDot {
  width: 13px;
  height: 13px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.profilePresets {
  display: grid;
  gap: 8px;
}

.profilePreset {
  min-height: 56px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: var(--soft);
}

.profilePreset:hover {
  background: var(--soft-hover);
}

.profilePreset .avatar {
  width: 38px;
  height: 38px;
}

.profilePreset span {
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.profilePreset strong,
.profilePreset small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profilePreset small {
  color: var(--muted);
}

.profileActions {
  position: sticky;
  bottom: 0;
  padding: 14px 18px;
  border-top: 1px solid rgba(142, 160, 179, 0.16);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
  background: rgba(9, 20, 34, 0.98);
}

.emptyPresetText {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.settingsHeader {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding-right: 34px;
}

.settingsHeader h2,
.settingsHeader p {
  margin: 0;
}

.settingsIcon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--warm-soft);
  color: var(--warm);
}

.settingsSections {
  display: grid;
  margin-left: -26px;
  margin-right: -26px;
  border-top: 1px solid rgba(142, 160, 179, 0.16);
  border-bottom: 1px solid rgba(142, 160, 179, 0.16);
  background: rgba(255, 255, 255, 0.015);
}

.settingsRow {
  width: 100%;
  min-height: 72px;
  padding: 0 26px;
  border-radius: 0;
  border-bottom: 1px solid rgba(142, 160, 179, 0.12);
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: center;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease;
}

.settingsRow:last-child {
  border-bottom: 0;
}

.settingsRow:hover {
  background: rgba(var(--accent-rgb), 0.08);
}

.settingsRow i {
  justify-self: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--muted);
}

.settingsRow:hover i {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.18);
}

.settingsRow span {
  display: grid;
  gap: 4px;
}

.settingsRow small {
  color: var(--muted);
  font-size: 13px;
}

.settingsDetail {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--panel);
  animation: modalSheetIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.settingsDetailHeader {
  min-height: 76px;
  padding: 14px 58px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  text-align: center;
}

.settingsDetailHeader h2,
.settingsDetailHeader p {
  margin: 0;
}

.settingsDetailHeader h2 {
  font-size: 20px;
}

.settingsDetailHeader p {
  margin-top: 4px;
  font-size: 13px;
}

.settingsBackButton {
  position: absolute;
  top: 18px;
  left: 14px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--link);
}

.settingsBackButton:hover {
  background: rgba(var(--accent-rgb), 0.22);
  color: var(--link-hover);
}

.settingsDetailClose {
  z-index: 3;
}

.settingsDetailBody {
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
}

.settingsPlaceholder {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
}

.settingsPlaceholder i {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--link);
  font-size: 22px;
}

.settingsPlaceholder strong {
  color: var(--text);
  font-size: 18px;
}

.settingsPlaceholder p {
  max-width: 280px;
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.settingsChoiceBlock {
  min-height: 58px;
  padding: 8px 8px 8px 16px;
  border: 1px solid rgba(142, 160, 179, 0.16);
  border-radius: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  background: rgba(15, 29, 48, 0.92);
}

.settingsChoiceBlock > span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.settingsLanguageSelect {
  position: relative;
  min-width: 150px;
  display: grid;
  align-items: center;
}

.settingsLanguageSelect select {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 14px;
  border: 1px solid rgba(142, 160, 179, 0.18);
  border-radius: 999px;
  appearance: none;
  background: rgba(3, 10, 19, 0.58);
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.settingsLanguageSelect i {
  position: absolute;
  right: 14px;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.settingsScaleBlock {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(142, 160, 179, 0.16);
  border-radius: 18px;
  display: grid;
  gap: 12px;
  background: rgba(15, 29, 48, 0.92);
}

.settingsScaleHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settingsScaleHeader span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.settingsScaleHeader strong {
  color: var(--link);
  font-size: 14px;
}

.settingsScaleBlock input[type="range"] {
  width: 100%;
  height: 24px;
  padding: 0;
  border: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.settingsScaleBlock input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.7), rgba(var(--accent-rgb), 0.18));
}

.settingsScaleBlock input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  appearance: none;
  background: var(--accent);
  box-shadow: 0 5px 14px rgba(var(--accent-rgb), 0.28);
}

.settingsScaleBlock input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.7), rgba(var(--accent-rgb), 0.18));
}

.settingsScaleBlock input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 5px 14px rgba(var(--accent-rgb), 0.28);
}

.settingsScaleMarks {
  position: relative;
  height: 18px;
  margin: -2px 9px 0;
  color: var(--muted);
  font-size: 10px;
}

.settingsScaleMarks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.settingsScaleMarks span:first-child {
  transform: translateX(0);
}

.settingsScaleMarks span:last-child {
  transform: translateX(-100%);
}

.settingsThemeSection {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.settingsThemeTitle {
  display: grid;
  gap: 4px;
}

.settingsThemeTitle strong {
  color: var(--text);
  font-size: 15px;
}

.settingsThemeTitle span {
  color: var(--muted);
  font-size: 13px;
}

.settingsThemeGrid {
  display: grid;
  gap: 8px;
}

.settingsThemePreset {
  min-height: 62px;
  padding: 8px 12px 8px 8px;
  border: 1px solid rgba(142, 160, 179, 0.14);
  border-radius: 18px;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  background: rgba(15, 29, 48, 0.88);
  color: var(--text);
  text-align: left;
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.16s ease;
}

.settingsThemePreset:hover {
  background: rgba(20, 38, 62, 0.96);
  transform: translateY(-1px);
}

.settingsThemePreset.active {
  border-color: rgba(var(--accent-rgb), 0.58);
  background: rgba(var(--accent-rgb), 0.14);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.settingsThemePreset > span:last-child {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settingsThemePreview {
  height: 44px;
  padding: 8px;
  border-radius: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: end;
  background: rgba(3, 10, 19, 0.62);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.settingsThemePreview i,
.settingsThemePreview b {
  display: block;
  border-radius: 999px;
}

.settingsThemePreview i {
  height: 10px;
  background: rgba(255, 255, 255, 0.13);
}

.settingsThemePreview b {
  height: 18px;
  background: var(--preview-gradient);
  box-shadow: 0 8px 16px var(--preview-shadow);
}

.settingsThemePreview[data-preview-theme="violet-pink"] {
  --preview-gradient: linear-gradient(135deg, #4f46e5, #6d28d9, #9d2f7f);
  --preview-shadow: rgba(109, 40, 217, 0.18);
}

.settingsThemePreview[data-preview-theme="blue-cyan"] {
  --preview-gradient: linear-gradient(135deg, #1d4ed8, #0f7ea8, #1ba6b8);
  --preview-shadow: rgba(15, 126, 168, 0.18);
}

.settingsThemePreview[data-preview-theme="green-moss"] {
  --preview-gradient: linear-gradient(135deg, #14532d, #3f6212, #5f8f12);
  --preview-shadow: rgba(63, 98, 18, 0.16);
}

.settingsThemePreview[data-preview-theme="blue-violet"] {
  --preview-gradient: linear-gradient(135deg, #1e40af, #3730a3, #581c87);
  --preview-shadow: rgba(55, 48, 163, 0.18);
}

.settingsThemePreview[data-preview-theme="orange-yellow"] {
  --preview-gradient: linear-gradient(135deg, #92400e, #b45309, #ca8a04);
  --preview-shadow: rgba(180, 83, 9, 0.14);
}

.settingsAccordion {
  border: 1px solid rgba(142, 160, 179, 0.16);
  border-radius: 18px;
  overflow: clip;
  background: rgba(255, 255, 255, 0.018);
}

.settingsAccordion + .settingsAccordion {
  margin-top: 8px;
}

.settingsAccordionButton {
  width: 100%;
  min-height: 56px;
  padding: 9px 14px;
  border-radius: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  background: rgba(15, 29, 48, 0.92);
  color: var(--text);
  text-align: left;
}

.settingsAccordionButton:hover {
  background: rgba(20, 38, 62, 0.96);
}

.settingsAccordion.open .settingsAccordionButton {
  border-radius: 18px 18px 0 0;
}

.settingsAccordionButton span {
  display: grid;
  gap: 2px;
}

.settingsAccordionButton strong {
  font-size: 14px;
}

.settingsAccordionButton small {
  color: var(--muted);
  font-size: 12px;
}

.settingsAccordionButton > i {
  justify-self: center;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.settingsAccordion.open .settingsAccordionButton > i {
  transform: rotate(180deg);
}

.settingsAccordionPanel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.24s ease;
}

.settingsAccordion.open .settingsAccordionPanel {
  grid-template-rows: 1fr;
}

.settingsAccordionPanel > div {
  min-height: 0;
  max-height: min(410px, 48dvh);
  overflow: hidden auto;
  display: grid;
  gap: 10px;
  padding: 0 14px;
  border-radius: 0 0 18px 18px;
  background: rgba(3, 10, 19, 0.58);
  transition: padding 0.24s ease;
}

.settingsAccordion.open .settingsAccordionPanel > div {
  padding: 12px 14px 14px;
}

.settingsField,
.settingsSwitchRow {
  display: grid;
  gap: 7px;
  color: var(--text);
}

.settingsField span,
.settingsSwitchRow span {
  color: var(--muted);
  font-size: 13px;
}

.settingsField select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.settingsSwitchRow {
  min-height: 42px;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
}

.settingsSwitchRow input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settingsSwitchRow i {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px rgba(142, 160, 179, 0.2);
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.settingsSwitchRow i::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  transition: transform 0.16s ease;
}

.settingsSwitchRow input:checked + i {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

.settingsSwitchRow input:checked + i::before {
  transform: translateX(20px);
}

.settingsActionButton {
  width: 100%;
  min-height: 42px;
  background: var(--soft);
  color: var(--text);
}

.settingsActionButton:hover:not(:disabled) {
  background: var(--soft-hover);
}

.settingsActionButton:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.messageContextMenu,
.chatContextMenu {
  position: fixed;
  z-index: 30;
  min-width: 214px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 2px;
  transform-origin: top left;
}

.messageContextMenu.isAppearing,
.chatContextMenu.isAppearing {
  animation: contextMenuIn 0.14s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.messageContextMenu.isHiding,
.chatContextMenu.isHiding {
  animation: contextMenuOut 0.12s ease-in both;
}

@keyframes contextMenuIn {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes contextMenuOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(3px) scale(0.97);
  }
}

.reactionMenu {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.messageContextMenu .reactionMenu button {
  min-height: 36px;
  padding: 0;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  background: transparent;
}

.messageContextMenu .reactionMenu button:hover {
  background: rgba(var(--accent-rgb), 0.16);
  transform: translateY(-1px);
}

.messageContextMenu button,
.chatContextMenu button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: center;
  text-align: left;
}

.messageContextMenu button:hover,
.chatContextMenu button:hover {
  background: var(--soft);
}

.messageContextMenu i,
.chatContextMenu i,
.contextPinIcon {
  justify-self: center;
  color: var(--muted);
}

.contextPinIcon {
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14.5 3.5 20.5 9.5 18.7 11.3 17.3 9.9 13.4 13.8 13.9 18.2 12.5 19.6 9.4 16.5 4.9 21 3 19.1 7.5 14.6 4.4 11.5 5.8 10.1 10.2 10.6 14.1 6.7 12.7 5.3 14.5 3.5Z'/%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'%3E%3Cpath d='M14.5 3.5 20.5 9.5 18.7 11.3 17.3 9.9 13.4 13.8 13.9 18.2 12.5 19.6 9.4 16.5 4.9 21 3 19.1 7.5 14.6 4.4 11.5 5.8 10.1 10.2 10.6 14.1 6.7 12.7 5.3 14.5 3.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.deleteConfirmPanel {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 17, 31, 0.44);
  backdrop-filter: blur(5px);
  animation: confirmBackdropIn 0.16s ease-out;
}

.pinConfirmPanel {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 17, 31, 0.42);
  backdrop-filter: blur(6px);
  animation: confirmBackdropIn 0.16s ease-out;
}

.pinConfirmCard {
  width: min(100%, 390px);
  padding: 22px;
  border-radius: 8px;
  background: rgba(18, 22, 29, 0.98);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.42);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  text-align: left;
  animation: confirmCardIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pinConfirmText {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.pinConfirmText strong,
.pinConfirmText p {
  margin: 0;
}

.pinConfirmText strong {
  display: block;
  font-size: 22px;
  line-height: 1.15;
}

.pinConfirmText p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.pinScopeChoice {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  font-size: 14px;
}

.pinScopeChoice input {
  width: 19px;
  height: 19px;
  accent-color: var(--accent);
}

.pinConfirmCard button {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 650;
}

.pinConfirmCard [data-action="confirm-pin"] {
  order: 3;
}

.pinConfirmCard [data-action="cancel-pin"] {
  order: 4;
  background: var(--soft);
}

.pinConfirmCard [data-action="cancel-pin"]:hover {
  background: var(--soft-hover);
}

.deleteConfirmCard {
  width: min(100%, 390px);
  min-height: 0;
  padding: 22px;
  border-radius: 8px;
  background: rgba(18, 22, 29, 0.98);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.42);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  text-align: left;
  animation: confirmCardIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.deleteConfirmIcon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(251, 113, 133, 0.15);
  color: var(--danger);
  font-size: 20px;
}

.deleteConfirmText {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.deleteConfirmText strong,
.deleteConfirmText p {
  margin: 0;
}

.deleteConfirmText strong {
  font-size: 22px;
  line-height: 1.15;
}

.deleteConfirmText p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.deleteEverywhere {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
}

.deleteEverywhere label {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(142, 160, 179, 0.16);
  border-radius: 10px;
  display: flex;
  gap: 9px;
  align-items: center;
  background: rgba(255, 255, 255, 0.035);
}

.deleteEverywhere input {
  width: 19px;
  height: 19px;
  accent-color: var(--accent);
}

.deleteConfirmCard button {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 650;
}

.deleteConfirmCard [data-action="confirm-delete"] {
  order: 3;
}

.deleteConfirmCard [data-action="cancel-delete"] {
  order: 4;
  background: var(--soft);
}

.deleteConfirmCard [data-action="cancel-delete"]:hover {
  background: var(--soft-hover);
}

.dangerButton {
  background: var(--accent);
}

.dangerButton:hover {
  background: var(--accent-strong);
}

@keyframes confirmBackdropIn {
  from {
    opacity: 0;
  }
}

@keyframes confirmCardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@media (max-width: 820px) {
  .shell {
    place-items: stretch;
  }

  .loading,
  .auth {
    width: min(calc(100% - 24px), 1120px);
    place-self: center;
  }

  .messenger {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    max-height: 42vh;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chatList {
    min-height: 0;
  }

  .chat {
    min-height: 0;
  }

  .pinnedPanel {
    min-height: 54px;
    padding: 8px 12px;
    grid-template-columns: 3px 30px minmax(0, 1fr) 30px;
    gap: 9px;
  }

  .pinnedIcon {
    width: 30px;
    height: 30px;
  }

  .composer {
    grid-template-columns: auto 1fr auto auto;
  }

  .chatHeader {
    padding: 14px 14px;
    gap: 10px;
  }

  .chatHeaderSearchButton {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .chatSearchPanel {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 10px 12px 14px;
  }

  .chatSearchNavigation {
    grid-column: 2;
    grid-row: 2;
    padding-left: 0;
  }

  .chatSearchCounter {
    max-width: 112px;
  }

  .chatSearchBox {
    grid-column: 2;
    grid-row: 1;
  }

  .chatSearchFilterButton {
    grid-column: 1;
    grid-row: 1;
  }

  .chatSearchFiltersDialog {
    padding: 20px;
  }

  .chat > .status {
    display: none;
  }

  .toastStack {
    left: 50%;
    top: 82px;
    width: calc(100% - 24px);
  }

  .toastStack.withPinned {
    top: 140px;
  }

  .messageGroup {
    max-width: 92%;
  }

  .voiceMessage {
    min-width: min(310px, 82vw);
    grid-template-columns: 48px minmax(120px, 1fr);
    gap: 12px;
  }

  .voicePlayButton {
    width: 48px;
    height: 48px;
    min-height: 48px;
    font-size: 18px;
  }

  .voiceInfo {
    font-size: 14px;
  }

  .fileMessage {
    min-width: min(280px, 78vw);
    grid-template-columns: 38px minmax(0, 1fr) 34px;
  }

  .imageMessage {
    width: min(300px, 78vw);
  }

  .imagePreviewButton {
    min-height: 190px;
  }

  .videoMessage {
    max-width: min(300px, 78vw);
  }

  .videoMessage .imagePreviewButton {
    min-height: 0;
  }

  .videoMessage .imagePreviewButton video {
    max-width: min(300px, 78vw);
    min-height: 0;
  }

  .attachmentDraftPanel {
    padding: 10px 12px;
  }

  .draftList {
    grid-template-columns: 1fr;
  }

  .imageViewer {
    padding: 72px 14px 28px;
  }

  .imageViewer img {
    border-radius: 14px;
  }

  .profileModal,
  .settingsModal {
    padding: 12px;
  }

  .profileSheet {
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .profileView {
    padding: 26px 18px 20px;
  }

  .profilePreviewAvatarWrap,
  .profileModalAvatar {
    width: 96px;
    height: 96px;
  }

  .profileViewHero h2 {
    font-size: 22px;
  }

  .gradientGrid {
    grid-template-columns: repeat(4, 1fr);
  }

  .manualGradient,
  .photoCropper,
  .profileActions {
    grid-template-columns: 1fr;
  }

  .photoCropper canvas {
    grid-row: auto;
    justify-self: center;
  }

  .deleteConfirmCard button {
    width: 100%;
  }

  .pinConfirmCard button {
    width: 100%;
  }
}
