.nestryn-preview-logo { display:block; position:relative; width:143.36px; max-width:100%; aspect-ratio:1000 / 223.221; }
.brand-wordmark .nestryn-preview-logo { width:197.11px; }
.nestryn-preview-logo::before,.nestryn-preview-logo::after {
  content:""; position:absolute; inset:0; mask-size:100% 100%; mask-repeat:no-repeat;
  -webkit-mask-size:100% 100%; -webkit-mask-repeat:no-repeat;
}
.nestryn-preview-logo::before { background:currentColor; mask-image:url("/assets/brand/nestryn-wordmark-ink.svg"); -webkit-mask-image:url("/assets/brand/nestryn-wordmark-ink.svg"); }
.nestryn-preview-logo::after { background:#449E56; mask-image:url("/assets/brand/nestryn-wordmark-accent.svg"); -webkit-mask-image:url("/assets/brand/nestryn-wordmark-accent.svg"); }

:root {
  color-scheme: dark;
  --bg: #121318;
  --panel: #202126;
  --panel-soft: #202126;
  --text: #ffffff;
  --muted: #c8cfda;
  --line: #34353a;
  --accent: #ffffff;
  --accent-text: #121318;
  --bubble-in: #ffffff;
  --bubble-out: #18463c;
  --bubble-in-text: #121821;
  --danger: #ff4f5e;
  --success: #20c978;
  --shadow: 0 24px 70px rgba(0, 0, 0, .35);
  --control: #25262b;
  --control-strong: #25262b;
  --overlay: rgba(18, 19, 24, .64);
  --custom-chat-bg: var(--bg);
  --custom-chat-header-bg: var(--panel);
  --custom-compose-bg: var(--panel);
  --custom-input-bg: transparent;
  --custom-icon-bg: transparent;
  --custom-icon-color: var(--text);
  --custom-chat-list-bg: var(--panel);
  --custom-chat-list-header-bg: var(--panel);
  --custom-chat-list-search-bg: var(--control);
  --custom-chat-row-bg: transparent;
  --custom-chat-list-text: var(--text);
  --custom-chat-list-muted: var(--muted);
  --custom-chat-list-button-bg: var(--accent);
  --custom-chat-list-button-icon: var(--accent-text);
  --custom-message-in-left: var(--bubble-in);
  --custom-message-in-center: var(--bubble-in);
  --custom-message-in-right: var(--bubble-in);
  --custom-message-out-left: var(--bubble-out);
  --custom-message-out-center: var(--bubble-out);
  --custom-message-out-right: var(--bubble-out);
  --custom-message-text: inherit;
  --custom-message-meta: var(--muted);
  --custom-message-font-size: 15px;
  --custom-profile-bg: var(--panel);
  --custom-profile-block-bg: var(--panel-soft);
  --custom-profile-text: var(--text);
  --custom-settings-bg: var(--panel);
  --custom-settings-row-bg: var(--panel-soft);
  --custom-settings-text: var(--text);
  --custom-media-picker-bg: var(--panel);
  --custom-media-picker-panel-bg: var(--panel);
  --custom-media-picker-item-bg: var(--panel-soft);
  --custom-media-picker-text: var(--text);
  --compose-glass-fill-top: rgba(255, 255, 255, .018);
  --compose-glass-fill-bottom: rgba(0, 0, 0, .031);
  --compose-glass-stroke: rgba(255, 255, 255, .172);
  --compose-glass-highlight: rgba(255, 255, 255, .045);
  --compose-glass-edge-glow: rgba(255, 255, 255, .018);
  --compose-glass-refraction-light: rgba(255, 255, 255, .035);
  --compose-glass-refraction-shadow: rgba(0, 0, 0, .063);
  --compose-glass-bottom-shadow: rgba(0, 0, 0, .031);
  --compose-glass-shadow: rgba(0, 0, 0, .28);
  --compose-glass-control: rgba(255, 255, 255, .08);
  --compose-glass-icon: #ffffff;
  --compose-glass-hint: #9c9c9c;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #eef3f7;
  --text: #101217;
  --muted: #5e6673;
  --line: #d8e0e8;
  --accent: #111827;
  --accent-text: #ffffff;
  --bubble-in: #ffffff;
  --bubble-out: #d8f7ef;
  --bubble-in-text: #121821;
  --danger: #d92d3a;
  --success: #20c978;
  --shadow: 0 24px 70px rgba(18, 24, 38, .12);
  --control: #e8edf3;
  --control-strong: #dce5ee;
  --overlay: rgba(244, 246, 248, .68);
  --compose-glass-fill-top: rgba(255, 255, 255, .018);
  --compose-glass-fill-bottom: rgba(0, 0, 0, .031);
  --compose-glass-stroke: rgba(255, 255, 255, .172);
  --compose-glass-highlight: rgba(255, 255, 255, .045);
  --compose-glass-edge-glow: rgba(255, 255, 255, .018);
  --compose-glass-refraction-light: rgba(255, 255, 255, .035);
  --compose-glass-refraction-shadow: rgba(0, 0, 0, .063);
  --compose-glass-bottom-shadow: rgba(0, 0, 0, .031);
  --compose-glass-shadow: rgba(36, 45, 58, .14);
  --compose-glass-control: rgba(255, 255, 255, .14);
  --compose-glass-icon: #27303d;
  --compose-glass-hint: rgba(39, 48, 61, .58);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  /* Android screen backgrounds stay separate from solid primary cards. */
  --custom-chat-header-bg: var(--bg);
  --custom-compose-bg: var(--bg);
  --custom-chat-list-bg: var(--bg);
  --custom-chat-list-header-bg: var(--bg);
  --custom-profile-bg: var(--bg);
  --custom-settings-bg: var(--bg);
  --custom-media-picker-bg: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell {
  height: 100%;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.community-invite-banner {
  position: fixed;
  z-index: 1200;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  width: min(620px, calc(100vw - 28px));
  transform: translateX(-50%);
}

.community-invite-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 24px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
  -webkit-backdrop-filter: blur(22px) saturate(1.16);
  backdrop-filter: blur(22px) saturate(1.16);
}

.community-invite-avatar {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  overflow: hidden;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-soft));
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.community-invite-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-invite-copy {
  min-width: 0;
  flex: 1;
}

.community-invite-copy > span,
.community-invite-copy > strong,
.community-invite-copy > p,
.community-invite-copy > small,
.community-invite-copy > em {
  display: block;
}

.community-invite-copy > span,
.community-invite-copy > small {
  color: var(--muted);
  font-size: 11px;
}

.community-invite-copy > strong {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-invite-copy > p {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-invite-copy > small {
  margin-top: 3px;
}

.community-invite-copy > em {
  margin-top: 5px;
  color: #d90b22;
  font-size: 11px;
  font-style: normal;
}

.community-invite-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.community-invite-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.community-invite-open-app {
  display: none;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 14px;
  background: #303579;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.community-invite-open-app img { width: 21px; height: 21px; border-radius: 7px; }

.community-invite-actions #communityInviteJoinBtn {
  background: var(--accent);
  color: var(--accent-text);
}

.community-invite-actions button:disabled {
  cursor: default;
  opacity: .52;
}

@media (max-width: 620px) {
  .community-invite-card {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .community-invite-copy {
    width: calc(100% - 76px);
  }

  .community-invite-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-left: 0;
  }

  .community-invite-open-app { display: inline-flex; flex: 1 0 100%; justify-content: center; }
}

.group-community-category-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}
.group-community-category-picker legend { grid-column: 1 / -1; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.group-community-category-picker label { min-width: 0; }
.group-community-category-picker input { position: absolute; opacity: 0; pointer-events: none; }
.group-community-category-picker span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--control);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.group-community-category-picker input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--control)); color: var(--text); }

.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(120px + env(safe-area-inset-bottom));
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.app-download-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  box-shadow: 0 18px 52px rgba(0, 0, 0, .16);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
}

.auth-download-panel {
  position: fixed;
  top: calc(18px + env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 5;
  width: min(360px, calc(100vw - 36px));
}

.app-download-panel strong {
  font-size: 14px;
}

.app-download-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.app-download-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--line) 68%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-soft) 68%, transparent);
  color: var(--text);
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.app-download-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--panel-soft) 86%, transparent);
}

.app-download-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
}

.app-download-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-download-btn b,
.app-download-btn em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-download-btn b {
  font-size: 14px;
}

.app-download-btn em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.brand-mark,
.empty-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
}

.brand-mark img,
.empty-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

h1,
h2,
p {
  margin: 0;
}

.auth-card h1 {
  margin-top: 18px;
  font-size: 28px;
}

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

.auth-card > .muted {
  margin-top: 8px;
  line-height: 1.5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 24px 0;
  padding: 4px;
  background: var(--panel-soft);
  border-radius: 16px;
}

.auth-tabs button {
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.auth-tabs button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .08);
}

.registration-code-entry { position: relative; display: block; margin-top: 10px; }
.registration-code-entry > input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; z-index: 1; cursor: text; }
.registration-code-boxes { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; }
.registration-code-boxes > span { display: grid; place-items: center; height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel-soft); color: var(--text); font-size: 22px; font-weight: 700; transition: background .18s, border-color .18s, color .18s; }
.registration-code-entry:focus-within .registration-code-boxes > span { border-color: var(--text); }
.registration-code-entry[data-result="success"] .registration-code-boxes > span { background: rgba(28,166,101,.16); border-color: #1ca665; color: #1ca665; }
.registration-code-entry[data-result="error"] .registration-code-boxes > span { background: rgba(219,57,68,.16); border-color: #db3944; color: #db3944; }
.auth-form {
  display: grid;
  gap: 14px;
}

#registerForm input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}

#registerProfileBlock { display: grid; gap: 14px; }

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

input {
  height: 48px;
  padding: 0 14px;
}

input:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
}

.primary-btn {
  height: 50px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
}

.secondary-btn {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control);
  color: var(--text);
  font-weight: 800;
}

.registration-resend {
  display: inline-block;
  width: auto;
  min-height: 32px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.registration-resend:hover:not(:disabled) { color: var(--text); text-decoration: underline; }
.registration-resend:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 6px; }
.registration-resend:disabled { opacity: .45; cursor: default; }

.form-message {
  min-height: 20px;
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.45;
}

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

.messenger {
  height: 100%;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
}

.sidebar,
.chat-pane {
  min-height: 0;
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--custom-chat-list-bg);
}

.sidebar-header,
.chat-header {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px;
  border-bottom: 1px solid var(--line);
}

.sidebar-header {
  justify-content: flex-start;
  align-items: center;
  background: var(--custom-chat-list-header-bg);
}

.sidebar-wordmark {
  padding: 4px 2px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.025em;
}

.current-user-card {
  display: grid;
  justify-items: start;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.sidebar-download-actions {
  order: 4;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.sidebar-download-actions .app-download-btn {
  min-height: 48px;
  padding: 7px 8px;
  border-radius: 15px;
}

.sidebar-download-actions .app-download-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
}

.sidebar-download-actions .app-download-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar-download-actions .app-download-btn b {
  font-size: 12px;
}

.sidebar-download-actions .app-download-btn em {
  font-size: 10px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-header h2,
.chat-title h2 {
  margin-top: 2px;
  font-size: 17px;
}

#currentUserName,
#currentUserAvatar,
#activeAvatar,
#activeName,
.message-avatar,
.chat-item .avatar,
.chat-name {
  cursor: pointer;
}

.icon-btn,
.send-btn {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.icon-btn:hover {
  background: var(--panel-soft);
}

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

.search-wrap {
  position: relative;
  padding: 8px 14px 10px;
}

.search-wrap .search-icon {
  position: absolute;
  left: 28px;
  top: 20px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.search-wrap .search-icon svg {
  width: 18px;
  height: 18px;
}

.search-wrap input {
  padding-left: 42px;
  height: 40px;
  border-radius: 999px;
  background: var(--custom-chat-list-search-bg);
  color: var(--custom-chat-list-text);
}

.chat-list {
  overflow-y: auto;
  height: 100%;
  padding: 6px 10px 84px;
}

.chat-list-shell {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
}

.chat-list-section-title {
  padding: 12px 10px 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.chat-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.game-chat-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid color-mix(in srgb, var(--success) 32%, var(--line));
  border-radius: 999px;
  color: var(--success);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .06em;
}
.game-chat-badge.category-game { color: #20a464; border-color: rgba(32,164,100,.42); background: rgba(32,164,100,.1); }
.game-chat-badge.category-work { color: #3987ff; border-color: rgba(57,135,255,.42); background: rgba(57,135,255,.1); }
.game-chat-badge.category-friends { color: #e0529c; border-color: rgba(224,82,156,.42); background: rgba(224,82,156,.1); }
.game-chat-badge.category-study { color: #9d6cff; border-color: rgba(157,108,255,.42); background: rgba(157,108,255,.1); }
.game-chat-badge.category-public { color: #d69013; border-color: rgba(214,144,19,.42); background: rgba(214,144,19,.1); }

.chat-create-fab {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 50%;
  color: var(--accent-text);
  background: var(--accent);
  box-shadow: 0 12px 30px rgba(0,0,0,.3);
}
.chat-create-fab:hover { transform: translateY(-2px); }
.chat-create-fab svg { width: 22px; height: 22px; }

.chat-create-menu {
  position: absolute;
  right: 16px;
  bottom: 76px;
  z-index: 8;
  width: min(286px, calc(100% - 28px));
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.chat-create-menu[hidden] { display: none; }
.chat-create-menu button {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: 13px;
  color: var(--text);
  background: transparent;
  text-align: left;
}
.chat-create-menu button:hover { background: var(--panel-soft); }
.chat-create-menu button > span:last-child { display: grid; gap: 2px; }
.chat-create-menu button small { color: var(--muted); font-size: 10px; }
.chat-create-menu-icon { width: 36px; height: 36px; border-radius: 12px; background: var(--panel-soft); }
.chat-create-menu-icon.standard::before,
.chat-create-menu-icon.standard::after { content: ""; position: absolute; }
.chat-create-menu-icon { position: relative; }
.chat-create-menu-icon.standard::before { inset: 10px 8px 12px; border: 2px solid currentColor; border-radius: 7px; }
.chat-create-menu-icon.standard::after { left: 11px; bottom: 8px; width: 7px; height: 7px; border-left: 2px solid currentColor; transform: rotate(-35deg); }
.chat-create-menu-icon.game::before { content: "#"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--success); font-size: 19px; font-weight: 900; }

.sidebar-bottom-island {
  --dock-tabs: 3;
  position: relative;
  isolation: isolate;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(var(--dock-tabs), minmax(0,1fr));
  gap: 0;
  margin: 8px 10px max(10px, env(safe-area-inset-bottom));
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  box-shadow: 0 10px 30px rgba(0,0,0,.24);
  backdrop-filter: blur(18px);
}
.sidebar-bottom-island::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / var(--dock-tabs));
  border: 1px solid color-mix(in srgb, var(--text) 20%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent);
  transition: transform 320ms cubic-bezier(.2,.8,.2,1);
}
.sidebar-bottom-island[data-active="1"]::before { transform: translateX(100%); }
.sidebar-bottom-island[data-active="2"]::before { transform: translateX(200%); }
.sidebar-bottom-island[data-active="-1"]::before { opacity: 0; }
.sidebar-bottom-island button[hidden] { display: none; }
.sidebar-bottom-island button {
  min-width: 0;
  min-height: 54px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
}
.sidebar-bottom-island button:hover { color: var(--text); background: color-mix(in srgb, var(--text) 4%, transparent); }
.sidebar-bottom-island button.active { color: var(--text); }
.sidebar-bottom-island b { overflow: hidden; max-width: 100%; font-size: 12px; text-overflow: ellipsis; }
.sidebar-nav-icon { display: grid; place-items: center; width: 26px; height: 26px; }
.sidebar-nav-icon svg { width: 26px; height: 26px; overflow: visible; }
.sidebar-nav-icon.chats path { transform-box: fill-box; transform-origin: center; }
.sidebar-bottom-island .current-user-avatar { width: 26px; height: 26px; border-radius: 50%; font-size: 10px; }
.calls-panel { position:absolute; inset:0; z-index:16; overflow-y:auto; padding:24px; background:var(--custom-chat-bg, var(--bg)); }
.calls-panel[hidden] { display:none; }
.calls-label { max-width:880px; margin:0 auto 14px; color:var(--text); font-size:28px; line-height:34px; font-weight:700; text-align:left; }
.calls-status { color:var(--muted); font-size:13px; }
.calls-status,.calls-list { max-width:880px; margin:0 auto 16px; }
.calls-status:empty { display:none; }
.calls-list { display:grid; gap:10px; }
.call-history-row { display:grid; grid-template-columns:48px minmax(0,1fr) 44px; align-items:center; gap:12px; padding:14px; border-radius:28px; }
.call-history-row .avatar { width:48px; height:48px; }
.call-history-main { display:grid; gap:4px; min-width:0; }
.call-history-main strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.call-history-main span,.call-history-main time { font-size:12px; line-height:1.4; color:var(--muted); }
.call-history-row.missed .call-history-main span { color:var(--danger); }
.call-history-recall { width:44px; height:44px; padding:10px; display:grid; place-items:center; border-radius:50%; }
.call-history-recall svg { width:24px; height:24px; }
.calls-more { display:block; margin:16px auto; border-radius:999px; }
.calls-more[hidden] { display:none; }
.messenger.calls-tab-open > .chat-pane { display:block; }
.messenger.calls-tab-open .conversation,.messenger.calls-tab-open .empty-state { visibility:hidden; pointer-events:none; }
.call-history-row,.call-history-recall,.calls-more {
  background:linear-gradient(145deg,var(--compose-glass-fill-top),var(--compose-glass-fill-bottom)),var(--floating-surface);
  border:1px solid var(--compose-glass-stroke); color:var(--text);
  backdrop-filter:blur(28px) saturate(1.25); -webkit-backdrop-filter:blur(28px) saturate(1.25);
  box-shadow:inset 0 1px 0 var(--compose-glass-highlight),0 8px 24px rgba(0,0,0,.08);
}
.call-history-recall:hover { background:var(--panel-soft); }
.call-history-recall:focus-visible { outline:2px solid var(--text); outline-offset:3px; }
@media(max-width:760px) {
  .sidebar-bottom-island button { min-height:48px; gap:0; padding:2px 4px; }
  .sidebar-nav-icon,.sidebar-nav-icon svg,.sidebar-bottom-island .current-user-avatar { width:24px; height:24px; }
  .sidebar-bottom-island b { font-size:12px; line-height:14px; }
  .messenger.calls-tab-open { position:relative; }
  .messenger.calls-tab-open > .sidebar { display:flex; position:absolute; inset:auto 0 0; z-index:25; height:82px; border:0; background:transparent; pointer-events:none; }
  .messenger.calls-tab-open > .sidebar > :not(.sidebar-bottom-island) { display:none; }
  .messenger.calls-tab-open .sidebar-bottom-island { pointer-events:auto; }
  .calls-panel { padding:calc(18px + env(safe-area-inset-top)) 12px calc(88px + env(safe-area-inset-bottom)); }
  .call-history-row { padding:12px; gap:10px; }
}
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.group-experience-picker {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}
.group-experience-picker legend { margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }
.group-experience-picker label { position: relative; }
.group-experience-picker input { position: absolute; opacity: 0; pointer-events: none; }
.group-experience-picker label > span {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: var(--control);
}
.group-experience-picker label > span small { color: var(--muted); font-size: 11px; }
.group-experience-picker input:checked + span { border-color: color-mix(in srgb, var(--accent) 62%, var(--line)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent); }

.group-icon-field > button {
  width: 100%;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--text);
  background: var(--control);
  text-align: left;
}
.group-icon-field > button:hover { border-color: color-mix(in srgb, var(--accent) 48%, var(--line)); }
.group-icon-field > button > span:last-child { display: grid; gap: 3px; min-width: 0; }
.group-icon-field small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.group-icon-preview { width: 54px; height: 54px; border-radius: 17px; font-size: 13px; }
.group-icon-field > .group-icon-edit-btn {
  display: inline-flex;
  width: auto;
  margin: 8px 0 0 auto;
  padding: 7px 11px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: transparent;
}
.group-icon-field > .group-icon-edit-btn:hover { color: var(--text); background: var(--panel-soft); }
.group-icon-edit-btn[hidden] { display: none !important; }

.group-icon-editor { z-index: 110; }
.group-icon-editor-sheet {
  width: min(460px, 100%);
  overflow: hidden;
}
.group-icon-editor-sheet .profile-top {
  grid-template-columns: minmax(0, 1fr) 42px;
}
.group-icon-editor-sheet .profile-top > div { min-width: 0; padding-left: 4px; }
.group-icon-editor-sheet .profile-top h3 { text-align: left; }
.group-icon-editor-sheet .profile-top small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.group-icon-editor-sheet .profile-top .playback-icon-btn { grid-column: 2; }
.group-icon-crop-stage {
  width: min(340px, calc(100vw - 72px));
  aspect-ratio: 1;
  justify-self: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 28%;
  background:
    linear-gradient(45deg, var(--panel-soft) 25%, transparent 25%, transparent 75%, var(--panel-soft) 75%),
    linear-gradient(45deg, var(--panel-soft) 25%, transparent 25%, transparent 75%, var(--panel-soft) 75%),
    var(--control);
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, white 5%, transparent);
  touch-action: none;
  user-select: none;
}
.group-icon-crop-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.group-icon-crop-stage canvas.dragging { cursor: grabbing; }
.group-icon-editor.loading .group-icon-crop-stage {
  position: relative;
  opacity: .55;
}
.group-icon-editor.loading .group-icon-crop-stage::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  content: "Загрузка…";
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  background: color-mix(in srgb, var(--panel) 58%, transparent);
  backdrop-filter: blur(5px);
}
.group-icon-editor-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}
.group-icon-rotate-controls {
  display: inline-grid;
  grid-template-columns: repeat(2, 42px);
  gap: 6px;
}
.group-icon-rotate-controls button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: var(--control);
}
.group-icon-rotate-controls button:hover { border-color: color-mix(in srgb, var(--accent) 48%, var(--line)); }
.group-icon-rotate-controls svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.group-icon-zoom-control { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 750; }
.group-icon-zoom-control input { width: 100%; height: 22px; padding: 0; accent-color: var(--accent); }
.group-icon-editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.group-icon-editor-actions button { height: 46px; }

@media (max-width: 520px) {
  .group-icon-editor { padding: 10px; }
  .group-icon-editor-sheet { max-height: calc(100dvh - 20px); border-radius: 22px; }
  .group-icon-crop-stage { width: min(320px, calc(100vw - 52px)); }
  .group-icon-editor-controls { grid-template-columns: 1fr; }
  .group-icon-rotate-controls { justify-content: center; }
}

.chat-item {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 18px;
  padding: 11px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.chat-item:hover,
.chat-item.active {
  background: color-mix(in srgb, var(--custom-chat-row-bg) 72%, var(--panel-soft));
}

.chat-item {
  background: var(--custom-chat-row-bg);
}

.chat-name {
  color: var(--custom-chat-list-text);
}

.chat-preview,
.chat-time {
  color: var(--custom-chat-list-muted);
}

.avatar {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 800;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 16px;
}

.current-user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 18px;
}

.message-avatar {
  align-self: flex-end;
  width: 30px;
  height: 30px;
  margin-right: 8px;
  border-radius: 50%;
  font-size: 11px;
}

.message-avatar img,
.header-avatar img,
.chat-item .avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-main {
  min-width: 0;
}

.chat-name,
.chat-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-name {
  font-weight: 800;
}

.chat-preview,
.chat-time {
  color: var(--custom-chat-list-muted);
  font-size: 13px;
}

.chat-pane {
  background: var(--custom-chat-bg);
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}

.coming-soon-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.coming-soon-card {
  display: grid;
  gap: 18px;
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.coming-soon-card h1 {
  margin: 0;
  font-size: 28px;
}

.conversation {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto;
  min-width: 0;
  background: transparent;
  isolation: isolate;
  --floating-header-top: calc(10px + env(safe-area-inset-top));
  --floating-header-height: 58px;
  --floating-header-gap: 10px;
  --floating-pinned-height: 46px;
  --floating-compose-height: 52px;
}

.conversation::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--chat-wallpaper-image, transparent);
  background-size: cover;
  background-position: center;
  opacity: 0;
}

.conversation[data-wallpaper="on"]::before {
  opacity: 1;
}

.conversation[data-wallpaper="on"]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: color-mix(in srgb, var(--bg) 42%, transparent);
}

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

.liquid-glass {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--compose-glass-stroke);
  border-radius: 999px;
  background-color: transparent;
  background:
    linear-gradient(180deg, var(--compose-glass-fill-top), transparent 18%, transparent 78%, var(--compose-glass-fill-bottom));
  box-shadow:
    inset 0 -1px 0 var(--compose-glass-bottom-shadow),
    0 14px 34px var(--compose-glass-shadow);
  -webkit-backdrop-filter: blur(4px) saturate(.72);
  backdrop-filter: blur(4px) saturate(.72);
}

.liquid-glass::before,
.liquid-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
}

.liquid-glass::before {
  border: 1px solid var(--compose-glass-edge-glow);
  background:
    linear-gradient(180deg, transparent, transparent 72%, var(--compose-glass-refraction-shadow));
  -webkit-backdrop-filter: blur(1px) saturate(.72);
  backdrop-filter: blur(1px) saturate(.72);
}

.liquid-glass::after {
  inset: 1px;
  background: transparent;
  opacity: .72;
}

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

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .liquid-glass {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06)),
      color-mix(in srgb, var(--custom-compose-bg) 76%, transparent);
  }
}

.playback-panel {
  position: absolute;
  top: calc(var(--floating-header-top) + var(--floating-header-height) + 8px);
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  z-index: 20;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px clamp(12px, 2vw, 20px);
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: 0 12px 38px rgba(0, 0, 0, .12);
  backdrop-filter: blur(18px);
}

.playback-panel[hidden] {
  display: none !important;
}

.playback-icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel-soft) 78%, transparent);
  color: var(--text);
}

.playback-icon-btn.danger {
  color: var(--danger);
}

.playback-info {
  min-width: 0;
}

.playback-info strong,
.playback-info span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playback-info strong {
  font-size: 14px;
}

.playback-info span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.playback-progress {
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 24%, transparent);
  cursor: pointer;
  touch-action: none;
}

.playback-progress div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .16s linear;
}

.chat-header {
  min-height: 58px;
  padding-top: 5px;
  padding-bottom: 5px;
  background: transparent;
  border-bottom: 0;
}

.chat-header-glass {
  position: absolute;
  top: var(--floating-header-top);
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  z-index: 24;
  height: var(--floating-header-height);
  min-height: 0;
  padding: 6px 10px;
  border-radius: 999px;
  box-sizing: border-box;
}

.chat-header-glass .avatar {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
}

.chat-title {
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.chat-title h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  line-height: 1.1;
}

.chat-title p {
  margin-top: 1px;
  font-size: 12px;
  line-height: 1.15;
}

.chat-call-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

.chat-header-glass .chat-call-actions {
  align-self: center;
}

.chat-header-glass .icon-btn {
  width: 34px;
  height: 34px;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, .12), transparent 42%),
    color-mix(in srgb, var(--custom-icon-bg) 18%, var(--compose-glass-control));
  color: var(--compose-glass-icon);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .16),
    inset 0 -1px 0 rgba(0, 0, 0, .10);
}

.chat-header-glass .icon-btn:hover {
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, .18), transparent 44%),
    color-mix(in srgb, var(--custom-icon-bg) 24%, var(--compose-glass-control));
}

.pinned-bar {
  position: absolute;
  top: calc(var(--floating-header-top) + var(--floating-header-height) + 8px);
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  z-index: 23;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  height: var(--floating-pinned-height);
  min-height: 0;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
}

.pinned-main-btn {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  padding: 0 8px;
  text-align: left;
}
.pinned-main-btn > span:last-child { min-width: 0; }

.pinned-main-btn:hover {
  background: color-mix(in srgb, var(--compose-glass-control) 72%, transparent);
}

.pinned-bar .playback-icon-btn {
  width: 34px;
  height: 34px;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, .12), transparent 42%),
    color-mix(in srgb, var(--custom-icon-bg) 18%, var(--compose-glass-control));
  color: var(--compose-glass-icon);
}

.pinned-marker {
  width: 4px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
}

.pinned-main-btn strong,
.pinned-main-btn em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinned-main-btn strong {
  font-size: 13px;
  line-height: 15px;
}

.pinned-main-btn em {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
  line-height: 14px;
  font-style: normal;
}

.scroll-bottom-btn {
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 12;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.message-jump-highlight .message-bubble {
  animation: jumpPulse 1.15s ease;
}

@keyframes jumpPulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(0, 0, 0, .04); }
  35% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 24%, transparent); }
}

.messages-list {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  position: relative;
  z-index: 1;
  overflow-y: auto;
  height: 100%;
  padding:
    calc(var(--floating-header-top) + var(--floating-header-height) + 20px)
    clamp(12px, 4vw, 44px)
    calc(var(--floating-compose-height) + 48px + env(safe-area-inset-bottom));
  scroll-padding-top: calc(var(--floating-header-top) + var(--floating-header-height) + 20px);
  scroll-padding-bottom: calc(var(--floating-compose-height) + 48px + env(safe-area-inset-bottom));
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.messages-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.conversation:has(.pinned-bar:not([hidden])) .messages-list {
  padding-top: calc(var(--floating-header-top) + var(--floating-header-height) + var(--floating-pinned-height) + 36px);
  scroll-padding-top: calc(var(--floating-header-top) + var(--floating-header-height) + var(--floating-pinned-height) + 36px);
}

.conversation:has(.playback-panel:not([hidden])) .messages-list {
  padding-top: calc(var(--floating-header-top) + var(--floating-header-height) + 86px);
  scroll-padding-top: calc(var(--floating-header-top) + var(--floating-header-height) + 86px);
}

.conversation:has(.pinned-bar:not([hidden])) .playback-panel {
  top: calc(var(--floating-header-top) + var(--floating-header-height) + var(--floating-pinned-height) + 16px);
}

.conversation:has(.pinned-bar:not([hidden])):has(.playback-panel:not([hidden])) .messages-list {
  padding-top: calc(var(--floating-header-top) + var(--floating-header-height) + var(--floating-pinned-height) + 102px);
  scroll-padding-top: calc(var(--floating-header-top) + var(--floating-header-height) + var(--floating-pinned-height) + 102px);
}

.message-row {
  display: flex;
  align-items: flex-end;
  margin: 7px 0;
}

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

.message-bubble {
  max-width: min(620px, 78%);
  padding: 10px 12px 7px;
  border-radius: 18px;
  background: linear-gradient(90deg, var(--custom-message-in-left), var(--custom-message-in-center), var(--custom-message-in-right));
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .04);
  color: var(--custom-message-text);
  font-size: var(--custom-message-font-size);
}

.message-row.in .message-bubble {
  color: var(--custom-message-text, var(--bubble-in-text));
}

.message-row.in .message-meta {
  color: var(--custom-message-meta, #627083);
}

.message-time {
  color: var(--custom-message-meta, #627083);
  font-size: 11px;
  line-height: 1;
  user-select: none;
  white-space: nowrap;
}

.message-time-in {
  align-self: flex-end;
  margin: 0 6px 8px 4px;
}

.media-row .message-bubble {
  padding: 6px;
}

.message-row.out .message-bubble {
  background: linear-gradient(90deg, var(--custom-message-out-left), var(--custom-message-out-center), var(--custom-message-out-right));
}

.message-row.sticker-row .message-bubble,
.message-row.round-video-row .message-bubble,
.message-row.audio-row .message-bubble {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.message-row.sticker-row .message-meta,
.message-row.round-video-row .message-meta,
.message-row.audio-row .message-meta {
  padding: 0 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.message-row.call-row {
  justify-content: center;
  align-items: center;
  margin: 5px 0;
}

.message-row.call-row > .message-avatar,
.message-row.call-row > .message-time,
.message-row.call-row .message-bubble > .message-meta,
.message-row.call-row .message-bubble > .message-reply-preview {
  display: none;
}

.message-row.call-row .message-bubble {
  max-width: min(540px, 94%);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.call-event {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 19px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-soft) 80%, transparent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  backdrop-filter: blur(14px) saturate(1.08);
}

.call-event.missed {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
  background: color-mix(in srgb, var(--danger) 13%, transparent);
}

.call-event-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.call-event-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.call-event strong {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.call-event-detail {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.call-event.missed .call-event-detail {
  color: var(--danger);
}

.message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--custom-message-meta);
  font-size: 11px;
}

.message-receipt { white-space: nowrap; user-select: none; }
.message-receipt svg { display: block; width: 18px; height: 18px; flex: none; }
.message-receipt .receipt-read { width: 22px; }
.receipt-failed { color: var(--danger); font-weight: 800; }
.message-row.media-row:has(.image-card, .video-card) .message-bubble {
  background: transparent; border: 0; box-shadow: none; padding: 0;
}
.media-card .media-receipt {
  position: absolute; bottom: 8px; right: 8px; z-index: 2; margin: 0;
  padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.42);
  color: white; pointer-events: none; text-shadow: none;
}
.round-video-card .media-receipt { bottom: 25px; right: 26px; }

.message-pinned {
  justify-content: flex-start;
  color: var(--accent);
  font-weight: 800;
}

.message-pinned svg {
  width: 13px;
  height: 13px;
}

.message-reply-preview,
.reply-compose-preview {
  display: grid;
  gap: 2px;
  min-width: 0;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--panel-soft) 62%, transparent);
}

.message-reply-preview {
  margin-bottom: 7px;
  padding: 7px 9px;
  border-radius: 11px;
}

.message-reply-preview strong,
.message-reply-preview span,
.reply-compose-preview strong,
.reply-compose-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-reply-preview strong,
.reply-compose-preview strong {
  color: var(--accent);
  font-size: 12px;
}

.message-reply-preview span,
.reply-compose-preview span {
  color: var(--muted);
  font-size: 12px;
}

.reply-compose-preview {
  grid-row: 5;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  width: min(620px, calc(100vw - 28px));
  justify-self: center;
  margin: 0 max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  padding: 9px 10px 9px 12px;
  border-radius: 18px;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .12);
  backdrop-filter: blur(14px);
}

.composer {
  --compose-control-size: 38px;
  --compose-control-icon-size: 22px;
  display: grid;
  grid-template-columns: var(--compose-control-size) minmax(0, 1fr) var(--compose-control-size) var(--compose-control-size);
  gap: 6px;
  align-items: center;
  margin: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  padding: 6px;
  border-radius: 999px;
}

.chat-compose-glass {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 24;
  min-height: var(--floating-compose-height);
  margin: 0;
  box-sizing: border-box;
  overflow: visible;
}

.composer.voice-active {
  grid-template-columns: var(--compose-control-size) minmax(0, 1fr) var(--compose-control-size) var(--compose-control-size);
}

.composer.voice-active #attachBtn,
.composer.voice-active #messageInput {
  display: none;
}

.composer.voice-active #emojiBtn {
  grid-column: 1;
  grid-row: 1;
}

.voice-composer-info {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
  height: 38px;
  padding: 0 6px;
  color: var(--text);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.voice-composer-info i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--danger);
  animation: recordPulse 1.1s ease-in-out infinite;
}

.voice-composer-cancel {
  grid-column: 3;
  grid-row: 1;
}

.composer.voice-active #actionBtn {
  grid-column: 4;
  grid-row: 1;
  width: 38px;
  height: 38px;
  border-radius: 999px;
}

.voice-lock-target {
  position: absolute;
  right: 13px;
  bottom: calc(100% + 22px);
  z-index: 28;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--custom-compose-bg) 94%, transparent);
  color: var(--muted);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
  backdrop-filter: blur(14px);
  pointer-events: auto;
  transition: transform .16s ease, color .16s ease, background .16s ease;
}

.composer textarea,
.composer input {
  background: var(--custom-input-bg);
}

.compose-icon-btn,
.icon-btn {
  color: var(--custom-icon-color);
}

.compose-icon-btn:not(.danger),
.icon-btn:not(.danger) {
  background: var(--custom-icon-bg);
}

.voice-lock-target svg {
  width: 21px;
  height: 21px;
}

.voice-lock-target.active {
  color: var(--accent-text);
  background: var(--accent);
  transform: translateY(-3px) scale(1.04);
}

.compose-icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-soft) 86%, transparent);
  color: var(--text);
}

.compose-icon-btn.dark {
  background: var(--accent);
  color: var(--accent-text);
}

.compose-icon-btn.danger {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.composer textarea {
  min-height: 34px;
  max-height: 104px;
  resize: none;
  overflow-y: hidden;
  overflow-x: hidden;
  border: 0;
  background: var(--custom-input-bg);
  padding: 7px 10px;
  line-height: 1.25;
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
}

.compose-icon-btn:not(.danger):not(.dark),
.icon-btn:not(.danger) {
  background: var(--custom-icon-bg);
  color: var(--custom-icon-color);
}

.composer textarea,
.composer input {
  background: transparent;
  color: var(--text);
}

.composer textarea::placeholder {
  color: var(--compose-glass-hint);
}

.composer .compose-icon-btn,
.composer .send-btn {
  box-sizing: border-box;
  width: var(--compose-control-size);
  height: var(--compose-control-size);
  min-width: var(--compose-control-size);
  min-height: var(--compose-control-size);
  padding: 0;
  border: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .18),
    inset 0 -1px 0 rgba(0, 0, 0, .12),
    0 5px 14px rgba(0, 0, 0, .12);
  transition: transform .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}

.composer #emojiBtn svg,
.composer #attachBtn svg,
.composer #actionBtn svg,
.composer #voiceCancelBtn svg {
  width: var(--compose-control-icon-size);
  height: var(--compose-control-icon-size);
}

.composer .compose-icon-btn:not(.danger):not(.dark) {
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, .12), transparent 42%),
    color-mix(in srgb, var(--custom-icon-bg) 18%, var(--compose-glass-control));
  color: var(--compose-glass-icon);
}

.composer .send-btn,
.composer.voice-active #actionBtn {
  background:
    radial-gradient(circle at 35% 22%, rgba(255, 255, 255, .20), transparent 42%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 94%, transparent), color-mix(in srgb, var(--accent) 78%, transparent));
  color: var(--accent-text);
}

.composer .compose-icon-btn:hover,
.composer .send-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 -1px 0 rgba(0, 0, 0, .14),
    0 8px 18px rgba(0, 0, 0, .16);
}

.sidebar .icon-btn:not(.danger) {
  background: var(--custom-chat-list-button-bg);
  color: var(--custom-chat-list-button-icon);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--success);
}

.media-card {
  position: relative;
  display: block;
  overflow: hidden;
  width: min(340px, 72vw);
  min-height: 120px;
  border: 0;
  border-radius: 16px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 0;
}

.media-main-button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.image-card img,
.video-card video {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.image-card img {
  aspect-ratio: 4 / 3;
}

.video-card video {
  aspect-ratio: 16 / 10;
  background: #000;
}

.round-video-card {
  width: clamp(190px, 24vw, 250px);
  height: clamp(190px, 24vw, 250px);
  min-height: 0;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  clip-path: circle(50% at 50% 50%);
}

.custom-round-player {
  cursor: pointer;
}

.custom-round-player.playing {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}

.round-video-card video {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  clip-path: circle(50% at 50% 50%);
}

.round-video-card .media-download-btn {
  top: 12px;
  right: 24px;
}

.round-video-card .media-open-btn {
  right: 24px;
  bottom: 16px;
}

.media-fallback {
  display: none;
  padding: 42px 18px;
  color: var(--muted);
}

.media-error img {
  display: none;
}

.media-error .media-fallback {
  display: block;
}

.media-open-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .58);
  color: white;
}

.video-card:not(.round-video-card) .media-open-btn {
  left: 50%; top: 50%; right: auto; bottom: auto;
  transform: translate(-50%, -50%);
}

.media-download-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .58);
  color: white;
}

.sticker-message {
  display: grid;
  place-items: center;
  width: 158px;
  height: 158px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  padding: 0;
}

.sticker-message img {
  max-width: 150px;
  max-height: 150px;
  object-fit: contain;
}

.sticker-message span {
  display: none;
  color: var(--muted);
  font-size: 12px;
}

.sticker-message.sticker-error img {
  display: none;
}

.sticker-message.sticker-error span {
  display: block;
}

.emoji-sticker-panel {
  position: absolute;
  right: max(66px, calc(66px + env(safe-area-inset-right)));
  bottom: calc(var(--floating-compose-height) + 18px + env(safe-area-inset-bottom));
  z-index: 26;
  display: flex;
  flex-direction: column;
  width: min(392px, calc(100vw - 28px));
  max-height: min(430px, 58vh);
  margin: 0;
  border-radius: 22px;
  overflow: hidden;
  padding: 8px;
}

.picker-tabs {
  order: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  gap: 0;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--compose-glass-control) 76%, transparent);
  overflow: hidden;
}

.picker-tabs::before {
  content: "";
  position: absolute;
  inset: 6px auto 6px 6px;
  width: calc(50% - 6px);
  border-radius: 999px;
  background: var(--accent);
  transition: transform .22s ease;
}

.picker-tabs.stickers-active::before {
  transform: translateX(100%);
}

.picker-tabs button,
.emoji-categories button,
.sticker-pack-chips button,
.picker-icon-btn {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-weight: 800;
}

.picker-tabs button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  color: var(--muted);
}

.picker-tabs button svg,
.picker-icon-btn svg,
#emojiBtn svg {
  width: 20px;
  height: 20px;
}

.picker-tabs button.active,
.emoji-categories button.active,
.sticker-pack-chips button.active {
  color: var(--accent-text);
}

.emoji-categories button.active,
.sticker-pack-chips button.active {
  background: var(--accent);
}

.picker-page {
  order: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.emoji-categories,
.sticker-toolbar,
.sticker-pack-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.emoji-categories,
.sticker-pack-chips {
  overflow-x: auto;
  scrollbar-width: none;
}

.emoji-categories {
  order: 2;
  margin-top: 8px;
  padding: 5px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--compose-glass-control) 62%, transparent);
}

.emoji-categories button {
  flex: 0 0 34px;
  min-width: 34px;
  height: 34px;
  font-size: 18px;
}

.emoji-grid {
  order: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  max-height: 270px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 2px 4px;
}

.emoji-grid::-webkit-scrollbar,
.sticker-grid::-webkit-scrollbar {
  width: 7px;
}

.emoji-grid::-webkit-scrollbar-thumb,
.sticker-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 42%, transparent);
}

.emoji-grid button {
  aspect-ratio: 1 / 1;
  min-height: 40px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  font-size: 25px;
}

.emoji-grid button:hover,
.sticker-picker-item:hover {
  background: color-mix(in srgb, var(--compose-glass-control) 80%, transparent);
}

.sticker-toolbar {
  order: 1;
  gap: 8px;
  padding: 2px 2px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.sticker-pack-chips {
  flex: 1;
}

.sticker-pack-chips button {
  height: 38px;
  white-space: nowrap;
  padding: 0 14px;
  background: color-mix(in srgb, var(--panel-soft) 72%, transparent);
}

.picker-icon-btn {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel-soft) 76%, transparent);
  color: var(--text);
}

.picker-icon-btn.danger {
  color: var(--danger);
}

.picker-icon-btn:disabled {
  opacity: .38;
}

.sticker-grid {
  order: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: 292px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 0 2px;
}

.sticker-picker-item {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 82px;
  border-radius: 18px;
}

.sticker-picker-item > button:first-child {
  display: grid;
  place-items: center;
  width: 100%;
  height: 82px;
  border: 0;
  background: transparent;
  border-radius: 18px;
}

.sticker-picker-item img {
  max-width: 76px;
  max-height: 76px;
  object-fit: contain;
}

.sticker-item-actions {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s ease;
}

.sticker-picker-item:hover .sticker-item-actions {
  opacity: 1;
}

.sticker-item-actions button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .62);
  color: white;
}

.sticker-empty {
  order: 3;
  padding: 24px 10px;
  color: var(--muted);
  text-align: center;
}

.bottom-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 18px;
  background: color-mix(in srgb, var(--bg) 54%, transparent);
}

.bottom-sheet {
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 24px;
  background: color-mix(in srgb, var(--panel) 98%, transparent);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 16px;
}

.bottom-sheet header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.bottom-sheet h3,
.bottom-sheet h4 {
  margin: 0;
}

.bottom-sheet h4 {
  margin-top: 16px;
  margin-bottom: 9px;
  font-size: 15px;
}

.sticker-context-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}

.sticker-context-item {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-soft) 72%, transparent);
}

.sticker-context-item img {
  max-width: 84%;
  max-height: 84%;
  object-fit: contain;
}

.sticker-context-empty {
  grid-column: 1 / -1;
  padding: 28px 10px;
  color: var(--muted);
  text-align: center;
}

.sticker-context-pack-block {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.sticker-context-sheet .primary-btn {
  width: 100%;
  margin-top: 14px;
  border-radius: 999px;
}

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.wallpaper-option {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 18px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 8px;
  font-weight: 800;
}

.wallpaper-option span {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
}

.wallpaper-option strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.wallpaper-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.wallpaper-action-option span svg {
  width: 26px;
  height: 26px;
}

.audio-card,
.file-card {
  display: grid;
  align-items: center;
  gap: 12px;
  width: min(360px, 72vw);
  min-width: 0;
  max-width: 360px;
  padding: 10px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel-soft) 74%, transparent);
}

.audio-card {
  grid-template-columns: 42px minmax(160px, 1fr) auto 42px;
}

.voice-player {
  grid-template-columns: 48px minmax(0, 1fr) auto 42px;
  width: min(390px, 74vw);
  max-width: 390px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel-soft) 78%, transparent);
}

.voice-player audio {
  display: none;
}

.voice-play-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-text);
}

.voice-wave {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 42%, transparent);
  padding: 8px 10px;
}

.voice-wave::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--played, 0%);
  border-radius: inherit;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  transition: width .16s linear;
}

.voice-wave span {
  position: relative;
  z-index: 1;
  flex: 1 1 2px;
  min-width: 2px;
  max-width: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 70%, transparent);
}

.voice-player.playing .voice-wave span {
  background: color-mix(in srgb, var(--accent) 70%, var(--muted));
}

.voice-player .audio-duration {
  min-width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.file-card {
  grid-template-columns: 42px minmax(0, 1fr) 42px;
}

.audio-icon,
.file-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-text);
}

.audio-card audio {
  width: 100%;
  min-width: 150px;
  max-width: 210px;
  height: 38px;
}

.audio-duration,
.file-size {
  color: var(--muted);
  font-size: 12px;
}

.file-info {
  min-width: 0;
}

.file-name {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-action {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
}

.upload-state {
  margin-top: 8px;
  padding: 8px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}

.upload-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 74%, transparent);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
  transition: width .18s ease;
}

.upload-state.failed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--danger);
  font-size: 12px;
}

.upload-actions {
  display: flex;
  gap: 6px;
}

.upload-actions button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
}

.voice-panel {
  position: absolute;
  right: max(72px, calc(72px + env(safe-area-inset-right)));
  bottom: calc(var(--floating-compose-height) + 18px + env(safe-area-inset-bottom));
  z-index: 25;
  display: grid;
  grid-template-columns: 10px minmax(120px, 1fr);
  align-items: center;
  gap: 10px;
  width: min(430px, calc(100vw - 28px));
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 24px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .16);
  backdrop-filter: blur(14px);
  min-width: 0;
  min-height: 68px;
}

.record-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--danger);
  animation: recordPulse 1.1s ease-in-out infinite;
}

.voice-panel-text {
  display: grid;
  flex: 0 1 230px;
  min-width: 0;
  max-width: 240px;
}

.voice-panel-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.voice-hint {
  display: none;
}

.voice-record-wave {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  overflow: hidden;
  padding: 5px 6px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel-soft) 64%, transparent);
}

.voice-record-wave span {
  flex: 1 1 2px;
  min-width: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 72%, var(--muted));
}

.voice-panel.locked .voice-hint {
  color: var(--success);
}

.voice-panel.cancel-armed .voice-hint {
  color: var(--danger);
}

.voice-panel audio {
  display: none;
}

.voice-panel .compose-icon-btn {
  display: none;
}

.voice-send-btn {
  display: none;
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px);
}

.drop-overlay div {
  display: grid;
  place-items: center;
  width: min(420px, 90vw);
  min-height: 150px;
  border: 2px dashed color-mix(in srgb, var(--accent) 56%, var(--line));
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.call-dialog {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 18px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(12px);
}

.incoming-call-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: min(390px, 100%);
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 26px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: var(--shadow);
}

.call-avatar {
  width: 64px;
  height: 64px;
  border-radius: 22px;
}

.incoming-call-copy {
  min-width: 0;
}

.incoming-call-card h3 {
  margin: 2px 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incoming-call-card p {
  margin: 0;
  color: var(--muted);
}

.incoming-call-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 18px;
  padding-top: 6px;
}

.call-round-btn,
.call-control-btn {
  display: grid;
  place-items: center;
  border: 0;
  color: white;
}

.call-round-btn {
  width: 58px;
  height: 58px;
  border-radius: 22px;
}

.call-round-btn.accept {
  background: var(--success);
}

.call-round-btn.danger,
.call-control-btn.danger {
  background: var(--danger);
}

.active-call-overlay {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 90;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 300px;
  min-height: 360px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: hidden;
  resize: both;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 24px;
  background: radial-gradient(circle at 50% 18%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 46%), color-mix(in srgb, var(--panel) 96%, transparent);
  color: var(--text);
  box-shadow: 0 22px 80px rgba(0, 0, 0, .38);
  backdrop-filter: blur(18px);
}

.active-call-overlay.maximized {
  inset: 10px;
  width: auto;
  height: auto;
  resize: none;
  border-radius: 24px;
}

.active-call-stage {
  grid-row: 2;
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 34%, #10151a);
}

.remote-call-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.active-call-stage audio {
  display: none;
}

.call-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 100%;
  text-align: center;
}

.call-placeholder .call-avatar {
  width: clamp(76px, 20vmin, 132px);
  height: clamp(76px, 20vmin, 132px);
  border-radius: 34%;
  font-size: clamp(24px, 7vmin, 42px);
  background: color-mix(in srgb, white 18%, transparent);
}

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

.local-call-video {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: min(112px, 30%);
  aspect-ratio: 9 / 14;
  border: 2px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 18px;
  object-fit: cover;
  background: #000;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

.active-call-top {
  grid-row: 1;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 54px;
  padding: 9px 10px 9px 14px;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  backdrop-filter: blur(16px);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.active-call-top:active {
  cursor: grabbing;
}

.active-call-top > div {
  min-width: 0;
}

.active-call-top strong,
.active-call-top span {
  display: block;
}

.active-call-top span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.call-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.call-window-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-soft) 82%, transparent);
  color: var(--text);
}

.call-device-select,
.audio-output-select {
  min-width: 112px;
  max-width: min(190px, 32vw);
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  padding: 0 34px 0 12px;
  font: inherit;
  outline: none;
}

.call-device-select:focus,
.audio-output-select:focus {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.call-controls {
  grid-row: 3;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  backdrop-filter: blur(16px);
}

.call-control-btn {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel-soft) 94%, transparent);
  color: var(--text);
}

.call-control-btn.accept {
  background: var(--success);
  color: white;
}

.call-control-btn.off {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
}

.message-context-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  min-width: 220px;
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 97%, transparent);
  box-shadow: 0 22px 64px rgba(0, 0, 0, .24);
  backdrop-filter: blur(18px);
}

.message-context-menu button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 42px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  padding: 0 11px;
  text-align: left;
  font-weight: 800;
}

.message-context-menu button:hover {
  background: var(--panel-soft);
}

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

.message-context-menu svg {
  width: 20px;
  height: 20px;
}

.forward-dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(10px);
}

.forward-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(420px, 100%);
  max-height: min(620px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.forward-sheet header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
}

.forward-sheet h3 {
  margin: 0;
  font-size: 18px;
}

.forward-chat-list {
  overflow-y: auto;
  padding: 8px;
}

.forward-chat-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--text);
  padding: 8px;
  text-align: left;
}

.forward-chat-item:hover {
  background: var(--panel-soft);
}

.profile-dialog {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: grid;
  place-items: center;
  padding: 18px;
  background: color-mix(in srgb, var(--bg) 64%, transparent);
  backdrop-filter: blur(12px);
}

/* The crop editor is also a profile-dialog and must stay above the profile
   dialog that opened the file picker. Keep this rule after .profile-dialog. */
.profile-dialog.group-icon-editor {
  z-index: 110;
}

.profile-sheet {
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.profile-sheet::-webkit-scrollbar,
.settings-categories::-webkit-scrollbar,
.settings-detail::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.profile-top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.profile-top h3 {
  margin: 0;
  text-align: center;
  font-size: 17px;
}

#profileBackBtn,
#profileCloseBtn {
  grid-column: 1;
  grid-row: 1;
}

.profile-top-actions {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
#profileDialog .profile-top { grid-template-columns: 42px minmax(0, 1fr) auto; }

#profileLogoutBtn {
  color: var(--danger);
}

.profile-view,
.profile-form {
  display: grid;
  gap: 13px;
}

.profile-avatar-btn {
  position: relative;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.profile-avatar {
  width: 112px;
  height: 112px;
  font-size: 34px;
  border-radius: 50%;
}

.profile-avatar-edit {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
}

.profile-avatar-edit svg {
  width: 17px;
  height: 17px;
}

.profile-view h2,
.profile-view p {
  margin: 0;
  text-align: center;
}

.profile-view h2 {
  font-size: 24px;
}

.profile-details {
  display: grid;
  gap: 8px;
}

.profile-detail-row,
.profile-empty {
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 16px;
  background: var(--panel-soft);
  padding: 11px 13px;
}

.profile-detail-row span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-detail-row strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.profile-empty {
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

/* Empty grid rows and a reserved notification line must not grow a profile footer. */
#profileDialog #profileActions:empty,
#profileDialog #profileMessage:empty { display: none; }

.profile-message-btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 28px; margin: 14px auto 0;
  border-radius: 999px; border: 0; background: var(--text); color: var(--panel);
  font: inherit; font-weight: 700;
}
.profile-message-btn[hidden] { display: none; }

.profile-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 800;
}

.profile-form textarea {
  min-height: 88px;
  padding: 12px 14px;
  resize: vertical;
  border-radius: 22px;
}

.profile-settings-content,
.settings-section {
  display: grid;
  gap: 10px;
}

.profile-settings-content {
  background: var(--custom-settings-bg, transparent);
}

.profile-sheet.settings-mode {
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(940px, calc(100vw - 36px));
  height: min(720px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  overflow: hidden;
}

.profile-sheet.settings-mode .profile-settings-view,
.profile-sheet.settings-mode .profile-settings-content,
.settings-layout {
  min-height: 0;
  height: 100%;
}

.profile-sheet.settings-mode .profile-settings-view {
  display: block;
}

.settings-layout {
  display: grid;
  grid-template-columns: clamp(224px, 27vw, 270px) minmax(0, 1fr);
  gap: 14px;
}

.settings-categories,
.settings-detail {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--custom-settings-bg, var(--panel)) 88%, var(--panel-soft));
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.settings-categories {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}

.settings-categories-heading {
  display: grid;
  gap: 3px;
  padding: 7px 8px 13px;
}

.settings-categories-heading strong {
  font-size: 20px;
  letter-spacing: -.02em;
}

.settings-categories-heading span,
.settings-category-copy small,
.settings-detail-heading span,
.settings-detail-heading p,
.settings-row > span > small {
  color: var(--muted);
  font-size: 12px;
}

.settings-category {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  border: 1px solid transparent;
  border-radius: 17px;
  background: transparent;
  color: var(--custom-settings-text, var(--text));
  padding: 8px 10px;
  text-align: left;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.settings-category:hover {
  background: color-mix(in srgb, var(--custom-settings-row-bg, var(--panel-soft)) 72%, transparent);
}

.settings-category.active {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--accent) 13%, var(--custom-settings-row-bg, var(--panel-soft)));
}

.settings-category-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--custom-settings-row-bg, var(--panel-soft));
  color: var(--text);
}

.settings-category.active .settings-category-icon {
  background: var(--accent);
  color: var(--accent-text);
}

.settings-category-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-category-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.settings-category-copy strong,
.settings-category-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-category-copy strong {
  font-size: 14px;
}

.settings-category-copy small {
  white-space: nowrap;
}

.settings-category-arrow {
  color: var(--muted);
  font-size: 23px;
  line-height: 1;
}

.settings-detail {
  padding: 20px;
}

.settings-detail-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 2px 2px 19px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.settings-detail-heading div {
  display: grid;
  gap: 3px;
}

.settings-detail-heading h4,
.settings-detail-heading p {
  margin: 0;
}

.settings-detail-heading h4 {
  font-size: 23px;
  letter-spacing: -.025em;
}

.settings-detail-heading p {
  max-width: 260px;
  text-align: right;
}

.settings-detail-content {
  display: grid;
  gap: 14px;
  padding-top: 18px;
}

.settings-card-group {
  gap: 8px;
}

.settings-card-group h5 {
  margin: 0 2px 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.settings-card-group .settings-row {
  min-height: 66px;
  border-radius: 17px;
  padding: 10px 14px;
}

.settings-card-group .settings-row > span {
  display: grid;
  gap: 4px;
}

.settings-card-group .settings-row > span > b {
  font-size: 14px;
}

.settings-section h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.settings-row,
.privacy-user-chip,
.public-avatar-setting {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 999px;
  background: var(--custom-settings-row-bg, var(--panel-soft));
  color: var(--custom-settings-text, var(--text));
  padding: 8px 12px;
  text-align: left;
}

.settings-row span,
.public-avatar-setting span {
  flex: 1;
  min-width: 0;
  font-weight: 800;
}

.settings-row strong,
.public-avatar-setting strong {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .profile-sheet.settings-mode {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    padding: calc(10px + env(safe-area-inset-top)) 12px calc(10px + env(safe-area-inset-bottom));
  }

  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .settings-layout.mobile-category-list .settings-detail,
  .settings-layout.mobile-detail .settings-categories {
    display: none;
  }

  .settings-categories,
  .settings-detail {
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .settings-categories {
    padding: 8px 0;
  }

  .settings-categories-heading {
    padding: 8px 6px 16px;
  }

  .settings-category {
    min-height: 72px;
    border-color: color-mix(in srgb, var(--line) 72%, transparent);
    background: var(--custom-settings-row-bg, var(--panel-soft));
  }

  .settings-category + .settings-category {
    margin-top: 3px;
  }

  .settings-category.active {
    border-color: color-mix(in srgb, var(--line) 72%, transparent);
    background: var(--custom-settings-row-bg, var(--panel-soft));
  }

  .settings-category.active .settings-category-icon {
    background: color-mix(in srgb, var(--accent) 18%, var(--panel-soft));
    color: var(--accent);
  }

  .settings-detail {
    padding: 8px 0;
  }

  .settings-detail-heading {
    display: grid;
    gap: 6px;
    padding: 8px 4px 16px;
  }

  .settings-detail-heading p {
    max-width: none;
    text-align: left;
  }

  .settings-detail-content {
    padding-top: 14px;
  }
}

.privacy-choice-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--panel-soft);
}

.privacy-choice-group button {
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.privacy-choice-group button.active {
  background: var(--accent);
  color: var(--accent-text);
}

.customization-screen {
  gap: 12px;
}

.customization-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pill-btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 0 14px;
  font-weight: 800;
}

.customization-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px;
  border-radius: 999px;
  background: var(--panel-soft);
}

.customization-tabs button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 13px;
  font-weight: 900;
}

.customization-tabs button.active {
  background: var(--accent);
  color: var(--accent-text);
}

.customization-body {
  display: grid;
  gap: 8px;
}

.customization-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 8px 12px;
  text-align: left;
}

.customization-row span {
  min-width: 0;
  font-weight: 800;
}

.customization-row strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.customization-row i {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.customization-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 22px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 12px;
}

.customization-slider-row span {
  font-weight: 800;
}

.customization-slider-row strong {
  color: var(--muted);
  font-size: 13px;
}

.customization-slider-row input {
  grid-column: 1 / -1;
  width: 100%;
}

.customization-color-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .42);
}

.customization-color-dialog {
  display: grid;
  gap: 12px;
  width: min(420px, 100%);
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 28px;
  background: var(--panel);
  color: var(--text);
  padding: 16px;
  box-shadow: var(--shadow);
}

.customization-color-preview {
  height: 84px;
  border: 1px solid var(--line);
  border-radius: 22px;
}

.customization-color-dialog h4 {
  margin: 0;
}

.customization-swatches {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}

.customization-swatches button {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.customization-rgb-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-weight: 900;
}

.customization-rgb-row input {
  width: 100%;
}

.customization-hex-input {
  height: 44px;
  border-radius: 999px;
  text-transform: uppercase;
}

.customization-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.customization-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.custom-preview {
  display: grid;
  gap: 10px;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 28px;
  background: var(--custom-chat-bg);
  padding: 12px;
}

.custom-preview button {
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.custom-preview-header,
.custom-preview-compose,
.custom-preview-row,
.custom-preview-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border-radius: 18px;
  background: var(--custom-chat-list-header-bg);
  color: var(--custom-chat-list-text);
  padding: 9px 12px;
}

.custom-preview-header {
  background: var(--custom-chat-header-bg);
  color: var(--custom-icon-color);
}

.custom-preview-header.tall {
  display: grid;
  justify-items: center;
  min-height: 140px;
  text-align: center;
}

.custom-preview-header span:not(.custom-preview-avatar),
.custom-preview-row span:last-child {
  display: grid;
  min-width: 0;
}

.custom-preview-header em,
.custom-preview-row em {
  color: var(--custom-chat-list-muted);
  font-size: 12px;
  font-style: normal;
}

.custom-preview-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 900;
}

.custom-preview-avatar.big {
  width: 68px;
  height: 68px;
  font-size: 24px;
}

.custom-preview-messages {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 180px;
}

.custom-preview .message-row {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
}

.custom-preview-bubble,
.custom-preview-media {
  max-width: 78%;
  border-radius: 18px;
  background: linear-gradient(90deg, var(--custom-message-in-left), var(--custom-message-in-center), var(--custom-message-in-right));
  color: var(--custom-message-text);
  padding: 10px 12px;
  font-size: var(--custom-message-font-size);
}

.custom-preview-bubble.out,
.custom-preview-media {
  justify-self: end;
  background: linear-gradient(90deg, var(--custom-message-out-left), var(--custom-message-out-center), var(--custom-message-out-right));
}

.custom-preview-media {
  display: grid;
  place-items: center;
  min-height: 76px;
  font-weight: 900;
}

.custom-preview-compose {
  border-radius: 999px;
  background: var(--custom-compose-bg);
}

.custom-preview-compose i {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--custom-icon-bg);
  color: var(--custom-icon-color);
  font-style: normal;
  font-weight: 900;
}

.custom-preview-compose span {
  flex: 1;
  border-radius: 999px;
  background: var(--custom-input-bg);
  color: var(--muted);
  padding: 9px 12px;
}

.custom-preview-list {
  background: var(--custom-chat-list-bg);
}

.custom-preview-profile {
  background: var(--custom-profile-bg);
}

.custom-preview-settings {
  background: var(--custom-settings-bg);
}

.custom-preview-media-picker {
  background: var(--custom-media-picker-bg);
}

.custom-preview-row {
  background: var(--custom-chat-row-bg);
}

.custom-preview-profile .custom-preview-row {
  background: var(--custom-profile-block-bg);
  color: var(--custom-profile-text);
}

.custom-preview-settings .custom-preview-row,
.custom-preview-settings .custom-preview-compose {
  background: var(--custom-settings-row-bg);
  color: var(--custom-settings-text);
}

.custom-preview-media-picker .custom-preview-header {
  background: var(--custom-media-picker-panel-bg);
  color: var(--custom-media-picker-text);
}

.custom-preview-search {
  border-radius: 999px;
  background: var(--custom-chat-list-search-bg);
  color: var(--custom-chat-list-muted);
}

.custom-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.custom-preview-grid button {
  display: grid;
  place-items: center;
  min-height: 72px;
  border-radius: 18px;
  background: var(--custom-media-picker-item-bg);
  color: var(--custom-media-picker-text);
  font-weight: 900;
}

.customization-property-overlay {
  position: fixed;
  inset: 0;
  z-index: 78;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, .34);
}

.customization-property-sheet {
  display: grid;
  gap: 10px;
  max-height: min(72vh, 620px);
  overflow-y: auto;
  border-radius: 28px 28px 0 0;
  background: var(--panel);
  color: var(--text);
  padding: 16px;
  box-shadow: var(--shadow);
}

.customization-property-sheet h4 {
  margin: 0;
}

.privacy-exceptions {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel-soft) 58%, transparent);
}

.privacy-exceptions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.privacy-exceptions-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.privacy-user-list {
  display: grid;
  gap: 7px;
}

.privacy-user-chip {
  min-height: 44px;
  padding: 6px 10px;
}

.privacy-user-chip.selected {
  border-color: var(--accent);
}

.privacy-user-avatar {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.pinned-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding: 10px;
}

.pinned-list button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.pinned-list button:hover {
  background: var(--control);
}

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

.pinned-list span,
.pinned-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.theme-toggle-btn {
  position: relative;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  color: var(--text);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent);
  backdrop-filter: blur(12px);
}
.theme-toggle-btn svg { width: 24px; height: 24px; overflow: visible; }
.theme-toggle-btn:disabled { cursor: default; }
.theme-color-transition body,
.theme-color-transition .profile-sheet,
.theme-color-transition .sidebar-bottom-island {
  transition: background-color 520ms ease-in-out, color 520ms ease-in-out, border-color 520ms ease-in-out;
}
:root.theme-revealing::view-transition-old(root),
:root.theme-revealing::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root.theme-revealing::view-transition-group(root) { animation: none; }
:root.theme-revealing .theme-toggle-btn { view-transition-name: theme-switch; }
:root.theme-revealing::view-transition-group(theme-switch) { animation: none; z-index: 3; }
:root.theme-revealing::view-transition-old(theme-switch) { animation: none; opacity: 0; }
:root.theme-revealing::view-transition-new(theme-switch) { animation: none; }
:root.theme-revealing[data-theme="light"]::view-transition-new(root) { z-index: 2; }
:root.theme-revealing[data-theme="dark"]::view-transition-old(root) { z-index: 2; }
@media (prefers-reduced-motion: reduce) {
  .sidebar-bottom-island::before { transition: none; }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .84);
}

.lightbox-close {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  background: rgba(255, 255, 255, .12);
  color: white;
  font-size: 28px;
}

.lightbox-body {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.lightbox-body img,
.lightbox-body video {
  max-width: 96vw;
  max-height: 88vh;
  border-radius: 18px;
}

@keyframes recordPulse {
  0%, 100% {
    opacity: .45;
    transform: scale(.9);
  }

  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

.mobile-only {
  display: none;
}

.empty-line {
  padding: 18px 10px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .auth-screen {
    justify-content: flex-start;
    gap: 18px;
    padding-top: calc(18px + env(safe-area-inset-top));
    padding-bottom: calc(140px + env(safe-area-inset-bottom));
  }

  .auth-download-panel {
    position: static;
    width: min(420px, 100%);
    justify-self: center;
  }

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

  .conversation {
    --floating-header-top: calc(8px + env(safe-area-inset-top));
  }

  .sidebar {
    border-right: 0;
  }

  .chat-pane {
    display: none;
  }

  .messenger.chat-open .sidebar {
    display: none;
  }

  .messenger.chat-open .chat-pane {
    display: block;
  }

  .mobile-only {
    display: grid;
  }

  .message-bubble {
    max-width: 88%;
  }

  .composer {
    grid-template-columns: var(--compose-control-size) minmax(0, 1fr) var(--compose-control-size) var(--compose-control-size);
    gap: 6px;
    margin: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    padding: 6px;
    border-radius: 999px;
  }

  .chat-compose-glass {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
    margin: 0;
  }

  .chat-header-glass {
    top: calc(8px + env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
  }

  .pinned-bar {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
  }

  .composer.voice-active {
    grid-template-columns: var(--compose-control-size) minmax(0, 1fr) var(--compose-control-size) var(--compose-control-size);
  }

  .voice-composer-info {
    height: 34px;
    padding: 0 4px;
  }

  .composer.voice-active #actionBtn {
    width: var(--compose-control-size);
    height: var(--compose-control-size);
    border-radius: 999px;
  }

  .voice-lock-target {
    right: 10px;
    bottom: calc(100% + 21px);
    width: 40px;
    height: 40px;
    border-radius: 15px;
  }

  .compose-icon-btn,
  .send-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
  }

  .composer textarea {
    min-height: 34px;
    padding-top: 7px;
  }

  .voice-panel {
    grid-template-columns: 10px minmax(0, 1fr);
    right: max(66px, calc(66px + env(safe-area-inset-right)));
    bottom: calc(var(--floating-compose-height) + 18px + env(safe-area-inset-bottom));
    border-radius: 22px;
  }

  .voice-hint {
    display: none;
  }

  .audio-card,
  .file-card {
    width: min(320px, 78vw);
    min-width: 0;
  }

  .voice-player {
    grid-template-columns: 44px minmax(0, 1fr) auto 42px;
    width: min(330px, 82vw);
  }

  .voice-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 15px;
  }

  .voice-player .audio-duration {
    min-width: 58px;
    font-size: 11px;
  }

  .audio-card audio {
    max-width: none;
  }

  .emoji-sticker-panel {
    width: min(392px, calc(100vw - 20px));
    max-height: min(410px, 54vh);
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(var(--floating-compose-height) + 18px + env(safe-area-inset-bottom));
    margin: 0 auto;
    padding-bottom: 12px;
  }

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

  .emoji-grid {
    grid-template-columns: repeat(7, 1fr);
  }

  .round-video-card {
    width: min(230px, 62vw);
    height: min(230px, 62vw);
  }

  .active-call-top {
    align-items: flex-start;
    gap: 8px;
  }

  .active-call-overlay {
    min-width: 280px;
    min-height: 340px;
    border-radius: 22px;
  }

  .active-call-overlay.maximized {
    inset: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .call-device-select,
  .audio-output-select {
    flex: 1 1 120px;
    min-width: min(120px, 34vw);
    max-width: min(170px, 44vw);
    height: 34px;
  }

  .call-controls {
    flex-wrap: wrap;
    padding: 8px;
  }

  .call-control-btn {
    width: 42px;
    height: 42px;
    border-radius: 15px;
  }
}

/* ===== QR login + Cloud (web) ===== */
.qr-login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.qr-code-box {
  background: #fff;
  padding: 12px;
  border-radius: 16px;
  line-height: 0;
}
.qr-code-box canvas { border-radius: 8px; }

/* Password confirmation uses the same six-digit layout as account login. */
#profilePasswordForm input[type="password"] {
  border-radius: 18px;
  min-height: 48px;
}
#profilePasswordForm input::-ms-reveal,
#profilePasswordForm input::-ms-clear { display: none; }
.password-code-cells {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
.password-code-cells > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 1;
  font-size: 16px;
  cursor: text;
}
.password-code-cells > span {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 56px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  pointer-events: none;
}
.password-code-cells > span.active { border-color: var(--text); }
.password-code-cells.disabled { opacity: .55; }
#profilePasswordForm button:disabled { opacity: .45; cursor: default; }

.sidebar-cloud-btn {
  margin-top: 10px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s ease;
}
.sidebar-cloud-btn:hover { background: var(--control-strong); }

.cloud-sheet { max-width: 540px; }
.cloud-view { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }

.cloud-connected-list,
.cloud-provider-picker,
.cloud-file-list { display: flex; flex-direction: column; gap: 8px; }

.cloud-row { display: flex; align-items: center; gap: 8px; }
.cloud-open-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--control);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease;
}
.cloud-open-btn:hover { background: var(--control-strong); }
.cloud-row-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cloud-row-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-row-text em { font-style: normal; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-emoji { font-size: 20px; }

.cloud-del-btn,
.cloud-dl-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--control);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}
.cloud-del-btn:hover { color: var(--danger); }

.cloud-provider-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--control);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease;
}
.cloud-provider-btn:hover { background: var(--control-strong); }

.cloud-webdav-form { gap: 10px; }

/* ===== Game Mode: group chat channels ===== */
.create-group-btn {
  margin-top: 4px;
}

.conversation.game-mode {
  grid-template-columns: 260px minmax(0, 1fr);
}

.conversation.game-mode > *:not(.game-channels) {
  grid-column: 2;
}

.game-channels {
  position: relative;
  grid-column: 1;
  grid-row: 1 / -1;
  z-index: 28;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  min-height: 0;
  padding: 16px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at 20% 0, color-mix(in srgb, var(--accent) 6%, transparent), transparent 34%),
    color-mix(in srgb, var(--panel) 96%, transparent);
}

.game-server-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-soft) 76%, transparent);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .12);
}

.game-server-head span,
.game-server-head strong {
  display: block;
}

.game-server-head span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.game-server-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
}

.channel-section {
  display: grid;
  gap: 7px;
}

.channel-section header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.channel-section header button {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
}

.channel-section header button:hover {
  background: var(--control);
  color: var(--text);
}

.channel-list {
  display: grid;
  gap: 4px;
}

.channel-row {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  border-radius: 13px;
}

.channel-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 40px;
  padding: 0 38px 0 11px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.channel-main:hover,
.channel-row.active .channel-main {
  border-color: color-mix(in srgb, var(--line) 88%, transparent);
  background: color-mix(in srgb, var(--control) 72%, transparent);
  color: var(--text);
}

.channel-row.active .channel-main {
  box-shadow: inset 3px 0 0 var(--accent);
}

.channel-symbol {
  flex: 0 0 20px;
  color: currentColor;
  font-weight: 800;
  text-align: center;
}

.channel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}

.channel-lock {
  margin-left: auto;
  font-size: 11px;
}

.channel-actions-btn {
  position: absolute;
  right: 5px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
}

.channel-row:hover .channel-actions-btn,
.channel-actions-btn:focus-visible {
  opacity: 1;
}

.channel-actions-btn:hover {
  background: var(--control-strong);
  color: var(--text);
}

.channel-action-menu {
  position: fixed;
  z-index: 82;
  width: 154px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.channel-action-menu button {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.channel-action-menu button:hover { background: var(--control); }
.channel-action-menu button.danger { color: var(--danger); }
.channel-action-menu.group-action-menu { width: 220px; }
.channel-action-menu.group-action-menu button,
.user-context-menu > button {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.channel-action-menu svg,
.user-context-menu svg { width: 18px; height: 18px; }

.user-context-menu {
  position: fixed;
  z-index: 96;
  display: grid;
  gap: 6px;
  width: min(286px, calc(100vw - 16px));
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 17px;
  background: color-mix(in srgb, var(--panel) 97%, transparent);
  box-shadow: 0 24px 72px rgba(0, 0, 0, .38);
  backdrop-filter: blur(18px);
}

.user-context-menu > header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 5px 6px 8px;
  border-bottom: 1px solid var(--line);
}
.user-context-avatar { width: 38px; height: 38px; border-radius: 12px; }
.user-context-menu header strong,
.user-context-menu header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-context-menu header strong { font-size: 13px; }
.user-context-menu header small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.user-context-menu > button {
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 750;
}
.user-context-menu > button:hover { background: var(--control); }
.user-context-menu > button.danger { color: #e00020; }
.user-volume-control { display: grid; gap: 8px; padding: 8px 8px 6px; }
.user-volume-control > span { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 750; }
.user-volume-control output { color: var(--text); }
.user-volume-control input { width: 100%; accent-color: var(--accent); }

.web-confirm-layer {
  position: fixed;
  z-index: 1500;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .48);
  backdrop-filter: blur(8px);
}
.web-confirm-card {
  display: grid;
  gap: 22px;
  width: min(360px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .42);
}
.web-confirm-card > strong { color: var(--text); font-size: 18px; }
.web-confirm-card > div { display: flex; justify-content: flex-end; gap: 10px; }
.web-confirm-card button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 0; background: transparent; color: var(--text); font-weight: 800; }
.web-confirm-card button.danger { background: transparent; color: #d00018; }
.slide-confirm-card > .web-confirm-actions { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-width: 0; gap: 12px; }
.slide-confirm-card [data-cancel] { flex: 0 0 auto; }
.slide-confirm-card .close-community-slider { flex: 1 1 0; width: auto; min-width: 120px; height: 48px; box-sizing: border-box; border-radius: 16px; }
.slide-confirm-card .close-slider-thumb, .slide-confirm-card .close-slider-trail { border-radius: 12px; }
.contact-name-card input { width: 100%; box-sizing: border-box; padding: 12px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: var(--control); font: inherit; }
.contact-name-card small { color: var(--muted); }
.close-community-slider { --slider-x: 0px; --slider-stretch: 1; width: 214px; height: 48px; position: relative; overflow: hidden; border-radius: 24px; background: rgba(208,0,24,.1); border: 1px solid rgba(208,0,24,.28); user-select: none; flex-shrink: 1; touch-action: none; }
.close-community-slider > span { position: absolute; inset: 0 8px 0 50px; display: grid; place-items: center; color: #d00018; font-weight: 800; white-space: nowrap; }
.close-slider-trail { position: absolute; left: 4px; top: 4px; height: 40px; width: calc(var(--slider-x) + 40px); border-radius: 999px; background: rgba(208,0,24,.13); filter: blur(3px); transition: width .45s cubic-bezier(.2,1.45,.4,1); }
.close-slider-thumb { position: absolute; left: 4px; top: 4px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; transform: translateX(var(--slider-x)) scaleX(var(--slider-stretch)); background: linear-gradient(135deg,rgba(244,55,65,.75),rgba(184,0,16,.88)); border: 1px solid rgba(255,255,255,.45); box-shadow: inset 0 1px 3px rgba(255,255,255,.6),0 3px 10px rgba(180,0,16,.22); backdrop-filter: blur(1px) saturate(1.8); transition: transform .45s cubic-bezier(.2,1.45,.4,1); box-sizing: border-box; cursor: grab; }
.close-slider-thumb svg { width: 22px; height: 22px; fill: none; stroke: white; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.close-community-slider.dragging .close-slider-thumb { cursor: grabbing; transition: transform 40ms linear; }
.close-community-slider.dragging .close-slider-trail { transition: width 40ms linear; }
.close-community-slider:focus-visible { outline: 2px solid #d00018; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .close-slider-thumb,.close-slider-trail { transition: none !important; } }

.game-mode-control {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--compose-glass-control) 76%, transparent);
  color: var(--compose-glass-icon);
  cursor: pointer;
}

.game-mode-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.game-mode-control > span {
  position: relative;
  width: 30px;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 42%, transparent);
  transition: background .18s ease;
}

.game-mode-control > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  transition: transform .18s ease;
}

.game-mode-control input:checked + span { background: var(--success); }
.game-mode-control input:checked + span::after { transform: translateX(12px); }
.game-mode-control b { font-size: 12px; white-space: nowrap; }

.conversation.game-mode .chat-header-glass {
  left: calc(260px + max(12px, env(safe-area-inset-left)));
}

.conversation.game-mode .pinned-bar {
  left: calc(260px + max(18px, env(safe-area-inset-left)));
}

.conversation.game-mode .chat-compose-glass {
  left: calc(260px + max(18px, env(safe-area-inset-left)));
}

.conversation.group-chat:not(.game-mode) .composer {
  grid-template-columns: var(--compose-control-size) minmax(0, 1fr) var(--compose-control-size) var(--compose-control-size);
}
.conversation.game-mode .composer { grid-template-columns: var(--compose-control-size) minmax(0, 1fr) var(--compose-control-size); }

.voice-channel-state {
  grid-row: 1 / -1;
  z-index: 2;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  padding: 100px 28px;
  text-align: center;
}

.voice-channel-state:not([hidden]) { display: grid; }
.voice-channel-state h2, .voice-channel-state p { margin: 0; }
.voice-channel-state > p:not(.eyebrow) { max-width: 520px; color: var(--muted); line-height: 1.55; }
.voice-channel-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-soft);
  font-weight: 900;
}

.channel-sheet { max-width: 540px; }
.profile-form select {
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--control);
  color: var(--text);
}

.channel-member-picker {
  display: grid;
  gap: 8px;
}

.channel-member-picker > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.channel-member-picker > div {
  max-height: 230px;
  display: grid;
  gap: 5px;
  overflow-y: auto;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.member-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin: 0 !important;
  padding: 6px 9px;
  border-radius: 10px;
  color: var(--text) !important;
}

.member-check:hover { background: var(--control); }
.member-check input { width: 17px; height: 17px; margin: 0; }
.member-check small { margin-left: auto; color: var(--muted); }

@media (max-width: 1040px) {
  .game-mode-control b { display: none; }
}

@media (max-width: 760px) {
  .conversation.game-mode { grid-template-columns: minmax(0, 1fr); }
  .conversation.game-mode > *:not(.game-channels) { grid-column: 1; }
  .game-channels {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 36;
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 18px 0 60px rgba(0, 0, 0, .32);
  }
  .conversation.game-mode.channels-open .game-channels { transform: translateX(0); }
  .conversation.game-mode .chat-header-glass,
  .conversation.game-mode .pinned-bar,
  .conversation.game-mode .chat-compose-glass {
    left: max(10px, env(safe-area-inset-left));
  }
  .game-mode-control { padding: 0 7px; }
  .chat-header-glass .chat-call-actions { gap: 3px; }
  .conversation.group-chat .chat-call-actions #wallpaperBtn { display: none; }
}

/* ===== Game Mode v2: full application mode + group voice ===== */
.messenger,
.messenger > .sidebar,
.messenger > .chat-pane {
  transition:
    grid-template-columns 240ms cubic-bezier(.2, .72, .2, 1),
    opacity 210ms ease,
    transform 240ms cubic-bezier(.2, .72, .2, 1);
}

.messenger.game-mode-active {
  grid-template-columns: 0 minmax(0, 1fr);
  overflow: hidden;
}

.messenger.game-mode-active > .sidebar {
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-18px) scale(.985);
}

.messenger.game-mode-active > .chat-pane {
  grid-column: 2;
  opacity: 1;
  transform: none;
}

.conversation.game-mode {
  grid-template-columns: 272px minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto;
  animation: game-content-enter 240ms cubic-bezier(.2, .72, .2, 1) both;
}

@keyframes game-content-enter {
  from { opacity: 0; transform: translateY(5px) scale(.994); }
  to { opacity: 1; transform: none; }
}

.conversation.game-mode > *:not(.game-channels):not(.channel-drawer-backdrop) {
  grid-column: 2;
}

.conversation:not(.game-mode) > .game-channels {
  position: absolute;
  inset: 0 auto 0 0;
  width: 272px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-14px);
}

.conversation.game-mode > .game-channels {
  opacity: 1;
  transform: none;
  transition: opacity 210ms ease, transform 240ms cubic-bezier(.2, .72, .2, 1);
}

.game-channels {
  gap: 18px;
  width: auto;
  padding: 18px 13px 14px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 0, color-mix(in srgb, var(--accent) 7%, transparent), transparent 30%),
    color-mix(in srgb, var(--panel) 97%, var(--bg));
}

.game-sidebar-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 34px;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 5px 5px 12px;
  border-bottom: 1px solid var(--line);
}

.game-chat-menu-btn {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  padding: 3px 5px 3px 3px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.game-chat-menu-btn:hover,
.game-chat-menu-btn[aria-expanded="true"] {
  background: color-mix(in srgb, var(--control) 76%, transparent);
}

.game-chat-menu-btn strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  letter-spacing: .015em;
}

.game-chat-menu-chevron {
  width: 8px;
  height: 8px;
  margin: -4px 2px 0 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: .7;
  transform: rotate(45deg);
  transition: transform .16s ease, margin .16s ease;
}

.game-chat-menu-btn[aria-expanded="true"] .game-chat-menu-chevron {
  margin-top: 4px;
  transform: rotate(225deg);
}

.game-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  font-size: 12px;
}

.game-exit-btn {
  grid-column: 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
}

.game-chat-menu {
  position: absolute;
  z-index: 44;
  top: 74px;
  right: 12px;
  left: 12px;
  max-height: min(430px, calc(100% - 94px));
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: color-mix(in srgb, var(--panel) 97%, var(--bg));
  box-shadow: 0 22px 55px rgba(0, 0, 0, .38);
}

.game-chat-menu > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 3px 10px 5px;
}

.game-chat-menu > header strong,
.game-chat-menu > header small {
  display: block;
}

.game-chat-menu > header strong { font-size: 13px; }
.game-chat-menu > header small { margin-top: 2px; color: var(--muted); font-size: 10px; }

.game-chat-menu-action {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.game-chat-menu-action:hover { background: var(--control); }
.game-chat-menu-action.danger { color: var(--danger); }
.game-chat-menu-action > span:first-child {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--control);
  color: var(--muted);
  font-size: 17px;
  font-weight: 750;
}
.game-chat-menu-action > span:last-child,
.game-chat-menu-action strong,
.game-chat-menu-action small { display: block; min-width: 0; }
.game-chat-menu-action strong { font-size: 12px; }
.game-chat-menu-action small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.game-menu-voice-icon::before { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-left-color: transparent; border-radius: 50%; }
.game-chat-menu-notice { margin: 4px 5px 2px; color: var(--muted); font-size: 11px; line-height: 1.45; }

.channel-row.voice-channel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.voice-presence-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
  padding: 2px 8px 7px 31px;
}

.voice-presence-person {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 27px;
  color: var(--muted);
  font-size: 12px;
}

.voice-presence-person::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--muted) 70%, transparent);
  border-radius: 50%;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.voice-presence-person.speaking::before {
  border-color: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 17%, transparent);
}

.voice-presence-person span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-presence-person i {
  margin-left: auto;
  color: var(--danger);
  font-style: normal;
}

.game-voice-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--success) 32%, var(--line));
  border-radius: 17px;
  background: color-mix(in srgb, var(--control) 82%, transparent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .13);
}

.game-voice-panel[hidden] { display: none; }
.game-voice-panel > span { color: var(--success); font-size: 9px; font-weight: 900; letter-spacing: .1em; }
.game-voice-panel > strong { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-voice-panel > small { grid-column: 1; color: var(--muted); }
.game-voice-panel > div { grid-column: 2; grid-row: 1 / 4; display: flex; align-items: center; gap: 4px; }
.game-voice-panel button,
.global-voice-dock button {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
}
.game-voice-panel button.active { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--panel-soft)); }
.game-voice-panel button.danger,
.global-voice-dock button.danger { color: var(--danger); }

.conversation.game-mode .chat-header-glass {
  left: max(12px, env(safe-area-inset-left));
}

.conversation.game-mode .pinned-bar {
  left: max(18px, env(safe-area-inset-left));
}

.conversation.game-mode .chat-compose-glass {
  left: max(12px, env(safe-area-inset-left));
}

.conversation.game-mode .chat-header-glass #activeAvatar,
.conversation.game-mode .chat-header-glass .game-mode-control,
.conversation.game-mode .chat-header-glass #wallpaperBtn {
  display: none;
}

.conversation.game-mode .chat-title h2 { font-size: 18px; }
.conversation.game-mode .chat-title p { font-size: 11px; }
.conversation.group-chat:not(.game-mode) .composer { grid-template-columns: var(--compose-control-size) minmax(0, 1fr) var(--compose-control-size) var(--compose-control-size); }
.conversation.game-mode .composer { grid-template-columns: var(--compose-control-size) minmax(0, 1fr) var(--compose-control-size); }

.conversation.group-chat .composer .group-attach-plus {
  color: var(--text-secondary);
}

.voice-channel-state {
  grid-row: 1 / -1;
  position: relative;
  align-content: start;
  justify-items: stretch;
  gap: 14px;
  overflow-y: auto;
  padding: 92px clamp(18px, 4vw, 52px) 96px;
  text-align: left;
}

.voice-stage-heading[hidden] { display: none; }

.voice-stage-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(920px, 100%);
  margin: 0 auto;
}

.voice-stage-heading h2,
.voice-stage-heading p { margin: 0; }
.voice-stage-heading h2 { margin: 2px 0 5px; font-size: clamp(24px, 3vw, 34px); }
.voice-stage-heading .voice-channel-icon { margin: 0; }

.voice-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  justify-content: center;
  gap: 10px;
  width: min(1040px, 100%);
  margin: 0 auto;
}

.voice-tile-grid.single-tile { width: min(420px, 100%); }

.voice-participant-grid,
.voice-screen-share-list { display: contents; }

.voice-screen-share-list[hidden] { display: none; }

.voice-participant-card {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  padding: 18px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-soft) 76%, transparent);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.voice-participant-card:hover,
.voice-screen-share-card:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  transform: translateY(-1px);
}

.voice-participant-card.speaking {
  border-color: color-mix(in srgb, var(--success) 70%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 12%, transparent);
  transform: translateY(-1px);
}

.voice-participant-card .avatar { width: 66px; height: 66px; }
.voice-participant-card strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-participant-card span { min-height: 18px; color: var(--muted); font-size: 12px; }
.voice-participant-card.muted span { color: var(--danger); }

.voice-active-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 7px;
}

.voice-active-controls[hidden] { display: none; }

.voice-active-controls {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 6;
  width: auto;
  margin: 0;
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .26);
  backdrop-filter: blur(18px) saturate(1.1);
  transform: translateX(-50%);
}

.voice-active-controls button {
  display: grid;
  place-items: center;
  align-items: center;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--control);
  color: var(--text);
}

.voice-active-controls button span { display: grid; place-items: center; }
.voice-active-controls button.active { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.voice-active-controls button.danger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  line-height: 0;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(145deg, color-mix(in srgb, var(--danger) 86%, #ff8a8a), var(--danger));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--danger) 26%, transparent);
}
.voice-active-controls button.danger span { display: grid; place-items: center; width: 24px; height: 24px; }
.voice-active-controls button.danger svg { display: block; width: 24px; height: 24px; stroke-width: 2.2; }
.voice-control-split,
.voice-compact-split {
  display: flex;
  overflow: hidden;
  align-items: stretch;
}

.voice-active-controls .voice-control-split {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control);
}

.voice-active-controls .voice-control-split > button:first-child {
  width: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.voice-active-controls .voice-control-split > .voice-chevron-btn {
  align-self: stretch;
  display: grid;
  place-items: center;
  width: 20px;
  min-width: 20px;
  height: auto;
  min-height: 0;
  padding: 0;
  margin: 8px 0;
  border: 0;
  border-left: 1px solid color-mix(in srgb, var(--line) 92%, transparent);
  border-radius: 0;
  background: transparent;
  line-height: 0;
}

.voice-active-controls .voice-control-split:hover { background: var(--control-strong); }
.voice-active-controls .voice-control-split:has(> button.active) { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.voice-active-controls .voice-control-split:has(> button.active-media) { border-color: color-mix(in srgb, var(--success) 55%, var(--line)); }

.voice-active-controls .voice-chevron-btn svg,
.game-voice-panel .voice-chevron-btn svg {
  display: block;
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}

.voice-active-controls button.active-media {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 55%, var(--line));
  background: color-mix(in srgb, var(--success) 13%, var(--control));
}

.game-voice-panel .voice-compact-split > button:first-child {
  min-width: 28px;
  padding: 0 6px;
  border-radius: 9px 4px 4px 9px;
}

.game-voice-panel .voice-compact-split > .voice-chevron-btn {
  min-width: 18px;
  width: 18px;
  padding: 0 3px;
  margin-left: 1px;
  border-radius: 4px 9px 9px 4px;
}

.voice-device-menu {
  position: fixed;
  z-index: 120;
  display: grid;
  gap: 10px;
  max-height: min(520px, calc(100vh - 24px));
  padding: 10px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: 0 22px 62px rgba(0, 0, 0, .38);
  backdrop-filter: blur(20px) saturate(1.12);
}

.voice-device-menu[hidden] { display: none; }
.voice-device-menu > header { display: flex; align-items: center; justify-content: space-between; padding: 2px 3px 5px; }
.voice-device-menu > header button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: var(--control);
  color: var(--text);
}
.voice-device-menu > header button svg { width: 15px; height: 15px; }
.voice-device-menu-body,
.voice-device-menu > div { display: grid; min-width: 0; max-width: 100%; gap: 10px; }
.voice-device-menu section { display: grid; min-width: 0; max-width: 100%; gap: 8px; padding: 9px; overflow: hidden; border-radius: 13px; background: color-mix(in srgb, var(--control) 72%, transparent); }
.voice-device-menu section > b,
.voice-device-menu section > label { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.voice-device-menu output { color: var(--muted); font-weight: 650; }
.voice-device-list { display: grid; min-width: 0; max-width: 100%; gap: 4px; }
.voice-device-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.voice-device-option-icon { display: grid; place-items: center; color: var(--muted); }
.voice-device-option-icon svg { width: 17px; height: 17px; }
.voice-device-option-copy { display: grid; min-width: 0; gap: 2px; overflow: hidden; }
.voice-device-option-copy b,
.voice-device-option-copy small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-device-option-copy b { font-size: 12px; line-height: 1.2; }
.voice-device-option-copy small { color: var(--muted); font-size: 10px; line-height: 1.25; }
.voice-device-option i {
  display: block;
  width: 16px;
  height: 16px;
  border: 1px solid color-mix(in srgb, var(--muted) 72%, transparent);
  border-radius: 50%;
  font-style: normal;
}
.voice-device-option.selected i { border: 5px solid var(--accent); }
.voice-device-option:hover,
.voice-device-option.selected { border-color: var(--line); background: var(--control-strong); }
.voice-device-menu input[type="range"] { width: 100%; accent-color: var(--accent); }
.voice-device-empty { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.voice-radio-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--control) 72%, transparent);
}
.voice-radio-mode span { display: grid; gap: 2px; }
.voice-radio-mode small { color: var(--muted); }
.voice-radio-mode input { width: 18px; height: 18px; accent-color: var(--accent); }

.voice-participant-media { display: none; position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: #050608; }
.voice-participant-media video { width: 100%; height: 100%; object-fit: cover; }
.voice-participant-card.has-camera { padding: 0; }
.voice-participant-card.has-camera .voice-participant-media { display: block; }
.voice-participant-identity { display: grid; justify-items: center; gap: 8px; position: relative; z-index: 2; }
.voice-participant-card.has-camera .voice-participant-identity {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  padding: 30px 10px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.82));
  color: #fff;
  text-align: left;
}
.voice-participant-card.has-camera .voice-participant-identity .avatar,
.voice-participant-card.has-camera .voice-participant-identity span { display: none; }
.voice-participant-card.has-camera .voice-participant-identity strong { display: block; font-size: 12px; }

.voice-screen-share-card {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--line));
  border-radius: 18px;
  background: #050608;
  color: #fff;
  font: inherit;
  text-align: left;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.voice-screen-share-media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel-soft) 74%, #050608);
  color: var(--success);
}
.voice-screen-share-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #030405;
}
.voice-screen-share-placeholder { display: grid; place-items: center; }
.voice-screen-share-placeholder[hidden] { display: none; }
.voice-screen-share-placeholder svg { width: 38px; height: 38px; }
.voice-tile-caption {
  position: absolute;
  right: 9px;
  bottom: 9px;
  left: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px;
  background: rgba(6,7,9,.78);
  backdrop-filter: blur(10px);
}
.voice-tile-caption > .voice-tile-copy { display: grid; min-width: 0; gap: 1px; }
.voice-tile-caption strong,
.voice-tile-caption small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-tile-caption strong { font-size: 12px; }
.voice-tile-caption small { color: #b4bac5; font-size: 9px; }
.voice-tile-caption-icon { display: grid; place-items: center; flex: 0 0 auto; color: var(--success); }
.voice-tile-caption-icon svg { width: 17px; height: 17px; }
.voice-screen-watch-btn {
  flex: 0 0 auto;
  min-height: 30px;
  margin-left: auto;
  padding: 0 11px;
  border: 1px solid color-mix(in srgb, var(--success) 38%, rgba(255,255,255,.12));
  border-radius: 9px;
  background: color-mix(in srgb, var(--success) 13%, rgba(20,22,25,.92));
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.voice-screen-watch-btn:hover { background: color-mix(in srgb, var(--success) 22%, rgba(20,22,25,.92)); }
.voice-screen-watch-btn.active {
  border-color: color-mix(in srgb, var(--danger) 38%, rgba(255,255,255,.12));
  background: color-mix(in srgb, var(--danger) 13%, rgba(20,22,25,.92));
}
.voice-screen-share-card[data-focus-screen] { cursor: pointer; }

.voice-focus-stage {
  position: absolute;
  inset: 78px 18px 82px;
  z-index: 4;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 98%, #000);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
}
.voice-focus-stage[hidden] { display: none; }
.voice-focus-fullscreen {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 7;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(20,22,27,.78);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.26);
  backdrop-filter: blur(12px);
}
.voice-focus-fullscreen[hidden] { display: none; }
.voice-focus-fullscreen svg { width: 18px; height: 18px; }
.voice-focus-stage:fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  grid-template-rows: minmax(0, 1fr);
  border: 0;
  border-radius: 0;
  background: #000;
  cursor: none;
}
.voice-focus-stage:fullscreen .voice-focus-stage-body { background: #000; }
.voice-focus-stage:fullscreen .voice-focus-fullscreen { display: none; }
.voice-focus-stage:fullscreen .voice-focus-media-label { display: none; }
.voice-focus-stage:fullscreen.fullscreen-controls-visible { cursor: default; }
.voice-focus-stage-body { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; background: #303235; }
.voice-focus-stage-body video { width: 100%; height: 100%; object-fit: cover; background: #030405; }
.voice-focus-stage.screen-focus .voice-focus-stage-body { background: #000; }
#voiceFocusVideo.screen-media {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: fill !important;
  object-position: center center !important;
  flex: 0 0 auto;
  transform: none;
  clip-path: none;
}
.voice-focus-stage-body video[hidden],
.voice-focus-placeholder[hidden] { display: none; }
.voice-focus-placeholder { display: grid; justify-items: center; gap: 10px; text-align: center; }
.voice-focus-placeholder .avatar { width: clamp(74px, 9vw, 112px); height: clamp(74px, 9vw, 112px); }
.voice-focus-placeholder strong { font-size: clamp(18px, 2vw, 25px); }
.voice-focus-placeholder small { color: #b6bbc4; font-size: 12px; }
.voice-focus-screen-icon { display: grid; place-items: center; color: var(--success); }
.voice-focus-screen-icon svg { width: 54px; height: 54px; }
.voice-focus-media-label {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 6;
  max-width: min(70%, 360px);
  padding: 7px 11px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 11px;
  background: rgba(12,14,18,.68);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0,0,0,.24);
  backdrop-filter: blur(12px);
}
.voice-focus-media-label[hidden] { display: none; }
.voice-fullscreen-exit {
  position: absolute;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 8;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 15px;
  background: rgba(20,22,27,.82);
  color: #fff;
  box-shadow: 0 12px 34px rgba(0,0,0,.38);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
  backdrop-filter: blur(14px);
}
.voice-fullscreen-exit[hidden] { display: none; }
.voice-fullscreen-exit svg { width: 21px; height: 21px; }
.voice-focus-stage:fullscreen.fullscreen-controls-visible .voice-fullscreen-exit {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.voice-focus-stage:fullscreen.fullscreen-controls-visible .voice-fullscreen-exit:hover { background: rgba(37,40,48,.94); }

.voice-channel-state.voice-focused.voice-focus-has-strip .voice-focus-stage { bottom: 178px; }
.voice-channel-state.voice-focused .voice-tile-grid { display: none; }
.voice-channel-state.voice-focused.voice-focus-has-strip .voice-tile-grid {
  position: absolute;
  right: 18px;
  bottom: 82px;
  left: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  height: 84px;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.voice-channel-state.voice-focused .voice-participant-grid,
.voice-channel-state.voice-focused .voice-screen-share-list { display: contents; }
.voice-channel-state.voice-focused .voice-participant-card,
.voice-channel-state.voice-focused .voice-screen-share-card {
  flex: 0 0 140px;
  width: 140px;
  height: 79px;
  aspect-ratio: auto;
  border-radius: 13px;
}
.voice-channel-state.voice-focused .voice-participant-card { padding: 8px; }
.voice-channel-state.voice-focused .voice-participant-card .avatar { width: 38px; height: 38px; }
.voice-channel-state.voice-focused .voice-participant-card .voice-participant-identity { gap: 2px; }
.voice-channel-state.voice-focused .voice-participant-card .voice-participant-identity span { display: none; }
.voice-channel-state.voice-focused .voice-tile-caption { right: 5px; bottom: 5px; left: 5px; padding: 5px 7px; }
.voice-channel-state.voice-focused .voice-tile-caption small { display: none; }
.voice-channel-state.voice-focused .voice-screen-watch-btn { min-height: 25px; padding: 0 7px; font-size: 9px; }
.voice-channel-hint { justify-self: center; max-width: 420px; text-align: center; }
.voice-autoplay-btn { width: min(330px, 100%); margin: 0 auto; }

.game-voice-panel button.danger,
.global-voice-dock button.danger {
  color: #fff;
  background: var(--danger);
}

.global-voice-dock {
  position: fixed;
  right: 18px;
  bottom: 82px;
  z-index: 88;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 290px;
  padding: 10px 11px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--success) 35%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.global-voice-dock[hidden] { display: none; }
.global-voice-dock > div { display: grid; min-width: 0; margin-right: auto; }
.global-voice-dock span { color: var(--success); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.global-voice-dock strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-voice-dock button { white-space: nowrap; }

.channel-drawer-backdrop { display: none; }

@media (max-width: 1040px) {
  .game-mode-control b { display: none; }
}

@media (max-width: 760px) {
  .messenger.game-mode-active { grid-template-columns: minmax(0, 1fr); }
  .messenger.game-mode-active > .sidebar { display: none; }
  .messenger.game-mode-active > .chat-pane { display: block; grid-column: 1; }
  .conversation.game-mode { grid-template-columns: minmax(0, 1fr); }
  .conversation.game-mode > *:not(.game-channels):not(.channel-drawer-backdrop) { grid-column: 1; }
  .conversation.game-mode > .game-channels {
    inset: 0 auto 0 0;
    width: min(88vw, 320px);
    transform: translateX(-105%);
  }
  .conversation.game-mode.channels-open > .game-channels { transform: translateX(0); }
  .channel-drawer-backdrop {
    position: absolute;
    inset: 0;
    z-index: 35;
    border: 0;
    background: rgba(0, 0, 0, .48);
  }
  .conversation.game-mode.channels-open .channel-drawer-backdrop { display: block; }
  .conversation.game-mode .chat-header-glass,
  .conversation.game-mode .pinned-bar,
  .conversation.game-mode .chat-compose-glass { left: max(10px, env(safe-area-inset-left)); }
  .voice-channel-state { padding: 82px 14px 92px; }
  .voice-tile-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .voice-participant-card { width: 100%; min-height: 0; padding: 13px 8px; }
  .voice-participant-card .avatar { width: 52px; height: 52px; }
  .voice-active-controls { bottom: max(12px, env(safe-area-inset-bottom)); }
  .voice-focus-stage { inset: calc(68px + env(safe-area-inset-top)) 8px calc(72px + env(safe-area-inset-bottom)); border-radius: 18px; }
  .voice-channel-state.voice-focused.voice-focus-has-strip .voice-focus-stage { bottom: calc(164px + env(safe-area-inset-bottom)); }
  .voice-channel-state.voice-focused.voice-focus-has-strip .voice-tile-grid { right: 8px; bottom: calc(74px + env(safe-area-inset-bottom)); left: 8px; height: 82px; }
  .voice-channel-state.voice-focused .voice-participant-card,
  .voice-channel-state.voice-focused .voice-screen-share-card { flex-basis: 124px; width: 124px; height: 70px; }
  .global-voice-dock { right: 10px; bottom: 74px; left: 10px; min-width: 0; }
}

@media (max-width: 380px) {
  .voice-active-controls { gap: 3px; padding: 5px; }
  .voice-active-controls button { width: 40px; height: 40px; min-height: 40px; }
  .voice-active-controls .voice-control-split { height: 40px; }
  .voice-active-controls .voice-control-split > button:first-child { width: 36px; }
  .voice-active-controls .voice-control-split > .voice-chevron-btn { width: 17px; min-width: 17px; }
  .voice-active-controls button.danger { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .messenger,
  .messenger > .sidebar,
  .messenger > .chat-pane,
  .game-channels,
  .voice-participant-card,
  .voice-fullscreen-exit,
  .voice-presence-person::before {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
  .conversation.game-mode { animation: none; }
}

/* ===== Game Mode v3: members rail + persistent user badge ===== */
.conversation.game-mode {
  grid-template-columns: 272px minmax(0, 1fr) 0;
  overflow: hidden;
  transition: grid-template-columns 220ms cubic-bezier(.2, .72, .2, 1);
}

.conversation.game-mode.members-panel-open {
  grid-template-columns: 272px minmax(0, 1fr) 252px;
}

.conversation.game-mode > *:not(.game-channels):not(.channel-drawer-backdrop):not(.game-members-panel):not(.members-drawer-backdrop) {
  grid-column: 2;
}

.game-sidebar-spacer {
  flex: 1 1 auto;
  min-height: 8px;
}

.game-voice-panel { margin-top: 0; }

.game-user-badge {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: color-mix(in srgb, var(--control) 82%, transparent);
  color: var(--text);
  text-align: left;
  transition: border-color .16s ease, background .16s ease;
}

.game-user-badge:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--control-strong) 84%, transparent);
}

.game-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
}

.game-user-copy,
.game-user-copy strong,
.game-user-copy small {
  display: block;
  min-width: 0;
}

.game-user-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.game-user-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.game-user-copy small i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 12%, transparent);
}

.game-user-copy small.online { color: var(--success); }
.game-user-copy small.online i {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 14%, transparent);
}

.game-members-panel {
  grid-row: 1 / -1;
  z-index: 27;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 252px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 97%, var(--bg));
  opacity: 0;
  pointer-events: none;
  transform: translateX(14px);
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2, .72, .2, 1);
}

.conversation.game-mode > #gameMembersPanel {
  grid-column: 3;
  grid-row: 1 / -1;
}

@media (min-width: 981px) {
  .conversation.game-mode.members-panel-open .chat-header-glass,
  .conversation.game-mode.members-panel-open .chat-compose-glass {
    right: calc(252px + max(12px, env(safe-area-inset-right)));
  }

  .conversation.game-mode.members-panel-open .pinned-bar {
    right: calc(252px + max(18px, env(safe-area-inset-right)));
  }
}

.conversation.game-mode.members-panel-open > .game-members-panel {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.conversation:not(.game-mode):not(.members-panel-open) > .game-members-panel { display: none; }

.conversation.group-chat:not(.game-mode).members-panel-open > .game-members-panel {
  display: flex;
  position: absolute;
  z-index: 48;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 92vw);
  box-shadow: -18px 0 42px rgba(0, 0, 0, .24);
}

.game-members-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 68px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
}

.game-members-panel > header > div { min-width: 0; }
.game-members-panel > header .game-members-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.game-members-panel > header strong { display: block; font-size: 15px; }
.game-members-panel > header span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.game-members-panel > header .playback-icon-btn { width: 34px; height: 34px; flex: 0 0 auto; }
.game-members-panel > header .playback-icon-btn[hidden] { display: none; }

.game-members-list {
  min-height: 0;
  overflow-y: auto;
  padding: 12px 9px 18px;
}

.game-members-group + .game-members-group { margin-top: 20px; }
.game-members-group h3 {
  margin: 0 8px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.game-member-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 5px 7px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.game-member-row:hover { background: var(--control); }
.game-member-avatar-wrap { position: relative; width: 38px; height: 38px; }
.game-member-avatar { width: 38px; height: 38px; border-radius: 13px; }
.member-presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--muted);
}
.member-presence-dot.online { background: var(--success); }
.game-member-row > span:last-child { min-width: 0; }
.game-member-row strong,
.game-member-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-member-row strong { font-size: 13px; }
.game-member-row small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.game-members-empty { margin: 8px; color: var(--muted); font-size: 11px; }

.members-panel-btn svg,
.header-channel-icon svg { width: 19px; height: 19px; }
.channel-lock svg { width: 13px; height: 13px; }
.conversation.game-mode .chat-title h2 { display: flex; align-items: center; gap: 7px; }
.header-channel-icon,
.header-channel-hash { display: inline-grid; place-items: center; flex: 0 0 auto; color: var(--muted); }
.header-channel-hash { width: 18px; font-size: 19px; }

.voice-empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 180px;
  color: var(--text);
  font-size: clamp(19px, 2vw, 24px);
  font-weight: 850;
  letter-spacing: -.015em;
  text-align: center;
}

.members-drawer-backdrop { display: none; }

@media (max-width: 980px) {
  .conversation.game-mode,
  .conversation.game-mode.members-panel-open {
    grid-template-columns: 272px minmax(0, 1fr);
  }
  .conversation.game-mode > #gameMembersPanel {
    position: absolute;
    grid-column: auto;
    grid-row: auto;
    inset: 0 0 0 auto;
    z-index: 37;
    width: min(86vw, 300px);
    opacity: 1;
    transform: translateX(105%);
    box-shadow: -18px 0 60px rgba(0, 0, 0, .28);
  }
  .conversation.game-mode.members-panel-open > #gameMembersPanel { transform: translateX(0); }
  .members-drawer-backdrop {
    position: absolute;
    inset: 0;
    z-index: 36;
    border: 0;
    background: rgba(0, 0, 0, .46);
  }
  .conversation.game-mode.members-panel-open .members-drawer-backdrop { display: block; }
}

@media (max-width: 760px) {
  .conversation.game-mode,
  .conversation.game-mode.members-panel-open {
    grid-template-columns: minmax(0, 1fr);
  }
  .conversation.game-mode > *:not(.game-channels):not(.channel-drawer-backdrop):not(.game-members-panel):not(.members-drawer-backdrop) {
    grid-column: 1;
  }
  .voice-empty-state { min-height: 150px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .conversation.game-mode,
  .game-members-panel { transition-duration: .01ms !important; }
}
.web-e2ee-state {
  position: fixed; z-index: 120; top: max(10px, env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%); max-width: min(620px, calc(100vw - 28px));
  padding: 9px 14px; border-radius: 12px; background: rgba(28, 34, 46, .94);
  border: 1px solid rgba(115, 145, 255, .35); color: #eef2ff; font-size: 13px;
  box-shadow: 0 12px 35px rgba(0,0,0,.28);
}
.web-security-card {
  display: flex; flex-direction: column; gap: 7px; max-width: 460px; margin: 12px auto;
  padding: 16px 18px; border-radius: 20px; background: var(--surface, rgba(30,35,46,.9));
  border: 1px solid rgba(115,145,255,.22); color: inherit;
}
.web-security-card span,.web-security-card small { color: var(--muted, #9aa4b6); }
.secret-chat-invitation{display:grid;gap:8px;max-width:380px}.secret-chat-invitation p{margin:0}.secret-chat-invitation small{opacity:.72;line-height:1.35}.secret-chat-invitation button{justify-self:start;border:0;border-radius:12px;padding:8px 14px;cursor:pointer}
.nestryn-handle-link {
  color: var(--accent, #20b77a);
  font-weight: 650;
  text-decoration: none;
}

.nestryn-handle-link:hover { text-decoration: underline; }

/* A theme may use a white accent together with a white message bubble.  Links
   inside messages inherit the bubble text color so they never disappear. */
.message-bubble .message-text a,
.message-bubble .nestryn-handle-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

/* Floating navigation: the scroll viewport continues behind header and dock. */
/* Own profile mirrors Android: QR/theme above the avatar, then personal/settings cards. */
.android-self-profile .profile-top { grid-template-columns: 44px minmax(0,1fr) 44px; min-height: 56px; }
.profile-dialog:not(.android-self-profile) .profile-top { grid-template-columns: 44px minmax(0,1fr) auto 42px; }
.profile-dialog:not(.android-self-profile) #profileCloseBtn { grid-column: 4; }
.profile-dialog:not(.android-self-profile) .profile-top h3 { grid-column: 2; grid-row: 1; }
#profileQrBtn { grid-column: 1; grid-row: 1; width: 44px; height: 44px; border-radius: 22px; background: color-mix(in srgb, var(--panel) 85%, transparent); border: 1px solid var(--line); backdrop-filter: blur(16px); }
.android-self-profile .profile-top-actions { grid-column: 3; }
.android-self-profile #profileName, .android-self-profile #profileStatus, .android-self-profile #profileAvatarEdit { display: none; }
.android-self-profile .profile-view { gap: 16px; }
.android-self-profile .profile-avatar-btn, .android-self-profile .profile-avatar { width: 184px; height: 184px; }
.profile-change-photo { display: flex; align-items: center; justify-self: center; gap: 8px; height: 44px; border: 1px solid var(--line); border-radius: 22px; padding: 0 16px; background: color-mix(in srgb, var(--panel) 85%, transparent); backdrop-filter: blur(16px); color: var(--text); font-size: 14px; }
.profile-change-photo svg { width: 20px; height: 20px; }
.profile-change-photo[hidden] { display: none; }
.profile-field-menu { position: fixed; z-index: 105; width: 220px; padding: 8px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.profile-field-menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 12px; color: var(--text); background: transparent; text-align: left; }
.profile-field-menu button:hover { background: var(--panel-soft); }
.profile-field-menu svg { width: 22px; height: 22px; }
.android-self-profile .profile-details, .profile-security-card { padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: 0 5px 16px rgba(0,0,0,.07); }
.android-self-profile .profile-details h3, .profile-security-card h3 { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.android-self-profile .profile-detail-row { border: 0; border-radius: 12px; padding: 5px 0; background: transparent; text-align: left; color: var(--text); }
.android-self-profile .profile-detail-row strong { font-size: 17px; font-weight: 400; }
.android-self-profile .profile-detail-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.android-self-profile .profile-actions { display: grid; grid-template-columns: 1fr; gap: 16px; }
.profile-security-card p { text-align: left; margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.profile-security-card button { width: 100%; height: 54px; border-radius: 27px; justify-content: center; background: var(--accent); color: var(--accent-text); }
.android-self-profile .profile-actions .profile-logout { justify-content: center; color: var(--danger); border-radius: 22px; background: transparent; border: 1px solid var(--line); }
.android-self-profile.is-tab-panel > .profile-sheet { max-width: 808px; margin: 0 auto; }
.profile-qr-overlay { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.3); }
.profile-qr-overlay[hidden] { display: none; }
.profile-qr-sheet { width: min(304px,100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 16px; display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 28px; background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(32px); color: var(--text); box-shadow: var(--shadow); }
.profile-qr-sheet header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.profile-qr-sheet h3 { margin: 0; font-size: 19px; font-weight: 600; }
.profile-qr-sheet button { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 22px; border: 1px solid color-mix(in srgb, var(--text) 8%, transparent); background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); padding: 0; }
.profile-qr-sheet #profileQrCloseBtn { width: 36px; height: 36px; }
.profile-qr-sheet button svg { width: 22px; height: 22px; }
.profile-qr-code { width: min(232px,100%); aspect-ratio: 1; justify-self: center; border-radius: 20px; background: white; overflow: hidden; }
.profile-qr-code svg { width: 100%; height: 100%; display: block; }
.profile-qr-sheet p { margin: 0; font-size: 12px; text-align: center; line-height: 1.4; }
.profile-qr-actions { display: flex; align-items: center; gap: 8px; }
.profile-qr-actions #profileQrScanBtn { flex: 1; width: auto; font-size: 14px; }
.profile-qr-sheet [hidden] { display: none; }

/* One floating surface for navigation, profile QR and action islands in both themes. */
:root { --floating-surface: color-mix(in srgb,var(--panel) 58%,transparent); }
:is(.sidebar-bottom-island,.chat-create-fab,.profile-qr-sheet,.message-context-menu,.user-context-menu,.chat-create-menu,.pinned-bar,#cloudBtn,#sidebarSearchBtn,#themeToggleBtn,.profile-qr-sheet button,.chat-call-actions button,.profile-actions > button,#pinnedListBtn) {
  background: linear-gradient(145deg,var(--compose-glass-fill-top),var(--compose-glass-fill-bottom)),var(--floating-surface);
  border: 1px solid var(--compose-glass-stroke);
  color:var(--text);
  backdrop-filter:blur(28px) saturate(1.25);-webkit-backdrop-filter:blur(28px) saturate(1.25);
  box-shadow:inset 0 1px 0 var(--compose-glass-highlight),0 10px 30px rgba(0,0,0,.12);
}
.message-context-menu,.user-context-menu,.chat-create-menu { --floating-surface:color-mix(in srgb,var(--panel) 78%,transparent); }
.profile-qr-code { background:#fff; } /* QR contrast is independent of the glass behind it. */
.chat-header-islands.chat-header-glass { padding:0; gap:8px; background:transparent; border:0; box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; }
.chat-identity-island { display:flex; align-items:center; gap:10px; min-width:0; max-width:none; height:100%; padding:6px 16px 6px 8px; border-radius:999px; flex:1 1 0; }
.chat-identity-island .chat-title { flex:1; min-width:0; }
.chat-header-islands .chat-call-actions { height:100%; padding:6px; border-radius:999px; gap:4px; margin-left:0; flex:0 0 auto; }
.chat-header-islands .chat-call-actions:not(:has(button:not([hidden]))) { display:none; }
.chat-header-islands .header-back-island { width:var(--floating-header-height); height:var(--floating-header-height); flex:0 0 var(--floating-header-height); border-radius:50%; }
#conversation .chat-header-islands .chat-call-actions .icon-btn { background:transparent; border:0; box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; }
/* Quiet, theme-tinted scroll thumbs: no native arrows, frame or visible track. */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text) 22%, transparent) transparent;
}
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto; scrollbar-color: auto; }
  :root ::-webkit-scrollbar { width: 5px; height: 5px; background: transparent; }
  :root ::-webkit-scrollbar-track,
  :root ::-webkit-scrollbar-corner { background: transparent; border: 0; }
  :root ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  :root ::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text) 22%, transparent);
    border: 0;
    border-radius: 999px;
    min-height: 32px;
  }
  :root ::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text) 34%, transparent); }
}
.sidebar { position: relative; background: var(--custom-chat-list-bg); }
.sidebar-header { position: absolute; inset: 0 0 auto; z-index: 5; min-height: 96px; padding: 22px 20px; gap: 10px; border: 0; background: transparent; }
.sidebar-wordmark { flex: 1; min-width: 0; font-size: 28px; font-weight: 700; letter-spacing:0; }
.sidebar-header-circle { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: color-mix(in srgb, var(--panel) 75%, transparent); color: var(--text); backdrop-filter: blur(16px); box-shadow: 0 8px 24px rgba(0,0,0,.10); }
.sidebar-header-circle svg, .sidebar-header-circle .sidebar-nav-icon { width: 24px; height: 24px; }
.sidebar-header-circle[hidden], .sidebar .search-wrap[hidden] { display: none; }
.sidebar-header-circle:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.sidebar .search-wrap { flex: 1; min-width: 0; height: 48px; margin: 0; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(16px); }
.sidebar .search-wrap input { height: 100%; min-width: 0; width: 100%; border: 0; background: transparent; padding: 0; color: var(--text); }
.sidebar.search-open .sidebar-wordmark, .sidebar.search-open #cloudBtn { display: none; }
.sidebar.search-open #sidebarSearchBtn { order: -1; }
.chat-list { padding: 104px 10px 190px; scroll-padding: 104px 0 110px; }
.sidebar-bottom-island { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; }
.chat-create-fab { bottom: 110px; }
.chat-create-menu { bottom: 172px; }
.chat-pane { position: relative; }
.profile-dialog.is-tab-panel { position: absolute; inset: 0; z-index: 15; display: block; padding: 0; background: transparent; backdrop-filter: none; }
.profile-dialog.is-tab-panel > .profile-sheet { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: 24px; align-content: start; }
.messenger.profile-tab-open > .chat-pane, .messenger.cloud-tab-open > .chat-pane { display: block; }
.messenger.profile-tab-open .conversation, .messenger.profile-tab-open .empty-state,
.messenger.cloud-tab-open .conversation, .messenger.cloud-tab-open .empty-state { visibility: hidden; pointer-events: none; }
@media (max-width: 760px) {
  .messenger.profile-tab-open, .messenger.cloud-tab-open { position: relative; }
  .messenger.profile-tab-open > .sidebar, .messenger.cloud-tab-open > .sidebar { display: flex; position: absolute; inset: auto 0 0; z-index: 25; height: 96px; border: 0; background: transparent; pointer-events: none; }
  .messenger.profile-tab-open > .sidebar > :not(.sidebar-bottom-island), .messenger.cloud-tab-open > .sidebar > :not(.sidebar-bottom-island) { display: none; }
  .messenger.profile-tab-open .sidebar-bottom-island, .messenger.cloud-tab-open .sidebar-bottom-island { pointer-events: auto; }
  .profile-dialog.is-tab-panel > .profile-sheet { padding: calc(16px + env(safe-area-inset-top)) 16px calc(112px + env(safe-area-inset-bottom)); }
  .global-voice-dock { bottom: 106px; }
}
