:root {
  --titlebar-height: 0px;
  --bg: #2b2c2e;
  --panel: #303133;
  --panel-dark: #242527;
  --panel-soft: #38393b;
  --input: #424345;
  --popup: #202123;
  --bubble: #454648;
  --self-text: #071009;
  --message-meta: rgba(255, 255, 255, 0.48);
  --message-meta-self: rgba(7, 16, 9, 0.56);
  --line: #414245;
  --text: #f4f5f5;
  --muted: #a8abb0;
  --muted-dark: #74777c;
  --green: #06c755;
  --accent-rgb: 6, 199, 85;
  --green-soft: rgba(6, 199, 85, 0.14);
  --danger: #ff6b6b;
  --shadow: rgba(0, 0, 0, 0.32);
  --message-font-size: 14px;
  --message-avatar-size: 38px;
  --message-gap: 8px;
  --message-list-padding: 22px;
  --bubble-padding-y: 10px;
  --bubble-padding-x: 12px;
  --attachment-accent: rgba(var(--accent-rgb), 0.14);
  --chat-profile-side-width: clamp(360px, 27vw, 420px);
  --app-mark: url("../assets/theme-icons/koko-dark.png");
  --sidebar-width: 320px;
  --sidebar-min-width: 248px;
  --sidebar-max-width: 440px;
  --call-room-height: 372px;
  --avatar-bg: linear-gradient(145deg, #68707b, #23252a);
  --avatar-text: #ffffff;
  --empty-logo-opacity: 0.16;
  --empty-logo-filter: grayscale(1) saturate(0) brightness(1.08);
  --scrollbar-track: rgba(255, 255, 255, 0.04);
  --scrollbar-thumb: rgba(255, 255, 255, 0.22);
  --scrollbar-thumb-hover: rgba(var(--accent-rgb), 0.5);
  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.24, 0.82, 0.32, 1);
  --ease-swift: cubic-bezier(0.3, 0, 0, 1);
  --motion-fast: 140ms;
  --motion-medium: 220ms;
  --motion-slow: 320ms;
  --motion-stagger-step: 34ms;
  --radius: 6px;
  --font: "Segoe UI", "Trebuchet MS", sans-serif;
}

body[data-theme="light"] {
  --bg: #f3f5f1;
  --panel: #ffffff;
  --panel-dark: #e8ede7;
  --panel-soft: #edf2ec;
  --input: #eef2ef;
  --popup: #ffffff;
  --bubble: #e2e8e4;
  --self-text: #06120a;
  --message-meta: rgba(21, 26, 23, 0.48);
  --message-meta-self: rgba(6, 18, 10, 0.58);
  --line: #d6ded8;
  --text: #151a17;
  --muted: #66726b;
  --muted-dark: #87928c;
  --accent-rgb: 6, 199, 85;
  --green-soft: rgba(6, 199, 85, 0.16);
  --shadow: rgba(26, 38, 32, 0.16);
  --app-mark: url("../assets/theme-icons/koko-light.png");
  --avatar-bg:
    linear-gradient(145deg, #7f9188, #44534c);
  --avatar-text: #ffffff;
  --empty-logo-opacity: 0.18;
  --empty-logo-filter: grayscale(1) saturate(0) brightness(0.52);
  --scrollbar-track: rgba(21, 26, 23, 0.06);
  --scrollbar-thumb: rgba(21, 26, 23, 0.2);
  --scrollbar-thumb-hover: rgba(var(--accent-rgb), 0.52);
}

body[data-theme="oled"] {
  --bg: #000000;
  --panel: #050505;
  --panel-dark: #000000;
  --panel-soft: #101010;
  --input: #111111;
  --popup: #050505;
  --bubble: #151515;
  --self-text: #020704;
  --message-meta: rgba(246, 246, 246, 0.44);
  --message-meta-self: rgba(2, 7, 4, 0.6);
  --line: #202020;
  --text: #f6f6f6;
  --muted: #a0a0a0;
  --muted-dark: #6b6b6b;
  --accent-rgb: 6, 199, 85;
  --green-soft: rgba(6, 199, 85, 0.22);
  --shadow: rgba(0, 0, 0, 0.58);
  --app-mark: url("../assets/theme-icons/koko-oled.png");
  --avatar-bg: linear-gradient(145deg, #1d2b22, #000000);
  --avatar-text: #ffffff;
  --empty-logo-opacity: 0.18;
  --empty-logo-filter: grayscale(1) saturate(0) brightness(1.12);
  --scrollbar-track: rgba(255, 255, 255, 0.03);
  --scrollbar-thumb: rgba(255, 255, 255, 0.18);
  --scrollbar-thumb-hover: rgba(var(--accent-rgb), 0.54);
}

body[data-theme="sakura"] {
  --bg: #fff7fb;
  --panel: #fffdfd;
  --panel-dark: #fff0f5;
  --panel-soft: #ffe0ea;
  --input: #fff4f8;
  --popup: #fffdfd;
  --bubble: #ffe6ee;
  --self-text: #4d1f31;
  --message-meta: rgba(77, 31, 49, 0.5);
  --message-meta-self: rgba(77, 31, 49, 0.62);
  --line: #efc8d6;
  --text: #5a2438;
  --muted: #9b6076;
  --muted-dark: #bf8398;
  --green: #ff8fb3;
  --accent-rgb: 255, 143, 179;
  --green-soft: rgba(255, 143, 179, 0.18);
  --shadow: rgba(176, 86, 119, 0.18);
  --app-mark: url("../assets/theme-icons/koko-sakura.png");
  --avatar-bg:
    linear-gradient(145deg, #f39bb8, #a65472);
  --avatar-text: #ffffff;
  --empty-logo-opacity: 0.16;
  --empty-logo-filter: grayscale(1) saturate(0) brightness(0.62);
  --scrollbar-track: rgba(93, 41, 61, 0.08);
  --scrollbar-thumb: rgba(166, 84, 114, 0.28);
  --scrollbar-thumb-hover: rgba(var(--accent-rgb), 0.58);
}

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

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  min-height: 36px;
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding-top: var(--titlebar-height);
  overflow: hidden;
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
}

body[data-platform="win32"] {
  --titlebar-height: 40px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

body,
.window-bar,
.auth-card,
.sidebar,
.chat-panel,
.chat-header,
.composer,
.settings-card,
.profile-card-footer,
.new-chat-popover,
.context-menu,
.confirm-dialog,
.request-row,
.friend-preview,
.theme-option,
.language-option,
.user-button,
.friend-sidebar-button,
.auth-card input,
.search-box input,
.composer input,
.code-row input,
.add-friend-form input {
  transition:
    color var(--motion-medium) var(--ease-standard),
    background-color var(--motion-medium) var(--ease-standard),
    border-color var(--motion-medium) var(--ease-standard),
    box-shadow var(--motion-medium) var(--ease-standard),
    opacity var(--motion-medium) var(--ease-standard),
    transform var(--motion-medium) var(--ease-standard);
}

.window-control-button,
.auth-tabs button,
.server-row button,
.text-button,
.chat-header-button,
.chat-search-mini,
.settings-menu button,
.theme-option,
.language-option,
.primary-button,
.secondary-button,
.mini-button,
.new-chat-button,
.context-menu button,
.send-button {
  transition:
    color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard),
    opacity var(--motion-fast) var(--ease-standard);
}

button:disabled {
  cursor: default;
  opacity: 0.66;
}

.window-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  display: none;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  height: var(--titlebar-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%),
    var(--panel-dark);
  user-select: none;
}

body[data-platform="win32"] .window-bar {
  display: grid;
}

.window-brand,
.window-drag-region {
  -webkit-app-region: drag;
}

.window-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 0 0 14px;
}

.window-brand-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 5px;
  background: var(--app-mark) center / contain no-repeat;
}

.window-brand-title {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.window-drag-region {
  min-width: 0;
}

.window-controls {
  display: inline-flex;
  -webkit-app-region: no-drag;
}

.window-control-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: var(--titlebar-height);
  border: 0;
  color: var(--muted);
  background: transparent;
}

.window-control-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.window-control-button.close:hover {
  color: #fff;
  background: #e05656;
}

.window-control-icon {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
}

.window-control-icon.minimize::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 3px;
  height: 1.5px;
  background: currentColor;
}

.window-control-icon.maximize::before,
.window-control-icon.maximize::after {
  content: "";
  position: absolute;
  border: 1.5px solid currentColor;
}

.window-control-icon.maximize::before {
  inset: 1px;
}

.window-control-icon.maximize.restore::before {
  inset: 3px 1px 1px 3px;
  background: transparent;
}

.window-control-icon.maximize.restore::after {
  inset: 1px 3px 3px 1px;
  background: transparent;
}

.window-control-icon.close::before,
.window-control-icon.close::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.5px;
  width: 1.5px;
  height: 12px;
  background: currentColor;
}

.window-control-icon.close::before {
  transform: rotate(45deg);
}

.window-control-icon.close::after {
  transform: rotate(-45deg);
}

.is-hidden {
  display: none !important;
}

.auth-screen {
  display: grid;
  min-height: calc(100vh - var(--titlebar-height));
  padding: 24px;
  place-items: center;
  overflow: auto;
  background:
    radial-gradient(circle at 30% 20%, rgba(var(--accent-rgb), 0.12), transparent 24rem),
    radial-gradient(circle at 70% 80%, rgba(var(--accent-rgb), 0.08), transparent 20rem),
    var(--bg);
}

.auth-card {
  width: min(448px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 32px 28px;
  overflow: auto;
  background: var(--panel);
  box-shadow: 0 24px 80px var(--shadow);
  transform-origin: center top;
}

.auth-logo,
.empty-logo {
  background: var(--app-mark) center / contain no-repeat;
}

.auth-logo {
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
}

.auth-card h1 {
  margin: 0;
  font-size: 1.5rem;
}

.auth-copy {
  margin: 8px 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-copy:empty {
  display: none;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 10px;
  background: var(--panel-dark);
}

.auth-tabs button,
.server-row button,
.text-button {
  border: 0;
  color: var(--muted);
  background: transparent;
}

.auth-tabs button {
  border-radius: 8px;
  padding: 10px;
}

.auth-tabs button:hover,
.settings-menu button:hover,
.text-button:hover,
.server-row button:hover {
  transform: translateY(-1px);
}

.auth-tabs button.active {
  color: var(--text);
  background: var(--panel-soft);
}

.auth-card label {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.auth-card input,
.search-box input,
.composer input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--input);
  outline: none;
}

.auth-card input {
  padding: 12px;
}

.auth-remember-row {
  margin-top: 12px;
}

.auth-provider-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.google-auth-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.link-button {
  width: 100%;
  border: 0;
  margin-top: 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.link-button:hover {
  color: var(--text);
}

.auth-card input:focus,
.search-box input:focus,
.composer input:focus {
  border-color: rgba(var(--accent-rgb), 0.58);
}

.primary-button,
.secondary-button {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  margin-top: 14px;
  padding: 12px;
  font-weight: 800;
}

.primary-button {
  color: #101112;
  background: var(--green);
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.mini-button:hover:not(:disabled),
.send-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-dark);
}

.primary-button.slim,
.secondary-button.slim {
  margin-top: 0;
  padding: 10px 12px;
}

.form-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.shell {
  display: grid;
  grid-template-columns: 60px var(--sidebar-width) 10px minmax(0, 1fr);
  height: calc(100vh - var(--titlebar-height));
  background: var(--bg);
  transform: translateZ(0);
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 0 22px;
  background: var(--panel-dark);
}

.rail-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  transition:
    color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.rail-button:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.rail-button:focus-visible {
  outline: none;
  color: var(--text);
  background: var(--panel-soft);
}

.rail-button:active {
  transform: scale(0.96);
}

.rail-button.active {
  color: var(--green);
  background: var(--green-soft);
}

.rail-button.active::before {
  content: "";
  position: absolute;
  left: -10px;
  width: 3px;
  height: 16px;
  border-radius: 999px;
  background: var(--green);
}

.rail-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-spacer {
  flex: 1;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 34px 14px 18px;
  background: var(--panel);
}

.sidebar-mode-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.sidebar-resize-handle {
  position: relative;
  background: transparent;
}

.sidebar-resize-handle::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background 120ms ease;
}

.sidebar-resize-handle:hover::before,
.sidebar-resize-handle:focus-visible::before,
body.is-resizing-sidebar .sidebar-resize-handle::before {
  background: rgba(var(--accent-rgb), 0.6);
}

.search-box {
  display: block;
  margin-bottom: 16px;
}

.search-box span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.search-box input {
  padding: 13px 14px;
}

.profile-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 0 6px 24px;
}

.sidebar-account {
  position: relative;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.profile-card-footer {
  width: 100%;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 10px 10px 10px 8px;
  color: var(--text);
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 55%),
    var(--panel-dark);
}

.profile-card-footer.is-typing {
  border-color: rgba(var(--accent-rgb), 0.2);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), transparent 64%),
    var(--panel-dark);
}

.sidebar-update-bar {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.26);
  border-radius: 16px;
  padding: 10px;
  background:
    radial-gradient(circle at 0% 0%, rgba(var(--accent-rgb), 0.22), transparent 44%),
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.12), rgba(255, 255, 255, 0.035)),
    var(--panel-dark);
  box-shadow: 0 18px 34px rgba(var(--accent-rgb), 0.12);
  animation: update-card-in var(--motion-medium) var(--ease-soft);
}

.sidebar-update-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 13px;
  color: rgb(var(--accent-rgb));
  background: rgba(var(--accent-rgb), 0.13);
}

.sidebar-update-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.sidebar-update-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

.sidebar-update-copy strong {
  color: rgb(var(--accent-rgb));
  font-size: 0.84rem;
}

.sidebar-update-copy span {
  color: var(--muted);
  font-size: 0.76rem;
}

.sidebar-update-action {
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 900;
  background: rgba(var(--accent-rgb), 0.18);
}

.sidebar-update-action:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(var(--accent-rgb), 0.28);
}

.sidebar-update-action:disabled {
  cursor: default;
  opacity: 0.72;
}

.sidebar-update-bar.is-ready {
  border-color: rgba(40, 220, 120, 0.38);
}

.sidebar-update-bar.is-error {
  border-color: rgba(255, 111, 129, 0.34);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 111, 129, 0.18), transparent 44%),
    var(--panel-dark);
}

.sidebar-call-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.12), transparent),
    rgba(255, 255, 255, 0.035);
}

.sidebar-call-status,
.sidebar-call-action {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.sidebar-call-status {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.sidebar-call-status::before,
.sidebar-call-status::after {
  position: absolute;
  left: 50%;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px) scale(0.96);
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.sidebar-call-status::before {
  content: attr(data-tooltip);
  bottom: calc(100% + 12px);
  min-width: 126px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), rgba(255, 255, 255, 0.035)),
    var(--popup);
  box-shadow: 0 16px 34px var(--shadow);
}

.sidebar-call-status::after {
  content: "";
  bottom: calc(100% + 6px);
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(var(--accent-rgb), 0.22);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.22);
  background: var(--popup);
  transform: translate(-50%, 6px) rotate(45deg) scale(0.96);
}

.sidebar-call-status:hover::before,
.sidebar-call-status:focus-visible::before,
.sidebar-call-status:hover::after,
.sidebar-call-status:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.sidebar-call-status:hover::after,
.sidebar-call-status:focus-visible::after {
  transform: translate(-50%, 0) rotate(45deg) scale(1);
}

.sidebar-call-dot {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.14);
}

.sidebar-call-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

.sidebar-call-copy strong {
  color: var(--green);
  font-size: 0.88rem;
}

.sidebar-call-copy span {
  color: var(--muted);
  font-size: 0.76rem;
}

.sidebar-call-action {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.sidebar-call-action:hover,
.sidebar-call-action.active {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.26);
  background: rgba(var(--accent-rgb), 0.1);
}

.sidebar-call-action.danger {
  color: #fff;
  border-color: rgba(255, 88, 104, 0.22);
  background: rgba(222, 61, 82, 0.22);
}

.sidebar-call-action svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-control-button .icon-slash,
.sidebar-call-action .icon-slash,
.call-participant-badge .icon-slash {
  stroke-width: 2.7;
}

.profile-avatar-stack-footer {
  width: 44px;
  height: 44px;
}

#currentProfilePresence {
  left: auto;
  right: -1px;
  bottom: -1px;
  width: 14px;
  height: 14px;
  border-width: 2px;
  border-color: var(--panel-dark);
}

#currentProfilePresence.typing {
  background: var(--green);
  animation: presence-typing-pulse 1.1s ease-in-out infinite;
}

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--avatar-text);
  font-weight: 900;
  letter-spacing: 0.03em;
  background: var(--avatar-bg);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow: none;
}

.avatar.has-image {
  color: transparent;
}

.avatar-media,
.banner-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.avatar-large {
  width: 78px;
  height: 78px;
}

.avatar-xl {
  width: 92px;
  height: 92px;
}

.avatar-xxl {
  width: 108px;
  height: 108px;
}

.self-profile-popup {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 24;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 60px var(--shadow);
}

.profile-banner {
  position: relative;
  overflow: hidden;
  min-height: 108px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 60%),
    var(--panel-soft);
}

.profile-popup-body,
.profile-preview-body {
  padding: 0 16px 16px;
}

.profile-popup-top,
.profile-preview-top {
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  gap: 6px;
  margin-top: -32px;
}

.profile-avatar-stack {
  position: relative;
  display: inline-flex;
}

.profile-popup-top .avatar,
.profile-preview-top .avatar,
.chat-profile-top .avatar,
.full-profile-top .avatar {
  border: 3px solid var(--panel);
}

.profile-presence {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 16px;
  height: 16px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--muted-dark);
}

.profile-presence.online {
  background: var(--green);
}

.profile-presence.idle {
  background: #f0b232;
}

.profile-presence.dnd {
  background: #ed4245;
}

.profile-presence.invisible,
.profile-presence.offline {
  background: var(--muted-dark);
}

.profile-status-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: flex-end;
  max-width: min(100%, 210px);
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 0 0 10px -4px;
  padding: 8px 14px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px);
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.35;
}

.profile-status-badge::before,
.profile-status-badge::after {
  content: "";
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
}

.profile-status-badge::before {
  left: -11px;
  bottom: 11px;
  width: 9px;
  height: 9px;
}

.profile-status-badge::after {
  left: -19px;
  bottom: 6px;
  width: 5px;
  height: 5px;
}

.profile-popup-copy,
.profile-preview-copy-block {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.profile-popup-copy h2,
.profile-preview-copy-block h4 {
  margin: 0;
  font-size: 1.2rem;
}

.profile-popup-copy p,
.profile-preview-copy-block p {
  margin: 0;
}

.profile-inline-copy {
  color: var(--muted);
  font-size: 0.84rem;
}

.profile-bio {
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.profile-activity-slot {
  margin-top: 14px;
}

.profile-activity-slot.is-hidden,
.spotify-preview-slot.is-hidden {
  display: none;
}

.spotify-activity-card {
  --spotify-art-size: 74px;
  display: grid;
  gap: 12px;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 20px;
  padding: 14px;
  color: var(--text);
  text-decoration: none;
  background:
    radial-gradient(circle at 12% 0%, rgba(var(--accent-rgb), 0.18), transparent 42%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.16);
}

.spotify-activity-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.spotify-mark {
  color: rgb(var(--accent-rgb));
}

.spotify-activity-body {
  display: grid;
  grid-template-columns: var(--spotify-art-size) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.spotify-activity-art {
  width: var(--spotify-art-size);
  height: var(--spotify-art-size);
  overflow: hidden;
  border-radius: 16px;
  background: rgba(var(--accent-rgb), 0.16);
}

.spotify-activity-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spotify-activity-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

#selfProfileActivity .spotify-activity-card {
  --spotify-art-size: 82px;
}

#chatProfileActivity .spotify-activity-card {
  --spotify-art-size: 94px;
}

#fullProfileActivity .spotify-activity-card {
  --spotify-art-size: 104px;
}

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

.spotify-activity-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.spotify-activity-progress {
  display: grid;
  grid-template-columns: auto minmax(48px, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.spotify-activity-progress i {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgb(var(--accent-rgb)), rgba(var(--accent-rgb), 0.62)) 0 / var(--spotify-progress, 0%) 100% no-repeat,
    rgba(255, 255, 255, 0.13);
}

.connection-card {
  display: grid;
  gap: 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.connection-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.connection-card-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.connection-badge {
  align-self: flex-start;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.connection-badge.connected,
.connection-badge.is-connected {
  color: rgb(var(--accent-rgb));
  background: rgba(var(--accent-rgb), 0.1);
}

.connection-service-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 18px;
  padding: 14px;
  color: var(--text);
  text-align: left;
  background:
    radial-gradient(circle at 8% 0%, rgba(var(--accent-rgb), 0.2), transparent 42%),
    rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: transform var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard);
}

.connection-service-button:hover,
.connection-service-button:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.34);
  background:
    radial-gradient(circle at 8% 0%, rgba(var(--accent-rgb), 0.28), transparent 46%),
    rgba(255, 255, 255, 0.055);
  transform: translateY(-1px);
}

.connection-service-button.connected {
  border-color: rgba(var(--accent-rgb), 0.28);
}

.connection-service-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 16px;
  color: #07120b;
  background: rgb(var(--accent-rgb));
  box-shadow: 0 14px 34px rgba(var(--accent-rgb), 0.22);
}

.connection-service-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.connection-service-button strong,
.connection-service-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-service-button small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.profile-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.profile-edit-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.015);
}

.profile-edit-button:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.24);
  background: rgba(var(--accent-rgb), 0.08);
  transform: translateY(-1px);
}

.profile-edit-button.subtle {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.profile-edit-button.subtle:hover {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.08);
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 12px;
  flex: 0 0 auto;
  opacity: 0.76;
  font-size: 0.82rem;
}

.button-icon-svg {
  width: 14px;
}

.button-icon-svg svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-presence-modes {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.presence-modes-heading {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.presence-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.presence-mode-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.02);
}

.presence-mode-button:hover,
.presence-mode-button.active {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.24);
  background: rgba(var(--accent-rgb), 0.08);
}

.presence-mode-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted-dark);
}

.presence-mode-dot.online {
  background: var(--green);
}

.presence-mode-dot.idle {
  background: #f0b232;
}

.presence-mode-dot.dnd {
  background: #ed4245;
}

.presence-mode-dot.invisible {
  background: var(--muted-dark);
}

.avatar-button {
  position: relative;
  cursor: pointer;
  border: 0;
  padding: 0;
}

.avatar-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(6, 8, 10, 0.22);
  opacity: 0;
  transition: opacity var(--motion-fast) var(--ease-standard);
}

.avatar-button:hover::after,
.avatar-button:focus-visible::after {
  opacity: 1;
}

.profile-card-avatar-button::before,
#activeAvatar::before {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background:
    rgba(18, 20, 24, 0.74)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v11a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 5 17.5Z'/%3E%3Ccircle cx='10' cy='10' r='2.2'/%3E%3Cpath d='M8 16.2c.5-1.55 1.72-2.45 3.05-2.45s2.55.9 3.05 2.45'/%3E%3C/svg%3E")
    center / 13px 13px no-repeat;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(2px);
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.profile-card-avatar-button:hover::before,
.profile-card-avatar-button:focus-visible::before,
#activeAvatar:hover::before,
#activeAvatar:focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

.profile-text {
  min-width: 0;
}

.profile-text h1,
.chat-header h2 {
  overflow: hidden;
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-text p,
.chat-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.profile-text p.current-typing-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(var(--accent-rgb), 0.95);
}

#currentProfilePresence.voice {
  background: transparent;
  border-color: rgba(var(--accent-rgb), 0.26);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.2);
}

#currentProfilePresence.voice::before,
#currentProfilePresence.voice::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid var(--green);
  border-radius: 999px;
  opacity: 0.5;
  animation: voice-presence-ripple 1.45s ease-out infinite;
}

#currentProfilePresence.voice::after {
  inset: 0;
  opacity: 0.24;
  animation-delay: 240ms;
}

.server-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 11px 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.server-row button {
  font-size: 0.78rem;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.connection-dot.online {
  background: var(--green);
}

.section-title {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 6px 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.friends-title {
  margin-top: 18px;
}

.friends-title.solo {
  margin-top: 22px;
}

.chat-list-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
}

.user-list {
  display: grid;
  gap: 2px;
  overflow: auto;
  overflow-x: hidden;
  max-height: 100%;
  padding-bottom: 64px;
}

.friend-sidebar-list {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 2px;
  min-height: 0;
  overflow: auto;
}

.user-button,
.friend-sidebar-button {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  padding: 10px 8px;
  color: var(--text);
  text-align: left;
  background: transparent;
}

.user-copy {
  min-width: 0;
}

.user-button:hover,
.user-button.active,
.friend-sidebar-button:hover {
  background: var(--panel-soft);
}

.user-button:hover,
.friend-sidebar-button:hover,
.theme-option:hover,
.language-option:hover,
.profile-card-footer:hover,
.friend-preview:hover {
  transform: translateY(-1px);
}

.user-name {
  overflow: hidden;
  margin: 0;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta {
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--muted-dark);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item-trailing {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 18px;
  min-height: 18px;
}

.chat-pin-indicator {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 9px;
  color: rgba(var(--accent-rgb), 0.88);
  background: rgba(var(--accent-rgb), 0.1);
}

.chat-pin-indicator svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  fill: none;
}

.chat-unread-dot {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.36), transparent 34%),
    rgb(var(--accent-rgb));
  box-shadow:
    0 0 0 3px rgba(var(--accent-rgb), 0.18),
    0 12px 24px rgba(var(--accent-rgb), 0.24);
}

.chat-unread-dot svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.keep-memo-avatar {
  color: #ffffff;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.2), transparent 48%),
    linear-gradient(160deg, color-mix(in srgb, var(--green) 88%, white 12%), color-mix(in srgb, var(--green) 72%, black 28%));
}

.keep-memo-avatar svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  fill: rgba(255, 255, 255, 0.14);
}

.new-chat-button {
  position: absolute;
  right: 12px;
  bottom: 18px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  color: #101112;
  background: var(--green);
  box-shadow: 0 14px 32px rgba(var(--accent-rgb), 0.32);
}

.new-chat-button:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 18px 38px rgba(var(--accent-rgb), 0.36);
}

.new-chat-button span {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-1px);
}

.new-chat-popover {
  position: absolute;
  right: 8px;
  bottom: 78px;
  z-index: 10;
  width: 252px;
  max-height: 330px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: var(--popup);
  box-shadow: 0 18px 50px var(--shadow);
}

.popover-title {
  margin: 2px 4px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.new-chat-friend-list {
  display: grid;
  gap: 4px;
  overflow: auto;
  max-height: 272px;
}

.chat-panel {
  min-width: 0;
  background: var(--bg);
}

.mobile-chat-back {
  display: none;
}

.empty-state {
  display: grid;
  height: 100%;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-art {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  background: transparent;
  animation: empty-float 7.2s ease-in-out infinite;
}

.empty-logo {
  width: 78px;
  height: 78px;
  opacity: var(--empty-logo-opacity);
  filter: var(--empty-logo-filter);
  background-size: 72px;
}

.empty-state p {
  max-width: 280px;
  margin: 0;
  color: var(--muted-dark);
  font-size: 0.9rem;
  line-height: 1.45;
}

.chat-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--titlebar-height));
  min-height: 0;
}

.chat-view.chat-view-side-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--chat-profile-side-width);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
}

.chat-view.chat-view-side-profile .chat-header {
  grid-column: 1;
  grid-row: 1;
}

.chat-view.chat-view-side-profile .chat-search-bar {
  grid-column: 1;
  grid-row: 2;
}

.chat-view.chat-view-side-profile .call-room-panel {
  grid-column: 1;
  grid-row: 3;
}

.chat-view.chat-view-side-profile .chat-body.profile-side {
  display: contents;
}

.chat-view.chat-view-side-profile .message-list {
  grid-column: 1;
  grid-row: 4;
}

.chat-view.chat-view-side-profile .typing-indicator {
  grid-column: 1;
  grid-row: 5;
}

.chat-view.chat-view-side-profile .composer {
  grid-column: 1;
  grid-row: 6;
}

.chat-view.chat-view-side-profile .chat-profile-sidebar {
  grid-column: 2;
  grid-row: 1 / 7;
  min-height: 0;
}

.chat-view.chat-view-side-profile .chat-profile-resize-handle {
  display: none !important;
}

.chat-view.chat-view-stacked-profile .chat-header {
  display: none;
}

.chat-view.call-room-visible > .chat-header {
  display: none;
}

.chat-view.call-room-visible .chat-body.profile-stacked {
  grid-template-rows: minmax(0, 1fr);
}

.chat-view.call-room-visible .chat-body.profile-stacked .chat-profile-sidebar,
.chat-view.call-room-visible .chat-body.profile-stacked .chat-profile-resize-handle {
  display: none;
}

.chat-view.call-room-visible .chat-body.profile-stacked .message-list {
  grid-row: 1;
}

.settings-view {
  overflow: auto;
  height: calc(100vh - var(--titlebar-height));
  padding: 34px;
}

.settings-header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  padding-bottom: 18px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-header h2,
.settings-card h3 {
  margin: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  max-width: 980px;
}

.appearance-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 12px 0 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
}

.appearance-toggle-copy {
  display: grid;
  gap: 4px;
}

.appearance-toggle-copy strong {
  font-size: 0.9rem;
}

.appearance-toggle-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.appearance-switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.appearance-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.appearance-switch-track {
  position: relative;
  display: inline-flex;
  width: 50px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}

.appearance-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
  transition:
    transform var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard);
}

.appearance-switch input:checked + .appearance-switch-track {
  border-color: rgba(var(--accent-rgb), 0.72);
  background: rgba(var(--accent-rgb), 0.92);
}

.appearance-switch input:checked + .appearance-switch-track::after {
  transform: translateX(20px);
}

.appearance-switch input:focus-visible + .appearance-switch-track {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

.settings-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 20px;
  max-width: 1260px;
}

.settings-menu {
  position: sticky;
  top: 24px;
  display: grid;
  align-content: start;
  gap: 8px;
  height: max-content;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: var(--panel);
}

.settings-menu button {
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--muted);
  text-align: left;
  background: transparent;
}

.settings-menu button.active,
.settings-menu button:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.settings-content {
  min-width: 0;
}

.settings-panel {
  min-width: 0;
}

.profile-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 392px);
  gap: 18px;
  max-width: 1240px;
  align-items: start;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: var(--panel);
}

.settings-card:hover {
  transform: translateY(-1px);
}

.settings-copy {
  margin: 8px 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.updates-settings-card {
  display: grid;
  gap: 14px;
  max-width: 620px;
  overflow: hidden;
}

.updates-settings-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}

.updates-version-card {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 14px;
  padding: 14px 16px;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), transparent 76%),
    rgba(255, 255, 255, 0.025);
}

.updates-version-card span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.updates-version-card strong {
  color: var(--text);
  font-size: 1.05rem;
}

.connection-badge.is-error {
  border-color: rgba(255, 111, 129, 0.26);
  color: var(--danger);
  background: rgba(255, 111, 129, 0.08);
}

.settings-copy code {
  color: var(--text);
}

.settings-field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.settings-field input,
.settings-field select,
.settings-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px;
  color: var(--text);
  background: var(--input);
  outline: none;
}

.settings-field textarea {
  min-height: 108px;
  font-family: var(--font);
  line-height: 1.55;
  resize: vertical;
}

.settings-field input:focus,
.settings-field select:focus,
.settings-field textarea:focus {
  border-color: rgba(var(--accent-rgb), 0.58);
}

.compact-field {
  margin-top: 0;
}

.compact-copy {
  margin: 4px 0 0;
}

.device-picker {
  position: relative;
}

.device-picker-trigger {
  position: relative;
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 12px 42px 12px 14px;
  color: var(--text);
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 72%),
    var(--input);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.device-picker-trigger::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--muted);
  transform: translateY(-65%) rotate(45deg);
  transition: transform var(--motion-fast) var(--ease-standard);
}

.device-picker-trigger:hover,
.device-picker-trigger.is-open {
  border-color: rgba(var(--accent-rgb), 0.34);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), transparent 72%),
    var(--input);
}

.device-picker-trigger.is-open::after {
  transform: translateY(-35%) rotate(225deg);
}

.device-picker-trigger.is-disabled {
  opacity: 0.62;
}

.device-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 12;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 18px;
  padding: 8px;
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.14), transparent 36%),
    var(--popup);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}

.device-picker-option {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
}

.device-picker-option:hover,
.device-picker-option.is-selected {
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.1);
}

.device-test-card {
  margin-top: 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 18px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 74%),
    rgba(255, 255, 255, 0.02);
}

.device-test-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.device-test-head strong {
  color: var(--text);
  font-size: 0.9rem;
}

.device-meter-shell {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  min-height: 54px;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(var(--accent-rgb), 0.06);
}

.device-meter-wave {
  display: flex;
  align-items: flex-end;
  flex: 1 1 auto;
  gap: 4px;
  height: 28px;
}

.device-meter-wave .voice-wave-bar {
  background: rgba(var(--accent-rgb), 0.22);
}

.device-test-status {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.compact-button {
  width: auto;
}

.inline-action-row,
.media-action-row,
.profile-save-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.inline-action-row > :first-child {
  flex: 1 1 220px;
}

.inline-action-row > *,
.media-action-row > *,
.profile-save-row > * {
  min-width: 0;
}

.media-action-row {
  margin-top: 6px;
}

.inline-action-row > .compact-button,
.media-action-row > .compact-button,
.profile-save-row > .compact-button {
  min-height: 40px;
}

.profile-save-row .compact-button {
  min-width: 170px;
}

.profile-save-row {
  margin-top: 18px;
  align-items: flex-start;
}

.settings-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.profile-save-row .form-message {
  min-height: 0;
  margin: 0;
}

.field-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.profile-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.color-picker-shell {
  position: relative;
}

.color-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.selection-shell {
  position: relative;
}

.selection-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px;
  color: var(--text);
  background: var(--input);
}

.selection-button:hover,
.selection-button:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.5);
}

.selection-chevron {
  width: 10px;
  height: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.78;
}

.selection-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 18;
  width: 100%;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: var(--popup);
  box-shadow: 0 18px 50px var(--shadow);
}

.selection-option {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
}

.selection-option:hover,
.selection-option.active {
  background: var(--panel-soft);
}

.color-swatch {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: #1d2b22;
}

.color-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 15;
  width: min(260px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--popup);
  box-shadow: 0 18px 50px var(--shadow);
}

.color-popover input[type="color"] {
  min-height: 44px;
  padding: 6px;
}

.profile-preview-card {
  position: sticky;
  top: 24px;
  height: max-content;
  justify-self: start;
  width: 100%;
}

.profile-preview-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-top: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%),
    var(--panel-dark);
}

.profile-banner-preview {
  min-height: 126px;
}

.profile-preview-card h3 {
  margin-bottom: 4px;
}

.profile-preview-avatar-button {
  position: relative;
  border: 3px solid var(--panel);
  padding: 0;
  background-color: transparent;
}

.profile-preview-avatar-button::after {
  content: "✎";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 1rem;
  background: rgba(6, 8, 10, 0.34);
  opacity: 0;
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard);
}

.profile-preview-avatar-button:hover::after,
.profile-preview-avatar-button:focus-visible::after {
  opacity: 1;
}

.profile-preview-copy-block h4 {
  font-size: 1.08rem;
}

.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 44;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 4, 6, 0.52);
  backdrop-filter: blur(6px);
}

.editor-dialog {
  width: min(460px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  background:
    radial-gradient(circle at 20% 0%, rgba(var(--accent-rgb), 0.14), transparent 36%),
    var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.full-profile-dialog {
  width: min(720px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: hidden;
}

.full-profile-shell {
  overflow: auto;
  max-height: calc(100vh - 48px);
}

.full-profile-banner {
  min-height: 220px;
}

.full-profile-body {
  padding: 0 22px 24px;
}

.full-profile-top {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: -44px;
}

.full-profile-top .profile-status-badge {
  margin-bottom: 18px;
}

.full-profile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-top: 18px;
}

.full-profile-title-block h2 {
  margin: 0;
  font-size: 1.8rem;
}

.full-profile-title-block p {
  margin: 8px 0 0;
  color: var(--muted);
}

.full-profile-head-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.full-profile-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.full-profile-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  color: var(--muted);
  font-size: 0.84rem;
  background: rgba(255, 255, 255, 0.02);
}

.full-profile-section {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 66%),
    var(--panel-dark);
}

.full-profile-section h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.full-profile-bio {
  min-height: 42px;
}

.full-profile-placeholder {
  display: grid;
  gap: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.full-profile-placeholder strong {
  color: var(--text);
}

.media-editor-dialog {
  width: min(720px, calc(100vw - 48px));
}

.media-editor-stage {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-top: 18px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%),
    var(--panel-dark);
}

.media-editor-stage.is-avatar {
  min-height: 360px;
}

.media-editor-stage.is-banner {
  min-height: 320px;
}

.media-editor-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  background:
    radial-gradient(circle at 18px 18px, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 18px 18px,
    var(--panel-soft);
  cursor: grab;
  touch-action: none;
}

.media-editor-frame.dragging {
  cursor: grabbing;
}

.media-editor-frame.is-avatar {
  width: min(320px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
}

.media-editor-frame.is-banner {
  width: min(560px, 100%);
  aspect-ratio: 5 / 2;
  border-radius: 24px;
}

.media-editor-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.media-editor-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.media-editor-mask.is-avatar {
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 0 0 999px rgba(0, 0, 0, 0.08);
}

.media-editor-mask.is-banner {
  border-radius: 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.media-editor-range {
  margin: 18px 0 0;
}

.media-editor-actions {
  margin-top: 18px;
}

.subheading {
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.request-list {
  display: grid;
  gap: 8px;
}

.request-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--panel-dark);
}

.request-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mini-button {
  border: 0;
  border-radius: 999px;
  min-width: 88px;
  padding: 8px 13px;
  color: var(--self-text);
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--green);
}

.mini-button.ghost {
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
}

.mini-button.ghost:hover {
  color: var(--text);
  background: var(--panel-soft);
}

.qr-box {
  display: grid;
  min-height: 190px;
  place-items: center;
  border-radius: 12px;
  margin-bottom: 14px;
  padding: 14px;
  background: #fff;
}

.qr-box svg {
  width: min(190px, 100%);
  height: auto;
}

.code-row,
.add-friend-form {
  display: grid;
  gap: 10px;
}

.code-row {
  grid-template-columns: 1fr auto;
  margin-bottom: 10px;
}

.code-row input,
.add-friend-form input {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--text);
  background: var(--input);
  outline: none;
}

.code-row button {
  border: 0;
  border-radius: var(--radius);
  padding: 0 14px;
  color: #101112;
  font-weight: 800;
  background: var(--green);
}

.friend-preview {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--panel-dark);
}

.friend-preview {
  margin-top: 12px;
}

.friend-preview h4 {
  margin: 0;
}

.friend-preview p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.friend-preview-text,
.request-row > span:nth-child(2) {
  min-width: 0;
}

.friend-preview-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.friend-preview-actions .primary-button,
.friend-preview-actions .secondary-button {
  width: auto;
}

.theme-options,
.language-options {
  display: grid;
  gap: 10px;
}

.theme-options {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.theme-option,
.language-option {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  color: var(--text);
  text-align: left;
  background: var(--panel-dark);
}

.theme-option:hover,
.theme-option.active,
.language-option:hover,
.language-option.active {
  border-color: rgba(var(--accent-rgb), 0.62);
  background: var(--green-soft);
}

.theme-option span:not(.theme-preview):not(.theme-preview-sidebar):not(.theme-preview-chat):not(.theme-preview-bubble),
.language-option span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.theme-preview {
  display: grid;
  grid-template-columns: 34% 1fr;
  overflow: hidden;
  height: 74px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.theme-preview-sidebar,
.theme-preview-chat {
  display: block;
}

.theme-preview-chat {
  position: relative;
}

.theme-preview-bubble {
  position: absolute;
  right: 10px;
  bottom: 12px;
  display: block;
  width: 44px;
  height: 18px;
  border-radius: 999px;
  background: var(--green);
}

.theme-preview-dark .theme-preview-bubble,
.theme-preview-light .theme-preview-bubble,
.theme-preview-oled .theme-preview-bubble {
  background: #06c755;
}

.theme-preview-dark .theme-preview-sidebar {
  background: #303133;
}

.theme-preview-dark .theme-preview-chat {
  background: #242527;
}

.theme-preview-light .theme-preview-sidebar {
  background: #ffffff;
}

.theme-preview-light .theme-preview-chat {
  background: #eef2ef;
}

.theme-preview-oled .theme-preview-sidebar {
  background: #050505;
}

.theme-preview-oled .theme-preview-chat {
  background: #000000;
}

.theme-preview-sakura .theme-preview-sidebar {
  background: #fff0f5;
}

.theme-preview-sakura .theme-preview-chat {
  background: #fff7fb;
}

.theme-preview-sakura .theme-preview-bubble {
  background: #ff8fb3;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr minmax(130px, 220px) 52px;
  gap: 12px;
  align-items: center;
  margin: 14px 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.range-row input {
  accent-color: var(--green);
}

.range-row span {
  color: var(--text);
  font-weight: 800;
  text-align: right;
}

.chat-preview {
  display: grid;
  gap: var(--message-gap);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 18px;
  padding: var(--message-list-padding);
  background:
    radial-gradient(circle at 12px 12px, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 18px 18px,
    var(--panel-dark);
}

.preview-bubble {
  width: fit-content;
  max-width: 82%;
  border-radius: 18px;
  padding: var(--bubble-padding-y) var(--bubble-padding-x);
  font-size: var(--message-font-size);
  line-height: 1.38;
}

.preview-bubble.them {
  color: var(--text);
  background: var(--bubble);
}

.preview-bubble.me {
  justify-self: end;
  color: var(--self-text);
  background: var(--green);
}

.context-menu {
  position: fixed;
  z-index: 20;
  min-width: 220px;
  max-width: min(356px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.14), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 72%),
    var(--popup);
  box-shadow: 0 18px 50px var(--shadow);
  backdrop-filter: blur(12px);
}

.context-menu::-webkit-scrollbar {
  display: none;
}

.context-menu-actions {
  display: grid;
  gap: 2px;
}

.context-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 11px 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
}

.context-menu button .icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: inherit;
  flex: 0 0 auto;
}

.context-menu button .icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.context-menu button .label {
  min-width: 0;
  font-size: 0.84rem;
  font-weight: 700;
}

.context-menu button:hover {
  background: var(--panel-soft);
  transform: translateY(-1px);
}

.context-menu .danger {
  color: var(--danger);
}

.context-reaction-panel {
  display: grid;
  gap: 8px;
  padding: 2px 2px 8px;
  overflow: visible;
}

.context-reaction-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 4px 2px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.context-reaction-strip::-webkit-scrollbar,
.context-reaction-grid::-webkit-scrollbar,
.context-reaction-groups::-webkit-scrollbar {
  display: none;
}

.context-reaction-button {
  display: inline-grid !important;
  place-items: center;
  overflow: visible;
  width: 46px !important;
  min-width: 46px;
  height: 46px;
  padding: 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  font-size: 1.55rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.04) !important;
}

.context-reaction-button:hover {
  background: rgba(var(--accent-rgb), 0.12) !important;
  transform: none !important;
}

.context-reaction-button-more svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.context-reaction-picker {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.context-reaction-groups {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  padding: 2px 0;
}

.context-reaction-group {
  display: inline-grid !important;
  place-items: center;
  overflow: visible;
  width: 36px !important;
  min-width: 36px;
  height: 36px;
  padding: 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.03) !important;
}

.context-reaction-group.active,
.context-reaction-group:hover {
  background: rgba(var(--accent-rgb), 0.12) !important;
  border-color: rgba(var(--accent-rgb), 0.24) !important;
}

.context-reaction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 8px;
  max-height: 228px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: none;
}

.context-reaction-emoji {
  display: inline-grid !important;
  place-items: center;
  overflow: visible;
  width: 100% !important;
  min-height: 38px;
  padding: 0 !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  font-size: 1.35rem;
  background: rgba(255, 255, 255, 0.03) !important;
}

.context-reaction-emoji:hover,
.context-reaction-emoji:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.24) !important;
  background: rgba(var(--accent-rgb), 0.12) !important;
  transform: none !important;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 4, 6, 0.58);
  backdrop-filter: blur(6px);
}

.confirm-dialog {
  width: min(420px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 22px 18px;
  background:
    radial-gradient(circle at 20% 0%, rgba(var(--accent-rgb), 0.14), transparent 36%),
    var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.confirm-dialog h2 {
  margin: 0 0 8px;
}

.confirm-dialog .settings-copy {
  margin: 0 0 18px;
}

.delete-scope-dialog {
  width: min(448px, calc(100vw - 48px));
}

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

.delete-scope-actions .secondary-button,
.delete-scope-actions .primary-button {
  width: 100%;
}

.forward-dialog {
  width: min(520px, calc(100vw - 48px));
}

.forward-dialog-preview {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), transparent 72%),
    var(--panel-soft);
}

.forward-dialog-list {
  display: grid;
  gap: 10px;
  max-height: min(46vh, 380px);
  overflow: auto;
  padding-right: 4px;
}

.forward-dialog-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.forward-dialog-target {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 12px 14px;
  color: inherit;
  background: var(--panel-soft);
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}

.forward-dialog-target:hover,
.forward-dialog-target:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.18);
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.12);
}

.forward-dialog-target.is-selected {
  border-color: rgba(var(--accent-rgb), 0.32);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.14), rgba(var(--accent-rgb), 0.04)),
    var(--panel-soft);
}

.forward-dialog-target-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.forward-dialog-target-name {
  overflow: hidden;
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forward-dialog-target-meta {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forward-dialog-target-check {
  position: relative;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1.5px solid rgba(var(--accent-rgb), 0.34);
  border-radius: 999px;
  background: transparent;
}

.forward-dialog-target-check::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: rgb(var(--accent-rgb));
  transform: scale(0.2);
  opacity: 0;
  transition:
    transform var(--motion-fast) var(--ease-soft),
    opacity var(--motion-fast) var(--ease-soft);
}

.forward-dialog-target.is-selected .forward-dialog-target-check::after {
  transform: scale(1);
  opacity: 1;
}

.forward-dialog-actions {
  margin-top: 16px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.confirm-actions .primary-button,
.confirm-actions .secondary-button {
  width: auto;
  min-width: 116px;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 70;
  min-width: 180px;
  max-width: min(88vw, 360px);
  padding: 12px 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 999px;
  color: var(--text);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-rgb), 0.08)),
    var(--panel);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 18px) scale(0.96);
}

.app-toast.is-visible {
  animation: toast-enter 320ms var(--ease-soft) forwards;
}

.app-toast.is-leaving {
  animation: toast-exit 240ms var(--ease-standard) forwards;
}

.editor-dialog .confirm-actions {
  margin-top: 18px;
}

.danger-button {
  color: #fff;
  background: #d85b5b;
}

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

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

.chat-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-header-button,
.chat-search-mini {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.chat-header-button:hover,
.chat-header-button.active,
.chat-search-mini:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.22);
  background: rgba(var(--accent-rgb), 0.1);
  transform: translateY(-1px);
}

.chat-header-button svg,
.chat-search-icon,
.chat-search-mini svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-room-panel {
  position: relative;
  display: grid;
  align-content: center;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
  height: var(--call-room-height);
  min-height: 372px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  padding: 26px 18px 30px;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.16), transparent 48%),
    rgba(255, 255, 255, 0.012);
}

.call-room-stage {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.call-room-participants {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(76px, 10vw, 156px);
  min-height: 224px;
}

.call-participant {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: 172px;
  --voice-level: 0;
}

.call-voice-waveform {
  position: absolute;
  top: 72px;
  left: 50%;
  z-index: 0;
  width: 196px;
  height: 196px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  filter:
    drop-shadow(0 0 12px rgba(var(--accent-rgb), calc(var(--voice-level) * 0.36)))
    drop-shadow(0 0 20px rgba(var(--accent-rgb), calc(var(--voice-level) * 0.22)));
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    filter var(--motion-fast) var(--ease-standard);
}

.call-voice-waveform span {
  --wave-height: calc(7px + var(--voice-level) * (19px + var(--shape) * 1.7px));
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: var(--wave-height);
  border-radius: 999px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, calc(0.34 + var(--voice-level) * 0.2)),
      rgba(var(--accent-rgb), calc(0.68 + var(--voice-level) * 0.3)) 34%,
      rgba(var(--accent-rgb), calc(0.24 + var(--voice-level) * 0.34)) 74%,
      transparent
    );
  transform-origin: 50% 50%;
  transform:
    translate(-50%, -50%)
    rotate(var(--a))
    translateY(calc(-78px - var(--voice-level) * 5px))
    scaleY(calc(0.42 + var(--voice-level) * 0.58));
  animation: call-wave-ring 1850ms ease-in-out infinite;
  animation-delay: calc(var(--phase) * -190ms);
}

.call-voice-waveform span:nth-child(3n) {
  width: 5px;
  height: calc(6px + var(--voice-level) * 18px);
}

.call-voice-waveform span:nth-child(4n) {
  width: 8px;
  height: calc(9px + var(--voice-level) * 29px);
}

body[data-theme="sakura"] .call-voice-waveform span {
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, calc(0.38 + var(--voice-level) * 0.2)),
      rgba(var(--accent-rgb), calc(0.74 + var(--voice-level) * 0.24)) 35%,
      rgba(202, 94, 149, calc(0.26 + var(--voice-level) * 0.36)) 76%,
      transparent
    );
}

body[data-theme="oled"] .call-voice-waveform span {
  background:
    linear-gradient(
      180deg,
      rgba(232, 255, 240, calc(0.34 + var(--voice-level) * 0.22)),
      rgba(var(--accent-rgb), calc(0.72 + var(--voice-level) * 0.28)) 36%,
      rgba(13, 255, 132, calc(0.2 + var(--voice-level) * 0.34)) 74%,
      transparent
    );
}

.call-participant.is-speaking .call-voice-waveform {
  opacity: 1;
}

.call-participant.is-speaking .avatar {
  border-color: rgba(var(--accent-rgb), calc(0.44 + var(--voice-level) * 0.42));
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.25),
    0 0 0 2px rgba(var(--accent-rgb), calc(var(--voice-level) * 0.2));
}

.call-participant.is-muted .call-voice-waveform,
.call-participant.is-deafened .call-voice-waveform {
  opacity: 0;
}

.call-participant.is-muted .avatar,
.call-participant.is-deafened .avatar {
  border-color: rgba(255, 111, 129, 0.72);
  filter: saturate(0.58) brightness(0.8);
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.3),
    0 0 0 3px rgba(255, 111, 129, 0.22);
}

.call-participant.is-deafened .avatar {
  border-color: rgba(255, 185, 92, 0.82);
  filter: saturate(0.42) brightness(0.68);
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.34),
    0 0 0 3px rgba(255, 185, 92, 0.24);
}

.call-participant.is-muted::before,
.call-participant.is-deafened::before,
.call-participant.is-muted::after,
.call-participant.is-deafened::after {
  content: "";
  position: absolute;
  top: 72px;
  left: 50%;
  pointer-events: none;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.call-participant.is-muted::before,
.call-participant.is-deafened::before {
  z-index: 2;
  width: 164px;
  height: 164px;
  border: 3px dashed rgba(255, 111, 129, 0.62);
  box-shadow: 0 0 28px rgba(255, 111, 129, 0.16);
}

.call-participant.is-deafened::before {
  border-color: rgba(255, 185, 92, 0.72);
  box-shadow: 0 0 30px rgba(255, 185, 92, 0.18);
}

.call-participant.is-muted::after,
.call-participant.is-deafened::after {
  z-index: 3;
  width: 172px;
  height: 172px;
  background:
    linear-gradient(135deg, transparent 47%, rgba(255, 111, 129, 0.95) 48.4%, rgba(255, 111, 129, 0.95) 51.6%, transparent 53%);
  filter: drop-shadow(0 8px 18px rgba(255, 111, 129, 0.28));
}

.call-participant.is-deafened::after {
  background:
    linear-gradient(135deg, transparent 46.8%, rgba(255, 185, 92, 0.95) 48.2%, rgba(255, 185, 92, 0.95) 51.8%, transparent 53.2%),
    linear-gradient(45deg, transparent 46.8%, rgba(255, 185, 92, 0.85) 48.4%, rgba(255, 185, 92, 0.85) 51.6%, transparent 53.2%);
  filter: drop-shadow(0 8px 18px rgba(255, 185, 92, 0.28));
}

.call-participant .avatar {
  position: relative;
  z-index: 1;
  width: 144px;
  height: 144px;
  border: 2px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 50%;
  overflow: hidden;
  clip-path: circle(50% at 50% 50%);
  background-clip: padding-box;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.25);
  contain: paint;
  transform: translateZ(0);
}

.call-participant .avatar .avatar-media {
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
}

.call-room-participants.has-screen-share {
  width: 100%;
  max-width: 100%;
  gap: clamp(14px, 3vw, 42px);
  overflow: visible;
}

.call-room-participants.has-screen-expanded {
  position: relative;
  display: grid;
  place-items: center;
  min-height: max(190px, calc(var(--call-room-height) - 132px));
  overflow: visible;
}

.call-participant.is-screen-sharing {
  min-width: 0;
  width: min(560px, calc((var(--call-room-height) - 148px) * 1.78), 72%);
  max-width: 100%;
}

.call-participant.is-screen-expanded {
  width: min(100%, 1180px);
  min-width: 0;
  gap: 8px;
}

.call-participant.is-screen-sharing::before,
.call-participant.is-screen-sharing::after {
  display: none;
}

.call-participant.is-screen-sharing > .avatar {
  display: none;
}

.call-room-participants.has-screen-expanded .call-participant:not(.is-screen-expanded) {
  position: absolute;
  right: clamp(12px, 2vw, 26px);
  bottom: clamp(4px, 1vw, 14px);
  z-index: 5;
  min-width: 86px;
  gap: 6px;
  transform: scale(0.72);
  transform-origin: right bottom;
}

.call-room-participants.has-screen-expanded .call-participant:not(.is-screen-expanded).is-screen-sharing .call-screen-tile {
  display: none;
}

.call-room-participants.has-screen-expanded .call-participant:not(.is-screen-expanded).is-screen-sharing > .avatar {
  display: block;
}

.call-room-participants.has-screen-expanded .call-participant:not(.is-screen-expanded).is-local {
  right: auto;
  left: clamp(12px, 2vw, 26px);
  transform-origin: left bottom;
}

.call-room-participants.has-screen-expanded .call-participant.is-screen-expanded .call-participant-name {
  display: none;
}

.call-room-participants.has-screen-expanded .call-participant:not(.is-screen-expanded) .call-voice-waveform {
  display: none;
}

.call-room-participants.has-screen-expanded .call-participant:not(.is-screen-expanded) > .avatar {
  width: 96px;
  height: 96px;
}

.call-room-participants.has-screen-expanded .call-participant:not(.is-screen-expanded) .call-participant-name {
  max-width: 118px;
  color: rgba(255, 255, 255, 0.72);
}

.call-screen-tile {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  max-width: 100%;
  max-height: max(120px, calc(var(--call-room-height) - 148px));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 18px;
  background: #050608;
  box-shadow:
    0 24px 54px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.call-participant.is-screen-expanded .call-screen-tile {
  width: min(100%, calc((var(--call-room-height) - 144px) * 1.78));
  max-width: calc(100vw - 96px);
  max-height: max(180px, calc(var(--call-room-height) - 144px));
  margin-inline: auto;
}

.call-screen-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050608;
}

.call-participant .call-screen-avatar {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  width: 42px;
  height: 42px;
  clip-path: circle(50% at 50% 50%);
  border: 2px solid rgba(255, 255, 255, 0.74);
  border-radius: 50%;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.38);
}

.call-participant.is-screen-available .call-screen-avatar {
  display: none;
}

.call-participant.is-screen-sharing .call-voice-waveform {
  display: none;
}

.call-screen-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: inline-flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.call-screen-tile:hover .call-screen-actions,
.call-screen-tile:focus-within .call-screen-actions {
  opacity: 1;
  transform: translateY(0);
}

.call-participant.is-screen-available .call-screen-actions {
  opacity: 1;
  transform: none;
}

.call-screen-action {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  color: #fff;
  background: rgba(8, 10, 14, 0.76);
  backdrop-filter: blur(10px);
}

.call-screen-action:hover {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: rgba(var(--accent-rgb), 0.34);
}

.call-screen-stop {
  border-color: rgba(255, 88, 104, 0.34);
  background: rgba(222, 61, 82, 0.74);
}

.call-screen-stop:hover {
  border-color: rgba(255, 130, 144, 0.6);
  background: rgba(222, 61, 82, 0.92);
}

.call-screen-action svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-screen-gate {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  grid-template-rows: auto auto auto;
  gap: 11px;
  padding: 18px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(var(--accent-rgb), 0.2), transparent 34%),
    rgba(4, 6, 8, 0.88);
}

.call-participant .call-screen-gate-avatar {
  position: static;
  width: 64px;
  height: 64px;
  clip-path: circle(50% at 50% 50%);
  border: 2px solid rgba(var(--accent-rgb), 0.42);
  border-radius: 50%;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.34),
    0 0 0 5px rgba(var(--accent-rgb), 0.08);
}

.call-screen-gate-title {
  max-width: min(260px, 80%);
  overflow: hidden;
  color: #fff;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-screen-watch-button {
  width: auto;
  min-width: 128px;
  margin: 0;
  border-radius: 12px;
}

.call-screen-tile:fullscreen {
  display: grid;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
}

.call-screen-tile:fullscreen .call-screen-video {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
}

.call-screen-tile:fullscreen .call-screen-actions {
  top: 18px;
  right: 18px;
  opacity: 1;
  transform: none;
}

.call-screen-tile:fullscreen .call-screen-avatar {
  left: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
}

.call-participant.is-ringing .avatar {
  animation: call-avatar-ring 1.28s var(--ease-soft) infinite;
}

.call-participant.just-joined .avatar {
  animation: call-avatar-join 620ms var(--ease-soft);
}

.call-participant-name {
  max-width: 168px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-participant-badges {
  position: absolute;
  top: 100px;
  right: 8px;
  bottom: auto;
  z-index: 4;
  display: inline-flex;
  gap: 4px;
}

.call-participant-badge {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: #fff;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22), transparent 46%),
    rgba(10, 12, 14, 0.9);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.32),
    0 0 0 3px rgba(255, 111, 129, 0.18);
}

.call-participant.is-deafened .call-participant-badge {
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.32),
    0 0 0 3px rgba(255, 185, 92, 0.2);
}

.call-participant-badge svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-room-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.call-room-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.call-room-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  height: 18px;
  cursor: row-resize;
  touch-action: none;
}

.call-room-resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 5px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.26);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 8px 24px rgba(var(--accent-rgb), 0.18);
  transform: translate(-50%, -50%);
  transition:
    width var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}

.call-room-resize-handle:hover::before,
.call-room-resize-handle:focus-visible::before,
body.is-resizing-call-room .call-room-resize-handle::before {
  width: 92px;
  background: rgba(var(--accent-rgb), 0.52);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 10px 30px rgba(var(--accent-rgb), 0.32);
}

body.is-resizing-call-room {
  cursor: row-resize;
  user-select: none;
}

.call-control-button {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.call-control-button:hover,
.call-control-button.active {
  border-color: rgba(var(--accent-rgb), 0.32);
  background: rgba(var(--accent-rgb), 0.14);
  transform: translateY(-1px);
}

.call-control-button.is-streaming {
  border-color: rgba(255, 88, 104, 0.34);
  background: rgba(222, 61, 82, 0.2);
}

.call-control-button.is-streaming:hover {
  border-color: rgba(255, 130, 144, 0.58);
  background: rgba(222, 61, 82, 0.34);
}

.call-control-button.danger {
  border-color: rgba(255, 88, 104, 0.22);
  background: #de3d52;
}

.call-control-button.accept {
  border-color: rgba(37, 211, 102, 0.22);
  background: #1fb764;
}

.call-control-button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.incoming-call-dialog {
  width: min(360px, calc(100vw - 48px));
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  color: var(--text);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.18), transparent 58%),
    var(--panel);
  box-shadow: var(--shadow);
}

.incoming-call-dialog .avatar {
  animation: call-avatar-ring 1.2s var(--ease-soft) infinite;
}

.incoming-call-dialog h2 {
  margin: 0;
  font-size: 1.24rem;
}

.incoming-call-actions {
  display: flex;
  gap: 14px;
  margin-top: 6px;
}

.screen-share-dialog {
  display: grid;
  width: min(920px, calc(100vw - 44px));
  max-height: min(760px, calc(100vh - 48px));
  grid-template-rows: auto auto minmax(180px, 1fr) auto auto;
  gap: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  color: var(--text);
  background:
    radial-gradient(circle at 22% 0%, rgba(var(--accent-rgb), 0.18), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow);
}

.screen-share-head,
.screen-share-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.screen-share-head h2 {
  margin: 2px 0 0;
  font-size: 1.38rem;
}

.screen-share-tabs {
  display: flex;
  gap: 10px;
}

.screen-share-tabs .pill-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--muted);
  font-weight: 900;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: none;
}

.screen-share-tabs .pill-button:hover,
.screen-share-tabs .pill-button.active {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.46);
  background: rgba(var(--accent-rgb), 0.14);
  transform: translateY(-1px);
}

.screen-share-head .icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
}

.screen-share-head .icon-button:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.36);
  background: rgba(var(--accent-rgb), 0.12);
}

.screen-share-head .icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screen-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 2px 2px 6px;
}

.screen-source-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
}

.screen-source-card:hover,
.screen-source-card.active {
  border-color: rgba(var(--accent-rgb), 0.54);
  background: rgba(var(--accent-rgb), 0.12);
  transform: translateY(-1px);
}

.screen-source-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.42);
}

.screen-source-title {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-share-empty {
  align-self: center;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.screen-share-options {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 14px;
}

.screen-option-group {
  display: grid;
  gap: 8px;
}

.screen-option-group > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.segmented-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented-button {
  min-width: 58px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  color: var(--muted);
  font-weight: 900;
  background: rgba(255, 255, 255, 0.04);
}

.segmented-button:hover,
.segmented-button.active {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.48);
  background: rgba(var(--accent-rgb), 0.14);
}

.call-volume-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  gap: 12px;
  width: 220px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 94%, #000 6%);
  box-shadow: var(--shadow);
}

.call-volume-row {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.call-volume-row input {
  width: 100%;
  accent-color: rgb(var(--accent-rgb));
}

.chat-search-bar {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px 14px;
  background: rgba(255, 255, 255, 0.012);
}

.chat-search-field {
  position: relative;
  display: block;
}

.chat-search-field input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 14px 11px 42px;
  color: var(--text);
  background: var(--input);
  outline: none;
}

.chat-search-field input:focus {
  border-color: rgba(var(--accent-rgb), 0.58);
}

.chat-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  color: var(--muted);
  transform: translateY(-50%);
}

.chat-search-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-search-meta {
  min-width: 64px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.chat-body {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.chat-body.profile-side {
  grid-template-columns: minmax(0, 1fr) var(--chat-profile-side-width);
  grid-template-rows: minmax(0, 1fr);
}

.chat-body.profile-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.chat-body.profile-stacked {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(210px, var(--chat-profile-stacked-height)) 10px minmax(0, 1fr);
}

.chat-body.profile-overlay {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.chat-profile-sidebar {
  display: flex;
  min-width: 0;
  width: 100%;
  border-left: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 58%),
    var(--panel);
}

.chat-profile-card {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  height: 100%;
  overflow: auto;
}

.chat-profile-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: none;
}

.chat-profile-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-profile-resize-handle {
  display: none;
}

.chat-view.chat-view-stacked-profile .chat-profile-toolbar {
  display: block;
}

.chat-body.profile-stacked .chat-profile-sidebar {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  height: 100%;
  max-height: none;
  border-left: 0;
  box-shadow: none;
  scrollbar-width: none;
}

.chat-body.profile-stacked .chat-profile-resize-handle {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  display: block;
  cursor: row-resize;
}

.chat-body.profile-stacked .chat-profile-resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
}

.chat-body.profile-stacked .chat-profile-resize-handle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid transparent;
}

.chat-body.profile-stacked .message-list {
  grid-column: 1;
  grid-row: 3;
}

.chat-body.profile-stacked .chat-profile-sidebar::-webkit-scrollbar,
.chat-body.profile-stacked .chat-profile-card::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.chat-body.profile-stacked .chat-profile-card {
  scrollbar-width: none;
}

.chat-body.profile-stacked #chatProfileBanner {
  min-height: 152px;
}

.chat-body.profile-stacked #chatProfileAvatar {
  width: 108px;
  height: 108px;
}

.chat-body.profile-overlay .chat-profile-sidebar {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(380px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px var(--shadow);
  background: var(--panel);
  z-index: 12;
}

#chatProfileBanner {
  min-height: 188px;
}

.chat-view.chat-view-side-profile #chatProfileBanner {
  min-height: 224px;
}

.chat-profile-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 0 18px 20px;
}

.chat-profile-top {
  margin-top: -58px;
}

.chat-profile-copy {
  margin-top: 16px;
}

.chat-profile-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 22px;
}

#chatProfileAvatar {
  width: 120px;
  height: 120px;
}

#chatProfilePresence {
  right: 8px;
  bottom: 8px;
  width: 20px;
  height: 20px;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: var(--message-gap);
  overflow: auto;
  min-height: 0;
  min-width: 0;
  padding: var(--message-list-padding);
}

.message-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  justify-content: flex-start;
  border-radius: 24px;
  margin: 0 -8px;
  padding: 8px;
  transform-origin: center bottom;
}

.message-list.context-menu-scroll-lock {
  overflow: hidden;
  overscroll-behavior: contain;
}

.message-row.me {
  justify-content: flex-end;
}

.call-event-row {
  display: grid;
  grid-template-columns: 24px minmax(0, auto) auto;
  justify-content: start;
  align-items: center;
  gap: 12px;
  max-width: min(720px, calc(100% - 32px));
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.call-event-row.search-match-active {
  border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.14);
}

.call-event-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--green);
}

.call-event-row.missed .call-event-icon {
  color: #9aa5af;
}

.call-event-icon svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-event-text {
  min-width: 0;
  margin: 0;
  line-height: 1.35;
}

.call-event-text strong,
.call-event-text mark {
  color: var(--text);
}

.call-event-time {
  color: var(--muted-dark);
  font-size: 0.82rem;
  white-space: nowrap;
}

.message-row.context-target {
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.05) 26%, transparent 72%);
}

body[data-theme="light"] .message-row.context-target,
body[data-theme="sakura"] .message-row.context-target {
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-rgb), 0.08) 26%, transparent 74%);
}

body[data-theme="oled"] .message-row.context-target {
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-rgb), 0.08) 26%, transparent 74%);
}

.message-avatar {
  z-index: 2;
  width: var(--message-avatar-size, 38px);
  height: var(--message-avatar-size, 38px);
  margin-bottom: 4px;
  border: 2px solid var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.message-bubble {
  position: relative;
  z-index: 1;
  flex: 0 1 auto;
  max-width: min(64%, 680px);
  border-radius: 18px;
  padding: var(--bubble-padding-y) var(--bubble-padding-x) calc(var(--bubble-padding-y) - 3px);
  color: var(--text);
  line-height: 1.38;
  background: var(--bubble);
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.message-reaction-chip {
  position: relative;
  overflow: visible;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.message-reaction-chip .emoji {
  font-size: 1.28rem;
  line-height: 1;
}

.message-reaction-chip .count {
  line-height: 1;
}

.message-reaction-chip.is-mine {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.16);
}

.message-reaction-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.26);
}

.reaction-pop {
  animation: reaction-pop 560ms var(--ease-soft);
}

.message-reaction-burst {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: 50%;
  font-size: 1.12rem;
  line-height: 1;
  transform: translate(-50%, 0) scale(0.7);
  animation: reaction-burst 720ms var(--ease-soft) forwards;
}

.message-row.has-avatar .message-bubble::after {
  content: "";
  position: absolute;
  bottom: 11px;
  width: 14px;
  height: 14px;
  background: inherit;
}

.message-row.them.has-avatar .message-bubble::after {
  left: -11px;
  clip-path: polygon(100% 0, 100% 100%, 0 62%);
}

.message-row.me.has-avatar .message-bubble::after {
  right: -11px;
  clip-path: polygon(0 0, 100% 62%, 0 100%);
}

.message-row.me .message-bubble {
  color: var(--self-text);
  background: var(--green);
}

.message-text {
  margin: 0;
  font-size: var(--message-font-size);
  white-space: pre-wrap;
  word-break: break-word;
}

.message-link {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.58);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.message-row.me .message-link {
  text-decoration-color: rgba(7, 16, 9, 0.34);
}

.message-link:hover {
  text-decoration-color: currentColor;
}

.message-link-preview {
  display: grid;
  width: min(100%, 360px);
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), transparent 52%),
    rgba(255, 255, 255, 0.055);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
  transition: transform var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}

.message-row.me .message-link-preview {
  border-color: rgba(7, 16, 9, 0.14);
  background: rgba(255, 255, 255, 0.18);
}

.message-link-preview:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
  transform: translateY(-1px);
}

.message-link-preview-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.24);
}

.message-link-preview-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px 13px;
}

.message-link-preview-host {
  color: rgb(var(--accent-rgb));
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-row.me .message-link-preview-host {
  color: rgba(7, 16, 9, 0.72);
}

.message-link-preview-title {
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-link-preview-description {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-row.me .message-link-preview-description {
  color: rgba(7, 16, 9, 0.68);
}

.spotify-link-preview {
  width: min(100%, 420px);
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(var(--accent-rgb), 0.2), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 88%, transparent), color-mix(in srgb, var(--panel-dark) 94%, transparent));
  box-shadow: 0 18px 34px var(--shadow);
}

.message-row.me .spotify-link-preview {
  color: var(--self-text);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.28), transparent 38%),
    color-mix(in srgb, var(--bubble) 56%, white 22%);
}

.spotify-link-art {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 16px;
  color: #fff;
  font-size: 1.28rem;
  font-weight: 900;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.32), transparent 32%),
    linear-gradient(145deg, rgb(var(--accent-rgb)), color-mix(in srgb, rgb(var(--accent-rgb)) 58%, #101214));
  box-shadow: 0 10px 24px rgba(var(--accent-rgb), 0.22);
}

.spotify-link-art img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.spotify-link-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.spotify-link-logo {
  color: rgb(var(--accent-rgb));
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-row.me .spotify-link-logo {
  color: color-mix(in srgb, var(--self-text) 72%, rgb(var(--accent-rgb)));
}

.spotify-link-copy strong {
  overflow: hidden;
  font-size: 0.95rem;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spotify-link-copy > span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-row.me .spotify-link-copy > span:last-child {
  color: color-mix(in srgb, var(--self-text) 62%, transparent);
}

.spotify-link-action {
  display: inline-grid;
  min-width: 58px;
  min-height: 32px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 999px;
  padding: 0 12px;
  color: rgb(var(--accent-rgb));
  font-size: 0.76rem;
  font-weight: 900;
  background: rgba(var(--accent-rgb), 0.1);
}

.message-row.me .spotify-link-action {
  border-color: color-mix(in srgb, var(--self-text) 16%, transparent);
  color: color-mix(in srgb, var(--self-text) 72%, rgb(var(--accent-rgb)));
  background: rgba(255, 255, 255, 0.2);
}

.message-text.emoji-only {
  font-size: clamp(28px, calc(var(--message-font-size) * 2.1), 42px);
  line-height: 1.16;
  letter-spacing: 0.01em;
}

.message-text .search-highlight {
  border-radius: 6px;
  padding: 0 2px;
  color: inherit;
  background: rgba(var(--accent-rgb), 0.18);
}

.message-reply {
  display: grid;
  gap: 2px;
  margin: 0 0 9px;
  padding: 0 0 0 10px;
  border-left: 2px solid rgba(var(--accent-rgb), 0.46);
}

.message-row.me .message-reply {
  border-left-color: rgba(7, 16, 9, 0.22);
}

.message-row.me .message-reply-label {
  color: rgba(7, 16, 9, 0.78);
}

.message-row.me .message-reply-text {
  color: rgba(7, 16, 9, 0.92);
  opacity: 1;
}

.message-reply-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
}

.message-reply-text {
  overflow: hidden;
  color: inherit;
  font-size: 0.74rem;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.9;
}

.message-forward {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.08), transparent 68%),
    rgba(255, 255, 255, 0.03);
}

.message-row.me .message-forward {
  background:
    linear-gradient(180deg, rgba(7, 16, 9, 0.12), rgba(255, 255, 255, 0.06));
  border-color: rgba(7, 16, 9, 0.14);
}

.message-forward-label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-row.me .message-forward-label {
  color: rgba(7, 16, 9, 0.72);
}

.message-forward-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.message-forward-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  font-size: 0.8rem;
}

.message-forward-author-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.message-forward-author-name {
  overflow: hidden;
  color: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-forward-author-meta {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.1;
}

.message-row.me .message-forward-author-meta {
  color: rgba(7, 16, 9, 0.68);
}

.message-forward-text {
  margin: 0;
  color: inherit;
  font-size: 0.82rem;
  line-height: 1.34;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-forward-attachments {
  display: grid;
  gap: 6px;
}

.message-forward-attachment {
  color: inherit;
  font-size: 0.76rem;
  line-height: 1.2;
  opacity: 0.9;
}

.message-attachment {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.message-attachment-stack {
  display: grid;
  gap: 10px;
}

.message-attachment-gallery {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 352px);
}

.message-attachment-gallery[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.message-attachment-media {
  position: relative;
  display: block;
  padding: 0;
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.16);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.message-attachment-media img,
.message-attachment-media video {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.18);
}

.message-attachment-media video {
  object-fit: contain;
  aspect-ratio: inherit;
}

.message-attachment-media.is-video {
  width: min(100%, 460px);
  display: grid;
  align-items: end;
}

.message-attachment-media.is-video:fullscreen {
  display: grid;
  width: 100vw;
  height: 100vh;
  max-width: none;
  border: 0;
  border-radius: 0;
  background: #000;
}

.message-attachment-media.is-video:fullscreen video {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.message-attachment-media.is-video.portrait {
  width: min(100%, 400px);
}

.message-attachment-open {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #fff;
  background: rgba(10, 12, 14, 0.56);
  backdrop-filter: blur(8px);
  opacity: 0;
}

.message-attachment-media:hover .message-attachment-open,
.message-attachment-media:focus-within .message-attachment-open {
  opacity: 1;
}

.message-attachment-video-controls {
  position: absolute;
  inset: auto 12px 12px 12px;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(8, 10, 12, 0.38), rgba(8, 10, 12, 0.84));
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.26);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.message-attachment-media.show-video-controls .message-attachment-video-controls,
.message-attachment-media:hover .message-attachment-video-controls,
.message-attachment-media:focus-within .message-attachment-video-controls,
.media-viewer-video-shell.show-video-controls .message-attachment-video-controls,
.media-viewer-video-shell:hover .message-attachment-video-controls,
.media-viewer-video-shell:focus-within .message-attachment-video-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.message-attachment-video-controls.is-viewer {
  left: 50%;
  right: auto;
  bottom: 18px;
  width: min(720px, calc(100% - 28px));
  transform: translate(-50%, 12px);
}

.media-viewer-video-shell.show-video-controls .message-attachment-video-controls.is-viewer,
.media-viewer-video-shell:hover .message-attachment-video-controls.is-viewer,
.media-viewer-video-shell:focus-within .message-attachment-video-controls.is-viewer {
  transform: translate(-50%, 0);
}

.message-attachment-video-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.message-attachment-video-aux {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.message-attachment-media.is-video.portrait .message-attachment-video-controls {
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.message-attachment-media.is-video.portrait .message-attachment-video-main {
  flex: 1 1 100%;
}

.message-attachment-media.is-video.portrait .message-attachment-video-aux {
  width: 100%;
  justify-content: space-between;
}

.message-attachment-media.is-video.portrait .message-attachment-video-time {
  font-size: 0.72rem;
}

.message-attachment-media.is-video.portrait .message-attachment-video-actions {
  margin-left: 0;
}

.message-attachment-media.is-video.portrait .message-attachment-video-volume {
  width: 34px;
  min-width: 34px;
  overflow: hidden;
  transition: width var(--motion-fast) var(--ease-standard);
}

.message-attachment-media.is-video.portrait .message-attachment-video-volume-slider {
  position: static;
  width: 72px;
  min-width: 72px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
  transform-origin: center center;
}

.message-attachment-media.is-video.portrait .message-attachment-video-controls.portrait-volume-expanded .message-attachment-video-volume-slider,
.message-attachment-media.is-video.portrait .message-attachment-video-volume.is-open .message-attachment-video-volume-slider {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.message-attachment-media.is-video.portrait .message-attachment-video-controls.portrait-volume-expanded .message-attachment-video-volume,
.message-attachment-media.is-video.portrait .message-attachment-video-volume.is-open {
  width: 114px;
}

.message-attachment-media.is-video.portrait .message-attachment-video-actions {
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.message-attachment-media.is-video.portrait .message-attachment-video-controls.portrait-volume-preparing .message-attachment-video-actions,
.message-attachment-media.is-video.portrait .message-attachment-video-controls.portrait-volume-expanded .message-attachment-video-actions,
.message-attachment-media.is-video.portrait .message-attachment-video-volume.is-open + .message-attachment-video-actions {
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
}

.message-attachment-media.is-video.compact .message-attachment-video-controls {
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.message-attachment-media.is-video.compact .message-attachment-video-main {
  flex: 1 1 100%;
}

.message-attachment-media.is-video.compact .message-attachment-video-aux {
  width: 100%;
  justify-content: space-between;
}

.message-attachment-media.is-video.compact .message-attachment-video-time {
  font-size: 0.72rem;
}

.message-attachment-media.is-video.compact .message-attachment-video-volume {
  width: 34px;
  min-width: 34px;
  overflow: hidden;
  transition: width var(--motion-fast) var(--ease-standard);
}

.message-attachment-media.is-video.compact .message-attachment-video-volume-slider {
  width: 72px;
  min-width: 72px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
}

.message-attachment-media.is-video.compact .message-attachment-video-volume:hover .message-attachment-video-volume-slider,
.message-attachment-media.is-video.compact .message-attachment-video-volume:focus-within .message-attachment-video-volume-slider,
.message-attachment-media.is-video.compact .message-attachment-video-volume.is-open .message-attachment-video-volume-slider {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.message-attachment-media.is-video.compact .message-attachment-video-volume:hover,
.message-attachment-media.is-video.compact .message-attachment-video-volume:focus-within,
.message-attachment-media.is-video.compact .message-attachment-video-volume.is-open {
  width: 114px;
}

.message-attachment-media.is-video.compact .message-attachment-video-actions {
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.message-attachment-media.is-video.compact .message-attachment-video-volume:hover + .message-attachment-video-actions,
.message-attachment-media.is-video.compact .message-attachment-video-volume:focus-within + .message-attachment-video-actions,
.message-attachment-media.is-video.compact .message-attachment-video-volume.is-open + .message-attachment-video-actions {
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
}

.message-attachment-video-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.message-attachment-video-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-attachment-video-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.message-attachment-video-time {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.message-attachment-video-seek {
  position: relative;
  min-width: 0;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.message-attachment-video-seek-fill,
.message-attachment-video-seek-thumb {
  position: absolute;
  top: 50%;
  pointer-events: none;
}

.message-attachment-video-seek-fill {
  left: 0;
  height: 100%;
  width: var(--range-fill, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82));
  transform: translateY(-50%);
}

.message-attachment-video-seek-thumb {
  left: var(--range-fill, 0%);
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  background: rgb(var(--accent-rgb));
  box-sizing: border-box;
  transform: translate(-50%, -50%);
}

.message-attachment-video-seek:focus-visible .message-attachment-video-seek-thumb {
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.2);
}

.message-attachment-video-volume {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 34px;
  flex: 0 0 auto;
  overflow: hidden;
  transition: width var(--motion-fast) var(--ease-standard);
}

.message-attachment-video-volume:hover,
.message-attachment-video-volume:focus-within,
.message-attachment-video-volume.is-open {
  width: 126px;
}

.message-attachment-video-volume-slider {
  width: 84px;
  min-width: 84px;
  height: 4px;
  border-radius: 999px;
  appearance: none;
  opacity: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.98), rgba(255, 255, 255, 0.94)) 0 / var(--range-fill, 0%) 100% no-repeat,
    rgba(255, 255, 255, 0.18);
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
  transform: translateX(8px);
}

.message-attachment-video-volume:hover .message-attachment-video-volume-slider,
.message-attachment-video-volume:focus-within .message-attachment-video-volume-slider,
.message-attachment-video-volume.is-open .message-attachment-video-volume-slider {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.message-attachment-video-volume-slider::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  background: rgb(var(--accent-rgb));
}

.message-attachment-video-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  background: rgb(var(--accent-rgb));
}

.message-attachment-video-volume-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.message-attachment-open svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-attachment-media.is-image {
  cursor: pointer;
}

.media-viewer-overlay {
  z-index: 56;
  background: rgba(2, 4, 6, 0.84);
  backdrop-filter: blur(12px);
}

.media-viewer-dialog {
  width: min(1240px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  display: grid;
  gap: 16px;
  padding: 18px;
}

.media-viewer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.media-viewer-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.media-viewer-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.media-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.media-viewer-zoom-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.media-viewer-zoom-row input[type="range"] {
  width: 160px;
  height: 6px;
  border-radius: 999px;
  appearance: none;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.92), rgba(var(--accent-rgb), 0.54)) 0 / var(--range-fill, 0%) 100% no-repeat,
    rgba(255, 255, 255, 0.12);
}

.media-viewer-zoom-row input[type="range"]:disabled {
  opacity: 0.45;
}

.media-viewer-zoom-row .secondary-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.media-viewer-zoom-row .secondary-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.media-viewer-zoom-row input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgb(var(--accent-rgb));
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18);
}

.media-viewer-zoom-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgb(var(--accent-rgb));
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.18);
}

.media-viewer-zoom-row input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.media-viewer-stage {
  overflow: auto;
  display: grid;
  place-items: center;
  min-height: min(72vh, 720px);
  scrollbar-width: none;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 22px;
  background:
    radial-gradient(circle at top, rgba(var(--accent-rgb), 0.08), transparent 44%),
    rgba(0, 0, 0, 0.28);
}

.media-viewer-stage::-webkit-scrollbar {
  display: none;
}

.media-viewer-image {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 18px;
  transform: scale(var(--viewer-zoom, 1));
  transform-origin: center center;
  transition: transform var(--motion-fast) var(--ease-standard);
}

.media-viewer-video-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 1040px);
  max-height: 72vh;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
}

.media-viewer-video-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
}

.media-viewer-video-shell:fullscreen .media-viewer-video {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
}

.media-viewer-video-shell.portrait {
  width: min(100%, 520px);
}

.media-viewer-video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72vh;
  border-radius: 18px;
  background: #000;
  object-fit: contain;
}

.message-attachment-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: min(100%, 300px);
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
}

.message-row.me .message-attachment-card {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(7, 16, 9, 0.12);
}

.message-attachment-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.34), rgba(255, 255, 255, 0.08));
}

.message-row.me .message-attachment-icon {
  color: var(--self-text);
  background: rgba(255, 255, 255, 0.34);
}

.message-attachment-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.message-attachment-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.message-attachment-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-row.me .message-attachment-meta {
  color: rgba(7, 16, 9, 0.72);
}

.message-attachment-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  background: rgba(var(--accent-rgb), 0.08);
}

.message-attachment-action:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.16);
}

.message-row.me .message-attachment-action {
  color: var(--self-text);
  border-color: rgba(7, 16, 9, 0.12);
  background: rgba(255, 255, 255, 0.24);
}

.message-attachment-action svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-note-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: min(100%, 380px);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 20px;
  padding: 12px 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    rgba(0, 0, 0, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(12px);
}

.voice-note-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 14% 16%, rgba(var(--accent-rgb), 0.18), transparent 42%),
    linear-gradient(120deg, rgba(var(--accent-rgb), 0.06), transparent 62%);
}

.message-row.me .voice-note-card {
  border-color: rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08)),
    rgba(7, 16, 9, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 10px 24px rgba(7, 16, 9, 0.12);
}

.message-row.me .voice-note-card::before {
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 255, 255, 0.2), transparent 40%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent 64%);
}

.voice-note-play,
.voice-note-download {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 15px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(var(--accent-rgb), 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.message-row.me .voice-note-play,
.message-row.me .voice-note-download {
  color: var(--self-text);
  border-color: rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08)),
    rgba(7, 16, 9, 0.06);
}

.voice-note-play:hover,
.voice-note-download:hover {
  border-color: rgba(var(--accent-rgb), 0.36);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(var(--accent-rgb), 0.14);
  transform: translateY(-1px);
}

.voice-note-play svg,
.voice-note-download svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-note-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.voice-note-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.message-row.me .voice-note-title {
  color: var(--self-text);
}

.voice-note-wave {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 36px;
  overflow: visible;
  padding: 7px 10px 6px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.message-row.me .voice-note-wave {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035)),
    rgba(7, 16, 9, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.voice-note-meta {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.message-row.me .voice-note-meta {
  color: rgba(7, 16, 9, 0.68);
}

.voice-wave-bar {
  flex: 1 1 0;
  min-width: 4px;
  height: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transform-origin: center bottom;
  transform: scaleY(var(--voice-bar-scale, 0.42));
  transition:
    transform 56ms linear,
    background-color 140ms var(--ease-standard),
    opacity 140ms var(--ease-standard);
  will-change: transform;
}

.voice-note-wave .voice-wave-bar {
  background: rgba(var(--accent-rgb), 0.28);
}

.message-row.me .voice-note-wave .voice-wave-bar {
  background: rgba(255, 255, 255, 0.4);
}

.voice-wave-bar.is-played {
  background: rgba(var(--accent-rgb), 0.92);
}

.message-row.me .voice-wave-bar.is-played {
  background: rgba(255, 255, 255, 0.96);
}

.message-row.search-match-active .message-bubble {
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.34);
}

.message-sidecar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 58px;
  padding-bottom: 4px;
  color: var(--text);
}

.message-row.me .message-sidecar {
  align-items: flex-start;
  text-align: left;
}

body[data-show-message-avatars="false"] .message-row {
  gap: 8px;
}

.message-meta {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
}

.message-status {
  color: var(--text);
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1;
  opacity: 0.86;
  text-transform: lowercase;
}

.message-edited {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1;
  opacity: 0.76;
  text-transform: lowercase;
}

.message-row-typing .message-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 92px;
  color: rgba(var(--accent-rgb), 0.94);
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}

.message-bubble-typing .typing-copy {
  font-size: 0.82rem;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  padding: 6px 18px 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.typing-copy {
  white-space: nowrap;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.28;
  animation: typing-dot 1.05s ease-in-out infinite;
  animation-delay: calc(var(--dot-index, 0) * 120ms);
}

.voice-activity-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  min-height: 15px;
}

.voice-activity-bars span {
  width: 3px;
  min-height: 7px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center bottom;
  animation: voice-activity-bar 1.12s var(--ease-soft) infinite;
  animation-delay: calc(var(--dot-index, 0) * 110ms);
}

.voice-activity-bars span:nth-child(1) {
  height: 9px;
}

.voice-activity-bars span:nth-child(2) {
  height: 14px;
}

.voice-activity-bars span:nth-child(3) {
  height: 11px;
}

.voice-activity-bars span:nth-child(4) {
  height: 16px;
}

.chat-header p.typing-status,
.profile-status-badge.typing-status,
.typing-indicator:not(.is-hidden) {
  color: rgba(var(--accent-rgb), 0.94);
}

.chat-header p.voice-status,
.profile-status-badge.voice-status,
.message-bubble.voice-status,
.profile-text p.voice-status {
  color: rgba(var(--accent-rgb), 0.98);
}

.typing-indicator:not(.is-hidden) + .composer {
  border-top-color: transparent;
}

.profile-status-badge.typing-status {
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.12);
}

.profile-status-badge.voice-status {
  border-color: rgba(var(--accent-rgb), 0.32);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-rgb), 0.08)),
    rgba(var(--accent-rgb), 0.1);
}

.message-row-typing .message-bubble.voice-status {
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.14), rgba(var(--accent-rgb), 0.08)),
    rgba(var(--accent-rgb), 0.08);
}

@keyframes voice-activity-bar {
  0%,
  100% {
    transform: scaleY(0.5);
    opacity: 0.42;
  }

  40% {
    transform: scaleY(1);
    opacity: 1;
  }

  70% {
    transform: scaleY(0.72);
    opacity: 0.78;
  }
}

@keyframes voice-presence-ripple {
  0% {
    transform: scale(0.72);
    opacity: 0.52;
  }

  100% {
    transform: scale(1.16);
    opacity: 0;
  }
}

.composer-reply-strip,
.composer-edit-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 16px;
  padding: 11px 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 72%),
    rgba(var(--accent-rgb), 0.06);
}

.composer-edit-strip {
  border-color: rgba(var(--accent-rgb), 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 72%),
    rgba(var(--accent-rgb), 0.1);
}

.composer-reply-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.composer-reply-copy strong {
  color: var(--text);
  font-size: 0.77rem;
  line-height: 1.1;
}

.composer-reply-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-reply-cancel {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.composer-reply-cancel:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.26);
  background: rgba(var(--accent-rgb), 0.1);
}

.composer-reply-cancel svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 0;
  padding: 0;
}

.composer-attachment-card {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: end;
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 18px;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 64%),
    var(--panel-dark);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.16);
}

.composer-attachment-card.is-file {
  width: min(220px, 100%);
}

.composer-attachment-preview {
  position: absolute;
  inset: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.06);
}

.composer-attachment-preview img,
.composer-attachment-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer-attachment-preview.generic {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
  color: var(--text);
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.32) 74%),
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.34), rgba(255, 255, 255, 0.08));
}

.composer-attachment-preview.generic strong {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.composer-attachment-preview.generic span {
  font-size: 0.64rem;
  color: rgba(255, 255, 255, 0.82);
}

.composer-attachment-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 10px;
  margin-top: auto;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.64));
  transition: opacity var(--motion-fast) var(--ease-standard);
}

.composer-attachment-card:not(.is-file):not(.is-uploading):not(.has-error) .composer-attachment-copy {
  opacity: 0;
}

.composer-attachment-card:hover .composer-attachment-copy,
.composer-attachment-card:focus-within .composer-attachment-copy,
.composer-attachment-card.is-uploading .composer-attachment-copy,
.composer-attachment-card.has-error .composer-attachment-copy,
.composer-attachment-card.is-file .composer-attachment-copy {
  opacity: 1;
}

.composer-attachment-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 700;
}

.composer-attachment-meta {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.6rem;
}

.composer-attachment-progress {
  overflow: hidden;
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 7px;
  z-index: 3;
  width: auto;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.composer-attachment-progress-bar {
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.72), rgba(var(--accent-rgb), 0.96), rgba(var(--accent-rgb), 0.72));
  background-size: 180% 100%;
  animation: attachment-progress 1.4s linear infinite;
  transition: width var(--motion-fast) var(--ease-standard);
}

.composer-attachment-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: #fff;
  opacity: 0;
  background: rgba(12, 14, 16, 0.62);
  backdrop-filter: blur(10px);
  transition:
    opacity var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard);
}

.composer-attachment-card:hover .composer-attachment-remove,
.composer-attachment-card:focus-within .composer-attachment-remove {
  opacity: 1;
}

.composer-attachment-remove:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.24);
  background: rgba(var(--accent-rgb), 0.08);
}

.composer-attachment-remove svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 10px 18px 14px;
  background: var(--panel);
}

.composer-main-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
  gap: 6px;
  align-items: center;
}

.attach-button,
.gif-button,
.emoji-button,
.voice-record-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--muted);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 72%),
    var(--panel-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.attach-button svg,
.gif-button svg,
.emoji-button svg,
.voice-record-button svg,
.voice-preview-play svg,
.voice-composer-action svg,
.voice-lock-badge svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attach-button:hover:not(:disabled),
.gif-button:hover:not(:disabled),
.gif-button.active,
.emoji-button:hover:not(:disabled),
.emoji-button.active,
.voice-record-button:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.08);
}

.attach-button:disabled,
.gif-button:disabled,
.emoji-button:disabled,
.voice-record-button:disabled {
  opacity: 0.52;
}

.gif-button {
  color: rgb(var(--accent-rgb));
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.voice-record-button {
  color: var(--green);
  border-color: rgba(var(--accent-rgb), 0.24);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.14), rgba(var(--accent-rgb), 0.06)),
    var(--panel-dark);
}

.composer input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
}

.send-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  border-radius: 15px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  color: var(--green);
  background: rgba(var(--accent-rgb), 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.send-button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.composer.voice-mode .composer-main-row {
  display: none;
}

.voice-composer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 24px;
  padding: 14px 16px;
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.18), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 72%),
    var(--panel-dark);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.22);
}

.voice-composer.is-preview {
  grid-template-columns: auto minmax(0, 1fr) auto;
  border-color: rgba(var(--accent-rgb), 0.24);
}

.voice-composer-core {
  grid-column: 1;
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 10px;
  align-self: stretch;
  justify-self: stretch;
}

.voice-composer.is-preview .voice-composer-core {
  grid-column: 2;
}

.voice-composer-topline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.voice-composer-status,
.voice-composer-timer {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.voice-composer-hint {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.voice-composer-wave {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  width: 100%;
  min-width: 0;
  height: 40px;
  overflow: visible;
}

.voice-composer-wave .voice-wave-bar {
  background: rgba(var(--accent-rgb), 0.22);
}

.voice-composer-wave .voice-wave-bar.is-played {
  background: rgba(var(--accent-rgb), 0.96);
}

.voice-preview-play,
.voice-composer-action {
  display: inline-grid;
  place-items: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.voice-preview-play {
  grid-column: 1;
}

.voice-preview-play:hover,
.voice-composer-action:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.12);
}

.voice-composer-actions {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.voice-composer.is-preview .voice-composer-actions {
  grid-column: 3;
}

.voice-composer-action.primary {
  color: var(--green);
  background: rgba(var(--accent-rgb), 0.14);
}

.voice-composer-action.danger {
  color: var(--danger);
}

.voice-lock-badge {
  position: absolute;
  left: 16px;
  bottom: 14px;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

.voice-lock-badge.is-active {
  color: var(--green);
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(var(--accent-rgb), 0.14);
}

.voice-composer.is-recording .voice-composer-core {
  padding-left: 0;
}

.emoji-picker {
  --emoji-picker-width: 460px;
  position: absolute;
  right: 78px;
  bottom: calc(100% + 12px);
  z-index: 18;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  width: min(var(--emoji-picker-width), calc(100vw - 32px));
  min-width: 390px;
  max-width: 640px;
  height: min(620px, 72vh);
  min-height: 500px;
  max-height: calc(100vh - 118px);
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 22px;
  padding: 14px;
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.16), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 70%),
    var(--popup);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
}

.emoji-picker-resize-handle {
  position: absolute;
  left: -8px;
  top: 14px;
  bottom: 14px;
  width: 18px;
  z-index: 1;
  cursor: ew-resize;
}

.emoji-picker-resize-handle::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 24px;
  bottom: 24px;
  width: 4px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.1);
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.emoji-picker:hover .emoji-picker-resize-handle::before,
.emoji-picker.is-resizing .emoji-picker-resize-handle::before,
.emoji-picker-resize-handle:hover::before {
  background: rgba(var(--accent-rgb), 0.34);
  transform: scaleY(1.02);
}

.emoji-picker-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.emoji-picker-search {
  position: relative;
  display: block;
}

.emoji-picker-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--muted);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(-50%);
}

.emoji-picker-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 12px 10px 38px;
  color: var(--text);
  background: var(--input);
  outline: none;
}

.emoji-picker-search input:focus {
  border-color: rgba(var(--accent-rgb), 0.42);
}

.emoji-picker-close {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.emoji-picker-close:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.24);
  background: rgba(var(--accent-rgb), 0.08);
}

.emoji-picker-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.emoji-group-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 54px;
  padding: 5px 10px 8px 4px;
  margin: -5px -6px 0;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}

.emoji-group-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 40px;
  max-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.03);
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard);
}

.emoji-group-tab .icon {
  font-size: 1rem;
  line-height: 1;
}

.emoji-group-tab:hover,
.emoji-group-tab.active {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.1);
  transform: translateY(-1px);
}

.emoji-picker-copy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 20px;
}

.emoji-picker-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 9px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  margin: -4px -4px 0;
  padding: 6px 8px 10px 4px;
}

.emoji-item {
  display: inline-grid;
  place-items: center;
  min-width: 60px;
  min-height: 60px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 0;
  font-size: 2rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.03);
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}

.emoji-item:hover,
.emoji-item:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.26);
  background: rgba(var(--accent-rgb), 0.12);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.emoji-empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.gif-picker {
  --gif-picker-width: 520px;
  --gif-picker-height: 620px;
  position: absolute;
  right: 128px;
  bottom: calc(100% + 12px);
  z-index: 19;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  align-content: start;
  gap: 12px;
  width: min(var(--gif-picker-width), calc(100vw - 32px));
  min-width: 420px;
  max-width: 760px;
  height: min(var(--gif-picker-height), 76vh);
  min-height: 500px;
  max-height: calc(100vh - 118px);
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 24px;
  padding: 14px;
  background:
    radial-gradient(circle at top left, rgba(255, 130, 170, 0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.16), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 70%),
    var(--popup);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.gif-picker-resize-handle {
  position: absolute;
  left: -8px;
  top: 14px;
  bottom: 14px;
  width: 18px;
  z-index: 1;
  cursor: ew-resize;
}

.gif-picker-resize-handle::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 24px;
  bottom: 24px;
  width: 4px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.1);
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

.gif-picker:hover .gif-picker-resize-handle::before,
.gif-picker.is-resizing .gif-picker-resize-handle::before,
.gif-picker-resize-handle:hover::before {
  background: rgba(var(--accent-rgb), 0.34);
  transform: scaleY(1.02);
}

.gif-picker-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.gif-picker-search {
  position: relative;
  display: block;
}

.gif-picker-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--muted);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(-50%);
}

.gif-picker-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 12px 10px 38px;
  color: var(--text);
  background: var(--input);
  outline: none;
}

.gif-picker-search input:focus {
  border-color: rgba(var(--accent-rgb), 0.42);
}

.gif-picker-close,
.gif-load-more,
.gif-tab {
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.gif-picker-close {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.gif-picker-close:hover,
.gif-load-more:hover,
.gif-tab:hover,
.gif-tab.active {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.1);
}

.gif-picker-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gif-picker-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.gif-tab,
.gif-load-more {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 0.76rem;
  font-weight: 850;
}

.gif-picker-copy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 34px;
}

.gif-picker-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  grid-auto-rows: 8px;
  grid-auto-flow: dense;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: -4px -4px 0;
  padding: 6px 8px 10px 4px;
  align-items: start;
}

.gif-grid.is-favorites {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  grid-auto-rows: 8px;
  grid-auto-flow: dense;
  column-width: auto;
  column-gap: 8px;
}

.gif-item {
  position: relative;
  display: block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
  transform: translateZ(0);
  cursor: pointer;
}

.gif-grid.is-favorites .gif-item {
  display: block;
  width: 100%;
  margin: 0;
  vertical-align: top;
  break-inside: auto;
  page-break-inside: auto;
  aspect-ratio: auto;
}

.gif-item:hover,
.gif-item:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.3);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.gif-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gif-grid.is-favorites .gif-item img {
  height: 100%;
  object-fit: cover;
}

.gif-favorite-button,
.message-gif-favorite {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(8, 10, 12, 0.54);
  backdrop-filter: blur(8px);
  opacity: 0;
}

.gif-item:hover .gif-favorite-button,
.gif-item:focus-within .gif-favorite-button,
.gif-favorite-button.is-favorite,
.message-gif-card:hover .message-gif-favorite,
.message-gif-card:focus-within .message-gif-favorite,
.message-gif-favorite.is-favorite {
  opacity: 1;
}

.gif-favorite-button.is-favorite,
.message-gif-favorite.is-favorite {
  color: #ff7aa8;
}

.gif-empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.message-gif-card {
  display: block;
  position: relative;
  width: min(100%, 360px);
  padding: 0;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 18px;
  color: inherit;
  background: rgba(0, 0, 0, 0.18);
  text-align: left;
  cursor: zoom-in;
  overflow: hidden;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.18);
}

.message-gif-card:hover,
.message-gif-card:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.32);
  transform: translateY(-1px);
}

.message-gif-favorite {
  z-index: 2;
  cursor: pointer;
}

.message-gif-card img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

.message-gif-brand {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.035);
}

@media (max-width: 720px) {
  :root {
    --message-list-padding: 14px;
    --bubble-padding-y: 9px;
    --bubble-padding-x: 11px;
    --message-avatar-size: 32px;
  }

  body {
    overscroll-behavior: none;
  }

  body[data-platform="android"],
  body[data-platform="unknown"] {
    --titlebar-height: 0px;
  }

  .window-bar {
    display: none;
  }

  .auth-screen {
    align-items: stretch;
    justify-items: stretch;
    min-height: 100dvh;
    padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  }

  .auth-card {
    width: 100%;
    min-height: auto;
    border-radius: 18px;
    padding: 22px 16px;
  }

  .auth-card input,
  .auth-provider-button,
  .primary-button,
  .secondary-button {
    min-height: 48px;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 62px;
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .rail {
    grid-row: 2;
    flex-direction: row;
    justify-content: space-around;
    gap: 8px;
    padding: 7px max(12px, env(safe-area-inset-left)) 7px max(12px, env(safe-area-inset-right));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel-dark) 92%, transparent);
    backdrop-filter: blur(18px);
  }

  .rail-button {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  .rail-button.active::before {
    left: 50%;
    top: auto;
    bottom: 3px;
    width: 18px;
    height: 3px;
    transform: translateX(-50%);
  }

  .rail-spacer,
  .sidebar-resize-handle,
  .chat-profile-resize-handle,
  .call-room-resize-handle {
    display: none !important;
  }

  .sidebar,
  .chat-panel {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
  }

  .sidebar {
    border-right: 0;
    padding: max(14px, env(safe-area-inset-top)) 12px 12px;
  }

  body.mobile-chat-open .sidebar {
    display: none;
  }

  body.mobile-friends-view .sidebar,
  body.mobile-settings-view .sidebar {
    display: none;
  }

  body.mobile-chat-list .chat-panel {
    display: none;
  }

  .search-box {
    margin-bottom: 10px;
  }

  .search-box input {
    min-height: 48px;
    border-radius: 16px;
  }

  .server-row,
  .section-title {
    padding-right: 2px;
    padding-left: 2px;
  }

  .sidebar-account {
    margin-top: 12px;
    padding-top: 12px;
  }

  .profile-card-footer,
  .sidebar-call-bar {
    border-radius: 16px;
  }

  .new-chat-button {
    right: 12px;
    bottom: 14px;
    width: 56px;
    height: 56px;
    border-radius: 20px;
  }

  .new-chat-popover {
    right: 12px;
    bottom: 78px;
    width: min(320px, calc(100vw - 24px));
  }

  .empty-state {
    height: 100%;
    padding: 24px;
  }

  .chat-view {
    height: calc(100dvh - 62px - env(safe-area-inset-bottom));
    background: var(--bg);
  }

  .chat-header {
    min-height: 62px;
    align-items: center;
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  }

  .mobile-chat-back {
    display: inline-grid;
    flex: 0 0 auto;
  }

  .chat-person {
    min-width: 0;
    gap: 9px;
  }

  .chat-person .avatar {
    width: 38px;
    height: 38px;
  }

  .chat-person h2 {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-header-actions {
    gap: 6px;
  }

  .chat-header-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .chat-search-bar {
    padding: 8px 10px;
  }

  .call-room-panel {
    min-height: 240px;
    max-height: 52dvh;
    border-bottom: 1px solid var(--line);
  }

  .call-room-controls {
    gap: 8px;
    padding-bottom: 10px;
  }

  .call-control-button {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  .chat-body,
  .chat-body.profile-side,
  .chat-body.profile-stacked,
  .chat-view.chat-view-side-profile {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
  }

  .chat-profile-sidebar {
    display: none !important;
  }

  .message-list {
    flex: 1 1 auto;
    padding: 12px 12px 14px;
  }

  .message-bubble {
    max-width: 84%;
  }

  .message-row.me .message-bubble {
    max-width: 86%;
  }

  .message-attachments {
    max-width: min(100%, 74vw);
  }

  .typing-indicator {
    min-height: 24px;
    padding: 0 14px 6px;
  }

  .composer {
    gap: 8px;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }

  .composer-main-row {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .gif-button,
  .emoji-button {
    display: none;
  }

  .attach-button,
  .voice-record-button,
  .send-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 15px;
  }

  .composer input {
    min-height: 44px;
    border-radius: 15px;
    padding: 10px 12px;
  }

  .composer-attachment-tray {
    max-height: 150px;
    grid-auto-columns: minmax(128px, 48vw);
    padding-bottom: 2px;
  }

  .emoji-picker,
  .gif-picker {
    left: 12px;
    right: 12px;
    width: auto;
    min-width: 0;
    height: min(68vh, 560px);
    min-height: 420px;
    bottom: calc(100% + 10px);
  }

  .emoji-picker-resize-handle,
  .gif-picker-resize-handle {
    display: none;
  }

  .emoji-group-tab span:not(.icon) {
    display: none;
  }

  .voice-composer {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  .voice-composer-hint {
    grid-column: 1 / -1;
    text-align: left;
  }

  .voice-composer-actions {
    justify-content: flex-end;
  }

  .settings-view,
  .friends-view {
    grid-column: 1;
    grid-row: 1;
    height: calc(100dvh - 62px - env(safe-area-inset-bottom));
    padding: max(18px, env(safe-area-inset-top)) 12px 18px;
  }

  .settings-header {
    margin-bottom: 14px;
    padding-bottom: 14px;
  }

  .settings-layout,
  .settings-grid,
  .settings-menu {
    grid-template-columns: 1fr;
  }

  .settings-menu {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .settings-menu::-webkit-scrollbar {
    display: none;
  }

  .settings-menu button {
    flex: 0 0 auto;
    min-height: 42px;
    white-space: nowrap;
  }

  .settings-card {
    border-radius: 16px;
    padding: 16px;
  }

  .profile-preview-card {
    width: 100%;
  }

  .full-profile-dialog,
  .media-editor-dialog,
  .confirm-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
  }

  .context-menu {
    max-width: calc(100vw - 24px);
  }
}

.chat-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(8, 10, 12, 0.34);
  backdrop-filter: blur(6px);
}

.chat-drop-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 420px);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 28px;
  padding: 28px 24px;
  text-align: center;
  background:
    radial-gradient(circle at top, rgba(var(--accent-rgb), 0.16), transparent 60%),
    var(--panel);
  box-shadow: 0 34px 84px rgba(0, 0, 0, 0.32);
  animation: surface-enter var(--motion-slow) var(--ease-soft);
}

.chat-drop-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 22px;
  color: var(--green);
  background: rgba(var(--accent-rgb), 0.12);
}

.chat-drop-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-drop-card strong {
  font-size: 1rem;
}

.chat-drop-card span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.surface-enter {
  animation: surface-enter var(--motion-slow) var(--ease-soft);
}

.surface-enter-soft {
  animation: surface-enter-soft calc(var(--motion-slow) + 40ms) var(--ease-soft);
}

.overlay-enter {
  animation: overlay-enter var(--motion-medium) var(--ease-standard);
}

.dialog-enter {
  animation: dialog-enter calc(var(--motion-slow) + 20ms) var(--ease-soft);
}

.menu-enter {
  transform-origin: top right;
  animation: menu-enter var(--motion-medium) var(--ease-standard);
}

.stagger-enter {
  opacity: 0;
  animation: stagger-enter calc(var(--motion-slow) + 20ms) var(--ease-soft) both;
  animation-delay: calc(var(--stagger-index, 0) * var(--motion-stagger-step));
}

.message-row-enter {
  animation: message-enter calc(var(--motion-slow) + 10ms) var(--ease-soft) both;
}

.message-row-leave {
  overflow: clip;
  pointer-events: none;
  animation: message-leave var(--message-remove-duration, 320ms) var(--ease-standard) both;
}

@keyframes surface-enter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.986);
  }

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

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

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

@keyframes update-card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

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

@keyframes overlay-enter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }

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

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes toast-exit {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }

  to {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.98);
  }
}

@keyframes menu-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }

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

@keyframes message-leave {
  0% {
    opacity: 1;
    max-height: var(--message-row-collapse-height, 180px);
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    transform: translateY(0) scale(1);
  }

  45% {
    opacity: 0.58;
    transform: translateY(-2px) scale(0.988);
  }

  100% {
    opacity: 0;
    max-height: 0;
    margin-top: -6px;
    margin-bottom: -6px;
    padding-top: 0;
    padding-bottom: 0;
    transform: translateY(-10px) scale(0.968);
  }
}

@keyframes reaction-pop {
  0% {
    transform: scale(0.82);
  }

  45% {
    transform: scale(1.16);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes reaction-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.66);
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -28px) scale(1.18);
  }
}

@keyframes stagger-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

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

@keyframes message-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

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

@keyframes typing-dot {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes attachment-progress {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: 0 0;
  }
}

@keyframes presence-typing-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.36);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0);
    transform: scale(1.08);
  }
}

@keyframes call-avatar-ring {
  0%,
  100% {
    box-shadow:
      0 20px 44px rgba(0, 0, 0, 0.25),
      0 0 0 0 rgba(var(--accent-rgb), 0.34);
    transform: translateY(0) scale(1);
  }

  50% {
    box-shadow:
      0 24px 54px rgba(0, 0, 0, 0.3),
      0 0 0 12px rgba(var(--accent-rgb), 0);
    transform: translateY(-2px) scale(1.05);
  }
}

@keyframes call-avatar-join {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.88);
  }

  70% {
    transform: translateY(-2px) scale(1.06);
  }

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

@keyframes call-wave-ring {
  0% {
    transform:
      translate(-50%, -50%)
      rotate(var(--a))
      translateY(calc(-78px - var(--voice-level) * 5px))
      scaleY(calc(0.38 + var(--voice-level) * 0.5));
  }

  50% {
    transform:
      translate(-50%, -50%)
      rotate(var(--a))
      translateY(calc(-82px - var(--voice-level) * 7px))
      scaleY(calc(0.68 + var(--voice-level) * (0.86 + var(--phase) * 0.045)));
  }

  100% {
    transform:
      translate(-50%, -50%)
      rotate(var(--a))
      translateY(calc(-78px - var(--voice-level) * 5px))
      scaleY(calc(0.38 + var(--voice-level) * 0.5));
  }
}

@keyframes empty-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .empty-art {
    animation: none !important;
  }
}

@media (max-width: 1380px) {
  .chat-body.profile-side {
    grid-template-columns: minmax(0, 1fr) clamp(340px, 25vw, 380px);
  }
}

@media (max-width: 1320px) {
  .settings-view {
    padding: 28px 24px;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-menu {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1220px) {
  .chat-body.profile-overlay .chat-profile-sidebar {
    width: min(380px, calc(100% - 32px));
  }

  .profile-settings-layout {
    grid-template-columns: 1fr;
  }

  .profile-preview-card {
    position: static;
    width: min(100%, 420px);
  }

  .full-profile-head {
    flex-direction: column;
  }

  .full-profile-head-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 1120px) {
  .profile-media-grid {
    grid-template-columns: 1fr;
  }

  .inline-action-row,
  .media-action-row,
  .profile-save-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .inline-action-row > *,
  .media-action-row > *,
  .profile-save-row > * {
    width: 100%;
  }
}

@media (max-width: 960px) {
  .settings-view {
    padding: 24px 18px;
  }

  .media-editor-dialog {
    width: min(640px, calc(100vw - 32px));
  }

  .media-editor-stage {
    padding: 14px;
  }

  .chat-search-bar {
    grid-template-columns: 1fr;
  }

  .chat-search-toolbar {
    justify-content: flex-end;
  }

  .chat-body.profile-overlay .chat-profile-sidebar {
    top: 18px;
    right: 18px;
    bottom: 18px;
    width: min(340px, calc(100% - 36px));
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 60px var(--shadow);
    background: var(--panel);
    z-index: 12;
  }

  .full-profile-dialog {
    width: min(640px, calc(100vw - 32px));
  }

  .full-profile-banner {
    min-height: 188px;
  }
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 54px minmax(220px, 260px) 0 minmax(0, 1fr);
  }

  .sidebar-resize-handle {
    display: none;
  }

  .profile-settings-layout,
  .profile-media-grid {
    grid-template-columns: 1fr;
  }

  .profile-preview-card {
    position: static;
  }

  .auth-screen {
    place-items: start center;
  }

  .inline-action-row,
  .media-action-row,
  .profile-save-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .inline-action-row > *,
  .media-action-row > *,
  .profile-save-row > * {
    width: 100%;
  }

  .range-row {
    grid-template-columns: 1fr;
  }

  .range-row span {
    text-align: left;
  }

  .message-bubble {
    max-width: 78%;
  }

  .chat-header {
    align-items: flex-start;
  }

  .chat-header-actions {
    margin-left: auto;
  }

  .chat-body.profile-overlay .chat-profile-sidebar {
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: min(320px, calc(100% - 24px));
  }

  .full-profile-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .full-profile-top .profile-status-badge {
    margin-bottom: 0;
    margin-left: 18px;
  }

  .full-profile-body {
    padding: 0 16px 18px;
  }

}

@media (max-width: 900px) {
  .shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 62px;
    width: 100vw;
    height: calc(100dvh - var(--titlebar-height));
    min-width: 0;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .rail {
    grid-column: 1;
    grid-row: 2;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    min-width: 0;
    padding: 7px max(12px, env(safe-area-inset-left)) 7px max(12px, env(safe-area-inset-right));
    border-top: 1px solid var(--line);
  }

  .rail-spacer,
  .sidebar-resize-handle,
  .chat-profile-resize-handle,
  .call-room-resize-handle {
    display: none !important;
  }

  .rail-button.active::before {
    left: 50%;
    top: auto;
    bottom: 3px;
    width: 18px;
    height: 3px;
    transform: translateX(-50%);
  }

  .sidebar,
  .chat-panel {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
  }

  .chat-panel {
    display: block;
    overflow: hidden;
  }

  .sidebar {
    border-right: 0;
    padding: max(14px, env(safe-area-inset-top)) 12px 12px;
  }

  body.mobile-chat-open .sidebar,
  body.mobile-friends-view .sidebar,
  body.mobile-settings-view .sidebar {
    display: none;
  }

  body.mobile-chat-list .chat-panel {
    display: none;
  }

  .chat-view {
    width: 100%;
    height: calc(100dvh - var(--titlebar-height) - 62px - env(safe-area-inset-bottom));
  }

  .chat-header {
    align-items: center;
  }

  .chat-header-actions {
    margin-left: auto;
  }

  .mobile-chat-back {
    display: inline-grid;
    flex: 0 0 auto;
  }

  .chat-view.chat-view-side-profile,
  .chat-body,
  .chat-body.profile-side,
  .chat-body.profile-stacked,
  .chat-body.profile-overlay {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
  }

  .chat-profile-sidebar {
    display: none !important;
  }

  .settings-view {
    width: 100%;
    max-width: none;
    height: calc(100dvh - var(--titlebar-height) - 62px - env(safe-area-inset-bottom));
    overflow: auto;
  }

  .settings-grid,
  .settings-layout {
    width: 100%;
    max-width: none;
    grid-template-columns: minmax(0, 1fr);
  }
}
