* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#profileHome.scp-profile-v3 {
  --profile-v3-bg: var(--bg) !important;
  --profile-v3-card: var(--panel) !important;
  --profile-v3-muted: var(--muted) !important;
  --profile-v3-line: var(--border) !important;
  --profile-v3-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  overflow-y: auto;
  align-items: stretch;
  justify-content: flex-start;
  background: var(--profile-v3-bg) !important;
  color: var(--text) !important;
  padding: 18px 16px !important;
  --profile-v3-card-soft: var(--panel2) !important;
  --profile-v3-on-accent: var(--accent-text, #fff);
}

#profileHome.scp-profile-v3 .scp-profile-v3-shell {
  width: min(760px, calc(100vw - 120px)) !important;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px !important;
  max-width: 100% !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-card {
  background: var(--profile-v3-card) !important;
  border: 0.5px solid var(--profile-v3-line) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-identity {
  min-height: 136px !important;
  padding: 12px !important;
  display: grid !important;
  grid-template-columns: 88px minmax(0, 1fr) 104px !important;
  grid-template-rows: auto auto auto !important;
  gap: 8px 12px !important;
  align-items: center !important;
  position: relative !important;
  grid-template-areas:
    "avatar title qr"
    "badges title qr"
    ". actions actions" !important;
  overflow: visible !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-back {
  position: absolute !important;
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 52px !important;
  height: 52px !important;
  border: 0.5px solid var(--profile-v3-line) !important;
  border-radius: 50% !important;
  background: var(--profile-v3-card) !important;
  box-shadow: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  left: -66px !important;
  top: 0 !important;
  z-index: 2 !important;
  grid-area: unset !important;
  min-width: 52px !important;
  min-height: 52px !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-back img {
  width: 22px !important;
  height: 22px !important;
  filter: var(--icon-filter, none);
  opacity: 0.78 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-avatar {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 88px !important;
  height: 88px !important;
  border-radius: 50%;
  background: var(--avatar-bg, var(--profile-v3-card-soft)) !important;
  box-shadow: none !important;
  overflow: hidden;
  align-self: start;
  grid-area: avatar !important;
  border: 0.5px solid var(--profile-v3-line) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-title {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 0 !important;
  padding-left: 0 !important;
  align-self: center !important;
  grid-area: title !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-title h1 {
  margin: 0;
  max-width: 100%;
  color: var(--text) !important;
  font-size: 30px !important;
  line-height: 1.05 !important;
  font-weight: 850 !important;
  letter-spacing: 0;
  text-transform: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#profileHome.scp-profile-v3 .scp-profile-v3-title #profileHomeTag, #profileHome.scp-profile-v3 .scp-profile-v3-title .scp-profile-v3-id {
  color: var(--profile-v3-muted) !important;
  font-size: 17px !important;
  line-height: 1.18 !important;
  font-weight: 650 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#profileHome.scp-profile-v3 .scp-profile-v3-qr {
  grid-column: 3;
  grid-row: 1 / span 2;
  width: 96px !important;
  height: 96px !important;
  justify-self: end !important;
  align-self: start !important;
  padding: 4px !important;
  background: #fff !important;
  border-radius: 4px !important;
  overflow: hidden !important;
  grid-area: qr !important;
  min-width: 96px !important;
  min-height: 96px !important;
  display: grid !important;
  grid-template-columns: repeat(11, 1fr) !important;
  gap: 1px !important;
  place-items: stretch !important;
  border: 0 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-badges {
  grid-column: 1 / 3;
  grid-row: 3;
  min-height: 24px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 0 !important;
  grid-area: badges !important;
  align-self: end !important;
  flex-wrap: wrap !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-actions {
  grid-column: 3;
  grid-row: 3;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 8px !important;
  grid-area: actions !important;
  min-width: 0 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-action, #profileHome.scp-profile-v3 .scp-profile-v3-photo-pick {
  min-height: 40px !important;
  padding: 0 16px !important;
  border: 0.5px solid var(--profile-v3-line) !important;
  border-radius: 999px !important;
  background: var(--profile-v3-card-soft) !important;
  color: var(--text) !important;
  font-weight: 800 !important;
  cursor: pointer;
  font-size: 15px !important;
  white-space: nowrap !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-action.primary, #profileHome.scp-profile-v3 .scp-profile-v3-photo-pick {
  border-color: transparent !important;
  background: var(--accent) !important;
  color: var(--profile-v3-on-accent) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-action:disabled {
  opacity: 0.65;
  cursor: default;
}

#profileHome.scp-profile-v3 .scp-profile-v3-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-stat {
  min-height: 74px !important;
  padding: 14px 12px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: var(--profile-v3-card-soft) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-stat strong {
  display: block;
  color: var(--text);
  font-size: 30px !important;
  line-height: 1 !important;
  font-weight: 850 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-stat span, #profileHome.scp-profile-v3 .scp-profile-v3-label {
  display: block;
  color: var(--profile-v3-muted) !important;
  font-size: 14px !important;
  font-weight: 750 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-panel, #profileHome.scp-profile-v3 .scp-profile-v3-channel, #profileHome.scp-profile-v3 .scp-profile-v3-birth, #profileHome.scp-profile-v3 .scp-profile-v3-uploader, #profileHome.scp-profile-v3 .scp-profile-v3-posts-card {
  padding: 12px !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-panel p {
  margin: 12px 0 0 !important;
  color: var(--text);
  font-size: 16px !important;
  line-height: 1.45 !important;
  font-weight: 750 !important;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#profileHome.scp-profile-v3 .scp-profile-v3-channel-row, #profileHome.scp-profile-v3 .scp-profile-v3-birth-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) !important;
  gap: 12px !important;
  align-items: center;
  margin-top: 10px !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-channel-avatar, #profileHome.scp-profile-v3 .scp-profile-v3-birth-icon {
  width: 72px !important;
  height: 72px !important;
  border-radius: 10px !important;
  background: var(--profile-v3-card-soft) !important;
  overflow: hidden;
  border: 0.5px solid var(--profile-v3-line) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-channel-row strong {
  display: block;
  color: var(--text);
  font-size: 26px !important;
  line-height: 1.05 !important;
  font-weight: 850 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#profileHome.scp-profile-v3 .scp-profile-v3-channel-row span, #profileHome.scp-profile-v3 .scp-profile-v3-channel-row b, #profileHome.scp-profile-v3 .scp-profile-v3-birth-row strong, #profileHome.scp-profile-v3 .scp-profile-v3-birth-row span {
  display: block;
  color: var(--text);
  font-size: 16px !important;
  line-height: 1.25 !important;
  font-weight: 750 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-channel-row span {
  color: var(--profile-v3-muted);
}

#profileHome.scp-profile-v3 .scp-profile-v3-uploader {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

#profileHome.scp-profile-v3 .scp-profile-v3-uploader.hidden {
  display: none !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-photo-preview {
  width: 150px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: var(--panel2);
  grid-row: span 3;
}

#profileHome.scp-profile-v3 .scp-profile-v3-uploader input[type="text"], #profileHome.scp-profile-v3 .scp-profile-v3-uploader textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--profile-v3-line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 78%, #ffffff 22%);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-weight: 750;
  resize: vertical;
}

#profileHome.scp-profile-v3 .scp-profile-v3-post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#profileHome.scp-profile-v3 .scp-profile-v3-post, #profileHome.scp-profile-v3 .scp-profile-v3-empty-posts {
  position: relative;
  min-height: 260px;
  border-radius: 8px !important;
  background: var(--surface-sunken, var(--profile-v3-card-soft)) !important;
  overflow: hidden;
}

#profileHome.scp-profile-v3 .scp-profile-v3-empty-posts {
  grid-column: 1 / -1;
  min-height: 240px !important;
  display: grid;
  place-items: center;
  color: var(--profile-v3-muted);
  font-size: 18px;
  font-weight: 850;
}

#profileHome.scp-profile-v3 .scp-profile-v3-post-img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  aspect-ratio: 4 / 5.7;
  object-fit: cover;
  display: block;
}

#profileHome.scp-profile-v3 .scp-profile-v3-post-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 34px 10px 10px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0));
}

#profileHome.scp-profile-v3 .scp-profile-v3-post-text strong, #profileHome.scp-profile-v3 .scp-profile-v3-post-text p {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
}

#profileHome.scp-profile-v3 .scp-profile-v3-post-text strong {
  font-size: 16px;
  font-weight: 900;
}

#profileHome.scp-profile-v3 .scp-profile-v3-post-text p {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.25;
}

#profileHome.scp-profile-v3 .scp-profile-v3-post-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 768px) {
  #profileHome.scp-profile-v3 {
    padding: 10px 10px max(18px, env(safe-area-inset-bottom, 0px));
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-shell {
    width: 100%;
    gap: 10px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-identity {
    grid-template-columns: 96px minmax(0, 1fr) 92px;
    min-height: 174px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-back {
    width: 92px;
    height: 92px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-avatar {
    width: 100px;
    height: 100px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-title {
    padding-left: 112px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-qr {
    width: 88px;
    height: 88px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-actions {
    grid-column: 2 / 4;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-uploader {
    grid-template-columns: 1fr;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-photo-preview {
    width: 100%;
    max-height: 340px;
    grid-row: auto;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-post, #profileHome.scp-profile-v3 .scp-profile-v3-empty-posts {
    min-height: 448px;
  }
}

@media (max-width: 430px) {
  #profileHome.scp-profile-v3 .scp-profile-v3-identity {
    grid-template-columns: 82px minmax(0, 1fr) 74px;
    min-height: 156px;
    gap: 8px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-back {
    width: 82px;
    height: 82px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-avatar {
    width: 78px;
    height: 78px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-title {
    padding-left: 88px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-title h1 {
    font-size: 24px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-title #profileHomeTag, #profileHome.scp-profile-v3 .scp-profile-v3-title .scp-profile-v3-id {
    font-size: 16px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-qr {
    width: 72px;
    height: 72px;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-channel-row, #profileHome.scp-profile-v3 .scp-profile-v3-birth-row {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-post, #profileHome.scp-profile-v3 .scp-profile-v3-empty-posts {
    min-height: 448px;
  }
}

.update-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 8, 5, 0.72);
  backdrop-filter: blur(18px);
}

.update-modal.hidden {
  display: none;
}

.update-card {
  position: relative;
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid rgba(240, 180, 90, 0.36);
  border-radius: 30px;
  background:
    radial-gradient(circle at 24% 10%, rgba(149, 175, 185, 0.22), transparent 34%),
    linear-gradient(150deg, rgba(50, 39, 27, 0.98), rgba(22, 18, 13, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.54);
  color: var(--text);
  animation: modal-pop 0.22s ease both;
}

.update-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.update-icon {
  width: 74px;
  height: 74px;
  margin-bottom: 18px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

.update-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.update-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.update-card h2 {
  margin: 6px 0 8px;
  font-size: clamp(26px, 5vw, 34px);
}

.update-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.update-version {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(240, 180, 90, 0.2);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--accent);
  font-weight: 800;
}

.update-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.update-actions button {
  flex: 1;
}

@media (max-width: 520px) {
  .update-modal {
    align-items: end;
    padding: 12px;
  }

  .update-card {
    border-radius: 26px;
    padding: 24px;
  }

  .update-actions {
    flex-direction: column;
  }
}

:root {
  --bg: #202020;
  --panel: #242424;
  --panel2: #161616;
  --text: #e4e2d5;
  --muted: #8e98a3;
  --border: #202020;
  --accent: #5cd372;
  --accent-hover: #4fb85f;
  --accent-text: #161616;
  --input-bg: #242424;
  --input-bg-focus: #2b3542;
  --hint: #6c757d;
  --danger: #e53935;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-avatar: 15px;
  --avatar-bg: #d9d9d9;
  --avatar-text: #202020;
  --bubble-in: #161616;
  --bubble-out: #5cd372;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --surface-soft: color-mix(in srgb, var(--panel) 88%, transparent);
  --surface-strong: color-mix(in srgb, var(--panel2) 88%, transparent);
  --hairline: color-mix(in srgb, var(--border) 72%, white 8%);
  --shadow-soft: 0 16px 36px rgba(0, 0, 0, 0.24);
  --shadow-popover: 0 24px 70px rgba(0, 0, 0, 0.42);
  --ink-glow: rgba(92, 211, 114, 0.2);
  --blue-glow: rgba(80, 151, 255, 0.12);
  --shell-line: rgba(255, 255, 255, 0.055);
  --scp-keyboard-offset: 0px;
  --scp-chat-soft-bg: var(--chat-bg, var(--bg));
  --scp-chat-pill: color-mix(in srgb, var(--panel) 88%, var(--bg) 12%);
  --scp-chat-pill-strong: color-mix(in srgb, var(--panel2) 86%, var(--panel) 14%);
  --scp-chat-icon: color-mix(in srgb, var(--text) 72%, var(--muted) 28%);
  --scp-chat-muted-icon: color-mix(in srgb, var(--muted) 82%, var(--text) 18%);
  --scp-chat-shadow: 0 4px 9px rgba(0, 0, 0, 0.28);
  --scp-chat-action: var(--accent);
  --scp-chat-action-text: var(--accent-text);
  --scp-composer-bg: color-mix(in srgb, var(--panel) 88%, var(--bg) 12%);
  --scp-composer-input-bg: color-mix(in srgb, var(--panel2) 82%, var(--panel) 18%);
  --scp-composer-border: color-mix(in srgb, var(--border) 72%, transparent);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 12%, color-mix(in srgb, var(--accent) 18%, transparent) 0 18%, transparent 34%),
    radial-gradient(circle at 88% 18%, var(--blue-glow) 0 15%, transparent 32%),
    radial-gradient(circle at 56% 100%, rgba(255, 255, 255, 0.035) 0 18%, transparent 42%),
    linear-gradient(135deg, #151816 0%, var(--bg) 48%, #121614 100%);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: calc(16px * var(--font-scale, 1));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-color: var(--chat-bg, var(--bg));
  background-image: var(--chat-bg-image, none);
  background-size: cover;
  background-position: center;
  opacity: calc(var(--wallpaper-opacity, 0.16) * 0.28);
  pointer-events: none;
  z-index: -1;
}

.hidden {
  display: none !important;
}

.auth-container {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 34%),
    transparent;
}

.server-setup {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--panel) 72%, #000 28%), #101010);
}

.server-setup-card {
  width: min(430px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border) 82%);
  border-radius: 28px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.server-setup-logo {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 38%, #fff 62%));
  color: #121212;
  font-size: 28px;
  font-weight: 950;
}

.server-setup-card h1 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
}

.server-setup-card p, .server-setup-card label, .server-setup-status {
  color: var(--muted);
}

.server-setup-card input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel2);
  color: var(--text);
  padding: 0 14px;
}

.server-setup-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.server-setup-status.success {
  color: var(--accent);
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.logo {
  width: 48px;
  height: 48px;
  background: var(--avatar-bg);
  border-radius: var(--radius-avatar);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: var(--avatar-text);
}

.auth-header .logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 20px;
  font-size: 48px;
}

.auth-header h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.auth-status, .auth-hint {
  text-align: center;
  font-size: 14px;
  min-height: 20px;
}

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

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

.auth-status.success {
  color: var(--accent);
}

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

.auth-btn, .auth-switch-btn, .btn-primary, .btn-secondary, .create-chat-btn, .send-btn, .action-btn, .list-tab, .chatItem {
  transition: all 0.2s;
}

.auth-btn, .btn-primary {
  padding: 12px 24px;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  color: var(--accent-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.auth-btn:hover, .btn-primary:hover {
  background: var(--accent-hover);
}

.auth-switch-btn, .btn-secondary {
  padding: 10px 20px;
  background: var(--panel);
  border: 1px solid var(--input-bg-focus);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.auth-switch-btn:hover, .btn-secondary:hover {
  background: var(--input-bg-focus);
}

.server-switch-btn {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--input-bg-focus) 58%);
  color: var(--accent);
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.form-group input, .form-group select, .list-search input, #textInput {
  width: 100%;
  padding: 12px 16px;
  background: var(--panel2);
  border: 1px solid var(--input-bg-focus);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.form-group input:focus, .form-group select:focus, .list-search input:focus, #textInput:focus {
  border-color: var(--accent);
  background: #1a1a1a;
}

.form-group input::placeholder, .list-search input::placeholder, #textInput::placeholder {
  color: var(--hint);
}

#layout {
  display: grid;
  grid-template-columns: 70px 420px 1fr;
  height: 100vh;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0)),
    transparent;
}

#sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.018)),
    color-mix(in srgb, var(--panel) 80%, transparent);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  position: relative;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.app-name {
  font-size: 12px;
  color: color-mix(in srgb, var(--text) 86%, var(--accent) 14%);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.action-btn img, .send-btn img {
  display: block;
  filter: none;
}

#chatList {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    color-mix(in srgb, var(--panel) 82%, transparent);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  animation-delay: 0.04s;
}

.chat-list-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-list-header h2 {
  font-size: 18px;
  font-weight: 750;
  color: var(--text);
}

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

.create-chat-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: var(--accent-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.create-chat-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.08);
}

.list-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
  background: color-mix(in srgb, var(--panel2) 56%, transparent);
}

.list-tab {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--panel2);
  color: var(--muted);
  cursor: pointer;
  min-height: 34px;
  font-weight: 700;
}

.list-tab.active {
  color: var(--accent-text);
  background: var(--accent);
  border-color: transparent;
  box-shadow:
    0 8px 18px color-mix(in srgb, var(--accent) 22%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.list-search {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}

#chatListContent {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.chatItem {
  width: 100%;
  padding: 13px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  text-align: left;
  position: relative;
  min-height: 76px;
  padding-right: 74px;
  border-bottom-color: color-mix(in srgb, var(--border) 72%, transparent);
  isolation: isolate;
  animation: none;
}

.chatItem:hover {
  background: color-mix(in srgb, var(--panel) 74%, white 7%);
}

.chatItem.active {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 42%),
    var(--surface-strong);
}

.chatItem .avatar {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-avatar);
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.82), transparent 18%),
    linear-gradient(145deg, #e7ece8, #b8c2bd);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--avatar-text);
  font-weight: 600;
  flex-shrink: 0;
  font-size: 18px;
}

.chatItem .info {
  flex: 1;
  min-width: 0;
}

.chatItem .name {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatItem .last-message {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.36;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.chat-unread-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 24%, transparent);
  position: absolute;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.chat-presence-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8f96a6;
  flex-shrink: 0;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel2) 76%, transparent);
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.chat-presence-dot.online {
  background: #39d363;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--panel2) 76%, transparent),
    0 0 14px color-mix(in srgb, #39d363 45%, transparent);
}

#chat {
  display: flex;
  flex-direction: column;
  background: var(--scp-chat-soft-bg);
  min-height: 0;
  position: relative;
  overflow: hidden;
  animation-delay: 0.08s;
}

#chatHeader {
  height: 86px;
  background: transparent;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  position: relative;
  z-index: 30;
  order: 0;
  min-height: 86px;
  border: 0;
}

.pinned-bar {
  min-height: 58px;
  padding: 8px 20px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  flex-shrink: 0;
}

.pinned-bar-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel2) 84%, transparent);
  border-radius: 16px;
  padding: 10px 12px;
  cursor: pointer;
}

.pinned-bar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.pinned-bar-text {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pinned-bar-clear {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
}

.chat-search-bar {
  min-height: 58px;
  padding: 8px 20px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  flex-shrink: 0;
}

.chat-search-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
  color: var(--text);
  border-radius: 16px;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
}

.chat-folders-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
  scrollbar-width: thin;
}

.chat-folders-bar button {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border) 84%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
  color: var(--muted);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.chat-folders-bar button:hover, .chat-folders-bar button.active {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--accent) 24%, var(--panel2) 76%);
  color: var(--text);
}

.tg-settings-nav [data-settings-locked="1"]:not([data-settings-panel="privacy"]) {
  opacity: 0.45;
  cursor: not-allowed;
}

.tg-settings-nav [data-settings-panel="privacy"], .tg-settings-nav [data-settings-panel="privacy"][disabled], .tg-settings-nav [data-settings-panel="privacy"][aria-disabled="true"], .tg-settings-nav [data-settings-panel="privacy"][data-settings-locked="1"] {
  opacity: 1 !important;
  filter: none !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  color: color-mix(in srgb, var(--text) 92%, transparent) !important;
}

.tg-settings-nav [data-settings-panel="privacy"] span, .tg-settings-nav [data-settings-panel="privacy"] .tg-settings-nav-icon {
  opacity: 1 !important;
  color: inherit !important;
}

.chat-folders-bar .folder-create {
  width: 32px;
  padding: 0;
}

.chat-folders-settings {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.folder-settings-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.folder-settings-create input {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.folder-settings-create button, .folder-settings-title button {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 0 14px;
  font-weight: 950;
  cursor: pointer;
}

.folder-settings-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.folder-settings-card {
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 18px;
  padding: 12px;
  background: color-mix(in srgb, var(--panel2) 72%, transparent);
}

.folder-settings-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.folder-settings-title button {
  background: color-mix(in srgb, #ff6961 24%, var(--panel2) 76%);
  color: var(--text);
}

.folder-settings-chat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.folder-settings-chat {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 14px;
  padding: 9px 10px;
  background: color-mix(in srgb, var(--panel) 62%, transparent);
  color: var(--text);
  font-weight: 800;
}

.folder-settings-chat span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-settings-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel2) 72%, transparent);
  padding: 12px;
}

.notification-settings-panel > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
}

.notification-settings-head {
  align-items: center;
}

.notification-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notification-settings-panel span, .notification-settings-panel small {
  color: var(--muted);
  line-height: 1.4;
}

.notification-push-status {
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 9px 11px;
}

.notification-settings-panel button {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 9px 14px;
  font-weight: 950;
  cursor: pointer;
}

.notification-settings-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 850;
}

.media-device-tools, .media-device-panel {
  display: grid;
  gap: 12px;
}

.media-device-tools {
  padding: 14px 16px 16px;
}

.media-device-actions, .settings-utility-grid, .settings-cache-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.media-device-actions button, .settings-utility-grid button, .settings-cache-grid button {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--hairline) 78%);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.media-device-actions button:hover, .media-device-actions button:focus-visible, .settings-utility-grid button:hover, .settings-utility-grid button:focus-visible, .settings-cache-grid button:hover, .settings-cache-grid button:focus-visible {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel2) 84%);
  box-shadow: var(--focus-ring);
}

.media-device-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.media-device-panel small {
  color: var(--muted);
  line-height: 1.45;
}

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

.media-device-grid > div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--hairline) 74%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 54%, transparent);
}

.media-device-grid strong {
  color: var(--text);
  font-size: 13px;
}

.media-device-grid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.settings-camera-preview {
  width: min(100%, 460px);
  max-height: 260px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--hairline) 80%);
  border-radius: 18px;
  background: #050505;
  object-fit: cover;
}

.settings-utility-grid {
  padding: 14px 16px 16px;
}

.settings-cache-panel {
  display: grid;
  gap: 8px;
  margin: 0 16px 16px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--hairline) 80%);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 58%, transparent);
}

.settings-cache-panel strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
}

.settings-cache-panel small {
  color: var(--muted);
  line-height: 1.4;
}

.push-optin-prompt {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1500;
  width: min(430px, calc(100vw - 28px));
  animation: pushOptIn 0.28s ease both;
}

.push-optin-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border) 68%);
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 35%),
    color-mix(in srgb, var(--panel2) 92%, #000 8%);
  box-shadow: 0 24px 70px color-mix(in srgb, #000 52%, transparent);
  padding: 14px;
  backdrop-filter: blur(18px);
}

.push-optin-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 54%, #fff 46%));
  color: var(--accent-text);
  font-weight: 1000;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 28%, transparent);
}

.push-optin-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.push-optin-body strong {
  color: var(--text);
  font-size: 16px;
}

.push-optin-body span {
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}

.push-optin-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.push-optin-actions button {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border) 70%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: var(--text);
  padding: 9px 14px;
  font-weight: 950;
  cursor: pointer;
}

.push-optin-actions [data-push-optin-allow] {
  background: var(--accent);
  color: var(--accent-text);
}

@keyframes pushOptIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-list-soft-update .chatItem {
  animation-duration: 0.12s;
}

.user-decorations {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.emoji-status {
  display: inline-grid !important;
  place-items: center !important;
  width: 18px !important;
  min-width: 18px !important;
  height: 18px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 16px !important;
  line-height: 1 !important;
  font-weight: 900;
  color: inherit !important;
  min-height: 18px !important;
}

.system-badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text) !important;
  font-size: 0 !important;
  font-weight: 950;
  box-shadow: none !important;
  --scp-system-badge-icon: none;
  position: relative;
  overflow: hidden;
  line-height: 1 !important;
}

.system-badge-confirmed {
  border-radius: 6px;
  --scp-system-badge-icon: url("icons/status-confirmed.svg");
  color: #ffad42 !important;
}

.system-badge-supporter {
  color: #ff624f !important;
  --scp-system-badge-icon: url("icons/status-supporter.svg");
}

.chat-search-count {
  min-width: 52px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.back-btn {
  display: none;
}

.profile-mobile-btn, .settings-mobile-btn {
  display: none;
}

.chat-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 64px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--scp-chat-pill);
  box-shadow: var(--scp-chat-shadow);
}

.chat-user .avatar {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--avatar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--avatar-text);
  font-weight: 600;
  flex-shrink: 0;
  font-size: 18px;
}

.chat-user .info {
  min-width: 0;
}

.chat-user .name {
  font-weight: 950;
  color: var(--text);
  font-size: 24px;
  margin-bottom: 2px;
  letter-spacing: 0;
  line-height: 1;
}

.chat-user .status {
  font-size: 11px;
  color: color-mix(in srgb, var(--muted) 78%, var(--text) 22%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.08;
  font-weight: 900;
}

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

.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--panel2) 84%), var(--panel2));
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border) 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.secure-badge img {
  filter: invert(65%) sepia(37%) saturate(620%) hue-rotate(74deg) brightness(94%) contrast(89%);
}

#messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto !important;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  position: relative;
  background: transparent;
  background-size: 28px 28px, auto;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, repeat;
  background-attachment: local, local, scroll;
  isolation: isolate;
  z-index: 1;
  background-image:
    radial-gradient(circle at 18px 18px, rgba(255, 255, 255, 0.022) 1px, transparent 1.5px),
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0));
  scroll-behavior: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  overscroll-behavior-y: contain !important;
  scroll-padding-block: 72px 120px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  padding-top: 12px;
}

#messages::before {
  display: none;
}

#messages > * {
  position: relative;
  z-index: 1;
}

.empty-chat {
  margin: auto;
  max-width: 420px;
  border: 1px solid var(--border);
  background: var(--panel2);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  line-height: 1.45;
}

.message {
  max-width: var(--message-max-width, 65%);
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  word-wrap: break-word;
  animation: messageSlide 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
  position: relative;
  line-height: 1.45;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  animation-duration: var(--motion-message, 0.228s);
  transform-origin: 50% 100%;
  animation-name: messagePopIn;
  will-change: transform, opacity;
}

#messages.messages-stable-render .message {
  animation: none !important;
}

.message.message-no-enter {
  animation: none !important;
}

.message.active {
  outline: 1px solid color-mix(in srgb, var(--accent) 56%, transparent);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent),
    0 14px 32px rgba(0, 0, 0, 0.18);
}

.message.search-hit {
  box-shadow: 0 0 0 3px color-mix(in srgb, #f3b24e 14%, transparent);
}

.message-search-mark {
  background: color-mix(in srgb, #f3b24e 64%, transparent);
  color: #1a1a1a;
  border-radius: 4px;
  padding: 0 2px;
  box-shadow: 0 0 0 2px rgba(243, 178, 78, 0.18);
}

.message.system {
  align-self: center;
  max-width: min(520px, 100%);
  background: transparent;
  padding: 0;
}

.message.system .system-content {
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 80%, var(--accent) 5%);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  border-color: color-mix(in srgb, var(--border) 70%, var(--accent) 12%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.12);
}

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

#messages.messages-sequential-render {
  overflow-anchor: none;
}

#messages.messages-sequential-render .message.message-sequential-enter {
  animation: messageSequentialLoad 0.24s cubic-bezier(0.2, 0.86, 0.24, 1) both !important;
  will-change: opacity, transform, filter;
}

@keyframes messageSequentialLoad {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.message.in {
  background: color-mix(in srgb, var(--bubble-in) 70%, transparent);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, white 5%);
  transform-origin: 0 100%;
}

.message.out {
  background: color-mix(in srgb, var(--bubble-out) 72%, transparent);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  color: var(--accent-text);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 16%, rgba(0, 0, 0, 0.2));
  transform-origin: 100% 100%;
}

.message .sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.message .content {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow: hidden;
}

.message .reply-preview {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel2) 74%, transparent);
  border-left: 3px solid var(--accent);
}

.message .reply-preview-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.message .reply-preview-text {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.message .forward-preview {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel2) 74%, transparent);
  border-left: 3px solid color-mix(in srgb, var(--accent) 60%, #6fa8ff 40%);
}

.message .forward-preview-label {
  font-size: 11px;
  font-weight: 700;
  color: color-mix(in srgb, var(--accent) 60%, #6fa8ff 40%);
  margin-bottom: 4px;
}

.message .forward-preview-text {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
  padding: 6px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel2) 38%, transparent);
}

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

.message-reaction-chip {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.message-reaction-chip.active {
  border-color: color-mix(in srgb, var(--accent) 68%, var(--border) 32%);
  background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%);
}

.reaction-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  width: 100%;
  padding-top: 2px;
}

.message-action-btn {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel2) 80%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.message-action-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border) 50%);
}

.message-comment-btn {
  align-self: flex-start;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border) 70%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 82%, transparent);
  color: var(--muted);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.message.out .message-comment-btn {
  align-self: flex-end;
}

.message-comment-btn:hover, .message-comment-btn:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 56%, var(--border) 44%);
  background: color-mix(in srgb, var(--accent) 22%, var(--panel2) 78%);
  color: var(--text);
}

.comment-modal-card {
  max-width: min(560px, 94vw);
  max-height: min(780px, 92vh);
  display: grid;
  grid-template-rows: auto auto minmax(120px, 1fr) auto auto;
  gap: 12px;
}

.comment-post-preview {
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border) 78%);
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel2) 90%);
  color: var(--text);
  padding: 12px 14px;
  font-weight: 900;
  line-height: 1.35;
}

.comment-thread-list {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
  align-content: start;
}

.comment-empty {
  border: 1px dashed var(--border);
  border-radius: 18px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.comment-thread-item {
  display: grid;
  gap: 5px;
  width: min(82%, 360px);
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  padding: 11px 12px;
}

.comment-thread-item.is-peer {
  justify-self: start;
  border-bottom-left-radius: 7px;
}

.comment-thread-item.is-own {
  justify-self: end;
  border-bottom-right-radius: 7px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 28%, var(--panel2) 72%), color-mix(in srgb, var(--accent) 14%, var(--panel2) 86%));
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border) 54%);
}

.comment-thread-item.is-peer.is-reply {
  margin-left: 22px;
  border-left: 3px solid var(--accent);
}

.comment-thread-item.is-own.is-reply {
  margin-right: 22px;
  border-right: 3px solid var(--accent);
}

.comment-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.comment-thread-author {
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
}

.comment-thread-item.is-own .comment-thread-author {
  color: color-mix(in srgb, var(--text) 88%, var(--accent) 12%);
}

.comment-thread-badge {
  justify-self: end;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border) 66%);
  color: var(--muted);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 950;
  white-space: nowrap;
}

.comment-thread-text {
  color: var(--text);
  line-height: 1.38;
  white-space: pre-wrap;
}

.comment-thread-item button, .comment-compose button, .comment-reply-bar button {
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border) 66%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%);
  color: var(--text);
  padding: 7px 12px;
  font-weight: 950;
  cursor: pointer;
}

.comment-thread-item button {
  justify-self: start;
  font-size: 12px;
}

.comment-thread-item.is-own button {
  justify-self: end;
}

.comment-reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel2) 86%);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
}

.comment-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.comment-compose textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.message .meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  letter-spacing: 0;
}

.message.out .meta {
  color: rgba(0, 0, 0, 0.52);
}

#messageInput {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--scp-composer-bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  box-shadow: var(--scp-chat-shadow);
  z-index: 35;
  margin: 10px 12px 12px;
  min-height: 68px;
  border: 1px solid var(--scp-composer-border);
  border-radius: 999px;
}

.typing-bar {
  min-height: 24px;
  padding: 6px 20px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  flex-shrink: 0;
  opacity: 0;
  visibility: hidden;
  transition: color 0.16s ease, opacity 0.16s ease;
}

.typing-bar.active {
  color: color-mix(in srgb, var(--accent) 72%, var(--text) 28%);
  opacity: 1;
  visibility: visible;
}

#typingBar.hidden {
  display: block !important;
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 0;
  flex-shrink: 0;
}

.reply-bar-body {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel2) 84%, transparent);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}

.edit-bar-body {
  border-left-color: color-mix(in srgb, #f3b24e 72%, var(--accent) 28%);
}

.reply-bar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.reply-bar-text {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-bar-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
}

.forward-preview-card {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel2) 84%, transparent);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 14px;
}

.forward-preview-text {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}

.forward-targets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}

.forward-target {
  width: 100%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  border-radius: 18px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  min-height: 58px;
}

.forward-target-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.forward-target-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: var(--accent-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 12px 26px color-mix(in srgb, var(--accent) 24%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.05);
  box-shadow:
    0 16px 34px color-mix(in srgb, var(--accent) 34%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.send-btn:disabled, .auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.app-status-bar {
  display: none !important;
}

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

.app-status-bar.success {
  color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(10px);
  padding: 12px;
  overflow: hidden;
}

.modal-content {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 10%, transparent), transparent 34%),
    var(--panel);
  border-radius: var(--radius-lg);
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: hidden !important;
  box-shadow: var(--shadow-popover);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.compact-footer {
  padding: 0;
  border: 0;
  justify-content: flex-start;
  margin-bottom: 16px;
}

.member-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.member-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel2);
}

.member-option input {
  width: auto;
  accent-color: var(--accent);
}

.member-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.member-option-title {
  font-size: 14px;
  font-weight: 600;
}

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

.call-modal {
  max-width: 760px;
  overflow: hidden;
}

.call-body {
  padding: 16px;
}

.call-stage {
  position: relative;
  height: 420px;
  background:
    radial-gradient(circle at 25% 20%, rgba(92, 211, 114, 0.18), transparent 34%),
    radial-gradient(circle at 78% 72%, rgba(80, 151, 255, 0.16), transparent 36%),
    #050706;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.call-stage:fullscreen, .call-stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #000;
}

.call-stage:fullscreen .call-local, .call-stage:-webkit-full-screen .call-local {
  right: 20px;
  bottom: 20px;
  width: min(28vw, 340px);
  height: min(21vw, 220px);
}

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

.call-remote-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-auto-rows: minmax(180px, 1fr);
  gap: 12px;
  padding: 12px;
  pointer-events: none;
}

.call-local {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 180px;
  height: 136px;
  border-radius: calc(var(--radius-md) + 2px);
  object-fit: cover;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.call-peer-tile, .call-peer-empty {
  position: relative;
  min-height: 180px;
  border-radius: calc(var(--radius-md) + 2px);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.call-peer-tile.speaking {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 58%, white 8%);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.32),
    0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent);
}

.call-peer-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  text-align: center;
  padding: 18px;
}

.call-peer-video, .call-peer-placeholder {
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: cover;
  display: block;
}

.call-peer-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  background:
    radial-gradient(circle at top, rgba(92, 211, 114, 0.28), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.36));
}

.call-peer-footer {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(10px);
}

.call-peer-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  z-index: 2;
}

.call-peer-badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  backdrop-filter: blur(10px);
}

.call-peer-label {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.call-peer-state {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  white-space: nowrap;
}

#remoteAudio {
  display: none;
}

.call-status {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
  z-index: 3;
}

.call-footer {
  justify-content: center;
}

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

.call-controls .action-btn, .chat-actions .action-btn {
  background: var(--panel2);
  border: 1px solid var(--border);
}

.call-controls .action-btn:hover, .chat-actions .action-btn:hover {
  background: color-mix(in srgb, var(--panel2) 84%, var(--accent) 16%);
}

.call-controls .action-btn.off {
  background: rgba(229, 57, 53, 0.14);
  border-color: rgba(229, 57, 53, 0.45);
}

.call-controls .action-btn.active {
  background: color-mix(in srgb, var(--panel2) 72%, var(--accent) 28%);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

#joinCallBtn {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel2) 78%);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

#joinCallBtn:hover {
  background: color-mix(in srgb, var(--accent) 34%, var(--panel2) 66%);
}

.call-modal.audio .call-remote, .call-modal.audio .call-local {
  display: none;
}

.call-modal.audio #remoteAudio {
  display: block;
}

.call-modal.audio .call-stage {
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 20px;
  overflow: auto !important;
  min-height: 0;
  overscroll-behavior: contain;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

#profileHome {
  flex: 1;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 28px;
  overflow: auto;
}

.profile-home-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border-radius: calc(var(--radius-lg) + 6px);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel2) 90%, #fff 6%), var(--panel));
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.profile-home-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 330px;
  z-index: -1;
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), color-mix(in srgb, var(--panel) 82%, transparent)),
    var(--profile-home-wallpaper, none);
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.24s ease;
}

.profile-home-card.has-wallpaper::before {
  opacity: 1;
}

.profile-home-top {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.profile-home-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.profile-home-avatar {
  width: 220px;
  height: 220px;
  border-radius: calc(var(--radius-lg) + 4px);
  background: #d9d9d9;
  color: #202020;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  font-weight: 700;
}

.profile-home-name {
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.profile-home-tag {
  font-size: 15px;
  color: var(--muted);
  min-height: 20px;
  text-align: center;
}

.profile-home-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-home-actions .btn-primary, .profile-home-actions .btn-secondary {
  width: 100%;
}

.news-panel {
  flex: 1;
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.news-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.news-title {
  font-size: 18px;
  font-weight: 700;
}

.news-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
  flex: 1 1 auto;
}

.news-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel2);
  padding: 12px;
}

.news-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.news-card-title {
  font-size: 14px;
  font-weight: 700;
}

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

.news-card-body {
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--text);
}

.call-log-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel2);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.call-log-title {
  font-size: 15px;
  font-weight: 700;
}

.call-log-meta, .call-log-direction {
  font-size: 12px;
  color: var(--muted);
}

.call-log-status {
  font-size: 14px;
  color: var(--text);
}

.news-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

#newsEditor {
  min-height: 140px;
  border: 1px solid var(--input-bg-focus);
  border-radius: var(--radius-md);
  background: var(--panel2);
  color: var(--text);
  padding: 12px;
  resize: vertical;
  outline: none;
}

#newsEditor:focus {
  border-color: var(--accent);
}

.news-editor-actions {
  display: flex;
  gap: 8px;
}

body.profile-home-mode #chatHeader, body.profile-home-mode #messages, body.profile-home-mode #messageInput, body.profile-home-mode #appStatusBar {
  display: none;
}

body.profile-home-mode #profileHome {
  display: flex !important;
}

body.news-home-mode #chatHeader, body.news-home-mode #messages, body.news-home-mode #messageInput, body.news-home-mode #appStatusBar, body.news-home-mode #profileHome, body.news-home-mode #callsHome {
  display: none !important;
}

body.news-home-mode #newsHome {
  display: flex !important;
}

body.calls-home-mode #chatHeader, body.calls-home-mode #messages, body.calls-home-mode #messageInput, body.calls-home-mode #appStatusBar, body.calls-home-mode #profileHome, body.calls-home-mode #newsHome {
  display: none !important;
}

body.calls-home-mode #callsHome {
  display: flex !important;
}

body.settings-home-mode #chatHeader, body.settings-home-mode #messages, body.settings-home-mode #messageInput, body.settings-home-mode #appStatusBar, body.settings-home-mode #profileHome, body.settings-home-mode #newsHome, body.settings-home-mode #callsHome {
  display: none !important;
}

body.settings-home-mode #settingsHome {
  display: block !important;
  background: var(--scp-mock-bg) !important;
  color: var(--text) !important;
  min-height: 100dvh !important;
  padding: 0 0 calc(104px + env(safe-area-inset-bottom, 0px)) !important;
}

body.profile-home-mode #layout, body.news-home-mode #layout, body.calls-home-mode #layout, body.settings-home-mode #layout {
  grid-template-columns: 70px minmax(0, 1fr);
}

body.profile-home-mode #chatList, body.news-home-mode #chatList, body.calls-home-mode #chatList, body.settings-home-mode #chatList {
  display: none !important;
}

body.profile-home-mode #chat, body.news-home-mode #chat, body.calls-home-mode #chat, body.settings-home-mode #chat {
  grid-column: 2 / -1;
  display: flex !important;
  min-width: 0;
}

body.profile-home-mode #chat::before, body.news-home-mode #chat::before, body.calls-home-mode #chat::before, body.settings-home-mode #chat::before {
  display: none !important;
}

body.profile-home-mode #pinnedBar, body.profile-home-mode #chatSearchBar, body.profile-home-mode #typingBar, body.profile-home-mode #replyBar, body.profile-home-mode #editBar, body.news-home-mode #pinnedBar, body.news-home-mode #chatSearchBar, body.news-home-mode #typingBar, body.news-home-mode #replyBar, body.news-home-mode #editBar, body.calls-home-mode #pinnedBar, body.calls-home-mode #chatSearchBar, body.calls-home-mode #typingBar, body.calls-home-mode #replyBar, body.calls-home-mode #editBar, body.settings-home-mode #pinnedBar, body.settings-home-mode #chatSearchBar, body.settings-home-mode #typingBar, body.settings-home-mode #replyBar, body.settings-home-mode #editBar {
  display: none !important;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--panel);
  border-radius: 4px;
}

@media (max-width: 768px) {
  body {
    height: 100dvh;
  }

  #layout {
    grid-template-columns: 1fr;
    height: 100dvh;
  }

  #sidebar {
    display: none;
  }

  #chat {
    display: none;
  }

  body.mobile-chat-open #chat {
    display: flex;
  }

  body.mobile-chat-open #chatList {
    display: none;
  }

  .back-btn, .profile-mobile-btn, .settings-mobile-btn {
    display: inline-flex;
  }

  #messages {
    padding: 16px;
  }

  #messageInput {
    padding: 12px;
  }

  .message {
    max-width: 84%;
  }

  .auth-box {
    padding: 28px 22px;
  }

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

  .chat-actions {
    gap: 6px;
  }

  .secure-badge span {
    display: none;
  }

  .call-stage {
    height: 320px;
  }

  .call-local {
    width: 120px;
    height: 90px;
  }

  #callScreenBtn {
    display: none !important;
  }
}

button, input, select, textarea {
  font: inherit;
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chatItem:focus-visible, .forward-target:focus-visible, .pinned-bar-main:focus-visible, .message-reaction-chip:focus-visible, .message-action-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.auth-box, .modal-content, .empty-chat, .call-panel, .call-log-card, .news-card {
  border: 1px solid var(--hairline);
}

#sidebar, #chatList, #chatHeader, #messageInput, .pinned-bar, .chat-search-bar, .reply-bar {
  backdrop-filter: blur(18px);
}

.action-btn, .send-btn, .modal-close, .reply-bar-close, .pinned-bar-clear, .message-action-btn, .message-reaction-chip, .forward-target, .list-tab, .btn-primary, .btn-secondary, .auth-btn, .auth-switch-btn {
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    opacity 0.18s ease;
}

.action-btn, .send-btn, .modal-close, .reply-bar-close, .pinned-bar-clear {
  min-width: 40px;
  min-height: 40px;
}

.chatItem::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: transparent;
  transition: background 0.18s ease, opacity 0.18s ease;
}

.chatItem.active::before {
  background: var(--accent);
}

.chatItem .avatar, .chat-user .avatar, .logo {
  box-shadow: inset 0 -10px 16px rgba(0, 0, 0, 0.08);
}

.chatItem .name, .chat-user .name {
  letter-spacing: 0.01em;
}

.chatItem.utility {
  padding-right: 18px;
  background: color-mix(in srgb, var(--panel2) 72%, var(--accent) 8%);
}

.chatItem .name > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.chat-item-badges span {
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 78%, var(--accent) 8%);
  border: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.chat-item-actions {
  display: none !important;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.18s ease, max-height 0.18s ease;
}

.chatItem:hover .chat-item-actions, .chatItem:focus-within .chat-item-actions, .chatItem.active .chat-item-actions {
  opacity: 1;
  max-height: 40px;
}

.chat-item-actions button {
  min-height: 28px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
  color: var(--text);
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.chat-item-actions button:hover, .chat-item-actions button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border) 42%);
  background: color-mix(in srgb, var(--panel2) 72%, var(--accent) 12%);
}

.pinned-bar, .chat-search-bar {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}

.pinned-bar-main, .chat-search-input, .reply-bar-body, .forward-preview-card, .message .reply-preview, .message .forward-preview {
  border-color: var(--hairline);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.pinned-bar-main:hover, .forward-target:hover, .member-option:hover {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border) 54%);
  background: color-mix(in srgb, var(--panel2) 74%, var(--accent) 8%);
}

.chat-search-input:focus, #textInput:focus {
  box-shadow: var(--focus-ring);
}

.message-action-btn, .message-reaction-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.message-action-btn:hover, .message-reaction-chip:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border) 42%);
}

#textInput {
  min-height: 50px;
  line-height: 1.35;
  position: relative;
  z-index: 1;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
}

.send-btn:hover:not(:disabled), .action-btn:hover, .modal-close:hover, .reply-bar-close:hover, .pinned-bar-clear:hover {
  transform: translateY(-1px);
}

.modal-header, .modal-footer {
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  flex: 0 0 auto;
}

.modal-close:hover {
  border-color: var(--hairline);
  background: var(--surface-strong);
}

.member-option, .forward-target, .call-log-card, .news-card {
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
  .chatItem {
    min-height: 72px;
    padding: 12px 16px;
  }

  .pinned-bar, .chat-search-bar, .reply-bar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .chat-search-bar {
    flex-wrap: wrap;
  }

  .chat-search-input {
    flex-basis: 100%;
  }

  .message {
    max-width: 88%;
  }

  .message-actions, .reaction-picker, .message-reactions {
    gap: 5px;
  }

  .message-action-btn, .message-reaction-chip {
    min-height: 34px;
  }

  .modal-content {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 0 45%, transparent 76%);
  opacity: var(--noise-opacity, 0.06);
}

#sidebar::before {
  content: "";
  position: absolute;
  inset: 12px 8px;
  border: 1px solid var(--shell-line);
  border-radius: 24px;
  pointer-events: none;
}

#sidebar .logo, .profile-home-avatar {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.72), transparent 16%),
    linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 48%, #153820 52%));
  color: #07110a;
}

.sidebar-footer .action-btn, .chat-list-actions .action-btn, .create-chat-btn {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 22px rgba(0, 0, 0, 0.18);
}

.list-search input, .form-group input, .form-group select, #textInput, .chat-search-input, #newsEditor {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.028),
    0 10px 26px rgba(0, 0, 0, 0.08);
}

.chatItem::after {
  content: "";
  position: absolute;
  inset: 8px 10px;
  z-index: -1;
  border-radius: 20px;
  background: transparent;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.chatItem:hover::after, .chatItem.active::after {
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--accent) 12%, transparent), transparent 36%),
    rgba(255, 255, 255, 0.018);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.032);
}

#chat::before {
  content: "";
  position: absolute;
  inset: 77px 0 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 26% 18%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 32%),
    radial-gradient(circle at 80% 82%, rgba(255, 255, 255, 0.032), transparent 34%);
}

#chatHeader::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 48%, transparent), transparent);
}

.message.in, .message.out {
  backdrop-filter: blur(14px);
}

.message.in::before, .message.out::before {
  content: "";
  position: absolute;
  bottom: -1px;
  width: 14px;
  height: 14px;
  background: inherit;
}

.message.in::before {
  left: -5px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.message.out::before {
  right: -5px;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.message.out .reply-preview, .message.out .forward-preview {
  background: rgba(0, 0, 0, 0.08);
  border-left-color: rgba(0, 0, 0, 0.35);
}

.message.out .reply-preview-label, .message.out .forward-preview-label {
  color: rgba(0, 0, 0, 0.64);
}

.message.out .reply-preview-text, .message.out .forward-preview-text {
  color: rgba(0, 0, 0, 0.58);
}

.pinned-bar, .chat-search-bar, .reply-bar, .typing-bar {
  position: relative;
  z-index: 2;
}

.pinned-bar-main, .reply-bar-body, .edit-bar-body, .forward-preview-card {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 58%),
    color-mix(in srgb, var(--panel2) 84%, transparent);
}

#messageInput::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 36%, transparent), transparent);
}

.input-wrapper::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-md) + 2px);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 34%, rgba(255, 255, 255, 0.045));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.input-wrapper:focus-within::before {
  opacity: 1;
}

.auth-box, .profile-home-card, .news-card, .call-panel {
  box-shadow:
    var(--shadow-popover),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.auth-header h1, .profile-home-name, .news-title {
  letter-spacing: -0.045em;
}

.btn-primary, .auth-btn, .create-chat-btn {
  box-shadow:
    0 12px 28px color-mix(in srgb, var(--accent) 24%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.btn-primary:hover, .auth-btn:hover, .create-chat-btn:hover {
  box-shadow:
    0 16px 36px color-mix(in srgb, var(--accent) 32%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

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

#sidebar, #chatList, #chat {
  animation: shellReveal 0.28s ease both;
  animation-duration: var(--motion-shell, 0.299s);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.profile-home-back.hidden {
  display: inline-flex !important;
}

.profile-open-trigger {
  cursor: pointer;
}

.profile-open-trigger:hover {
  color: var(--accent);
}

.tg-profile-modal {
  width: min(430px, 96vw);
  max-height: min(860px, 92vh);
  overflow: hidden;
  padding: 0;
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 34%),
    color-mix(in srgb, var(--panel) 92%, #000 8%);
}

.profile-editor-modal {
  width: min(460px, 96vw);
  display: flex;
  flex-direction: column;
}

.profile-editor-modal .modal-header, .profile-editor-modal .modal-footer {
  flex: 0 0 auto;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--panel) 92%, #000 8%);
  border-color: color-mix(in srgb, var(--accent) 16%, var(--hairline) 84%);
}

.profile-editor-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
  overflow: auto;
}

.profile-editor-preview {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--hairline) 82%);
  border-radius: 28px;
  background:
    radial-gradient(circle at 48% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 34%),
    color-mix(in srgb, var(--panel2) 86%, #000 14%);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.28);
}

.profile-editor-cover {
  min-height: 218px;
}

.profile-editor-preview-body {
  padding: 14px;
  overflow: visible;
}

.profile-editor-share {
  margin-top: 2px;
}

.profile-editor-empty-music {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.profile-editor-empty-music:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border) 60%);
  background: color-mix(in srgb, var(--accent) 12%, rgba(255, 255, 255, 0.04));
}

.profile-editor-preview-focused {
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.24),
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.profile-single-field-editor .profile-editor-preview {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--hairline) 66%);
}

.profile-single-field-editor #profileEditorPreviewCover, .profile-single-field-editor .profile-editor-preview-body, .profile-single-field-editor #profileEditorPreviewMusic, .profile-single-field-editor #profileEditorPreviewInfo, .profile-single-field-editor .profile-editor-share {
  display: none !important;
}

.profile-single-field-editor[data-editing-field="nickname"] #profileEditorPreviewCover, .profile-single-field-editor[data-editing-field="tag"] #profileEditorPreviewCover, .profile-single-field-editor[data-editing-field="wallpaperUrl"] #profileEditorPreviewCover {
  display: grid !important;
}

.profile-single-field-editor[data-editing-field="nickname"] #profileEditorPreviewCover, .profile-single-field-editor[data-editing-field="tag"] #profileEditorPreviewCover {
  min-height: 128px;
  align-content: center;
  padding: 28px 18px;
}

.profile-single-field-editor[data-editing-field="wallpaperUrl"] #profileEditorPreviewCover {
  min-height: 196px;
}

.profile-single-field-editor[data-editing-field="nickname"] #profileEditorPreviewAvatar, .profile-single-field-editor[data-editing-field="nickname"] #profileEditorPreviewUsername, .profile-single-field-editor[data-editing-field="tag"] #profileEditorPreviewAvatar, .profile-single-field-editor[data-editing-field="tag"] #profileEditorPreviewName, .profile-single-field-editor[data-editing-field="wallpaperUrl"] #profileEditorPreviewAvatar, .profile-single-field-editor[data-editing-field="wallpaperUrl"] #profileEditorPreviewName, .profile-single-field-editor[data-editing-field="wallpaperUrl"] #profileEditorPreviewUsername {
  display: none !important;
}

.profile-single-field-editor[data-editing-field="musicUrl"] .profile-editor-preview-body, .profile-single-field-editor[data-editing-field="bio"] .profile-editor-preview-body, .profile-single-field-editor[data-editing-field="personalChannel"] .profile-editor-preview-body, .profile-single-field-editor[data-editing-field="birthDate"] .profile-editor-preview-body, .profile-single-field-editor[data-editing-field="emojiStatus"] .profile-editor-preview-body {
  display: grid !important;
}

.profile-single-field-editor[data-editing-field="musicUrl"] #profileEditorPreviewMusic, .profile-single-field-editor[data-editing-field="bio"] #profileEditorPreviewInfo, .profile-single-field-editor[data-editing-field="personalChannel"] #profileEditorPreviewInfo, .profile-single-field-editor[data-editing-field="birthDate"] #profileEditorPreviewInfo, .profile-single-field-editor[data-editing-field="emojiStatus"] #profileEditorPreviewInfo {
  display: grid !important;
}

.profile-single-field-editor #profileEditorPreviewInfo .tg-profile-info-item {
  display: none !important;
}

.profile-single-field-editor[data-editing-field="bio"] #profileEditorPreviewInfo .tg-profile-info-item[data-profile-field="bio"], .profile-single-field-editor[data-editing-field="personalChannel"] #profileEditorPreviewInfo .tg-profile-info-item[data-profile-field="personalChannel"], .profile-single-field-editor[data-editing-field="birthDate"] #profileEditorPreviewInfo .tg-profile-info-item[data-profile-field="birthDate"], .profile-single-field-editor[data-editing-field="emojiStatus"] #profileEditorPreviewInfo .tg-profile-info-item[data-profile-field="emojiStatus"] {
  display: grid !important;
}

.profile-editor-modal .form-group {
  margin: 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--hairline) 86%);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.tg-profile-cover {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 218px;
  padding: 42px 18px 30px;
  overflow: hidden;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 14%, var(--hairline) 86%);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 20%, transparent), transparent 46%),
    radial-gradient(circle at 28% 14%, rgba(255, 255, 255, 0.08), transparent 26%);
}

.tg-profile-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.46)),
    var(--profile-wallpaper, none);
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.tg-profile-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 32%, rgba(0, 0, 0, 0.08), transparent 32%),
    linear-gradient(180deg, transparent 34%, rgba(0, 0, 0, 0.36));
  opacity: 0;
}

.tg-profile-cover.has-wallpaper::before {
  opacity: 1;
  transform: scale(1);
}

.tg-profile-cover.has-wallpaper::after {
  opacity: 1;
}

.tg-profile-cover > * {
  position: relative;
  z-index: 1;
}

.tg-profile-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}

.tg-profile-avatar {
  width: 96px;
  height: 96px;
  font-size: 28px;
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.32),
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.tg-profile-name {
  color: var(--text);
  font-size: 19px;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.tg-profile-username {
  color: color-mix(in srgb, var(--accent) 80%, #fff 20%);
  font-size: 13px;
  font-weight: 800;
}

.tg-profile-cover.has-wallpaper .tg-profile-name, .tg-profile-cover.has-wallpaper .tg-profile-username {
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.72);
}

.tg-profile-cover.has-wallpaper .tg-profile-username {
  color: color-mix(in srgb, var(--accent) 34%, #fff 66%);
}

.tg-profile-cover.has-wallpaper .tg-profile-avatar {
  box-shadow:
    0 20px 46px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.18);
}

.tg-profile-body {
  display: grid;
  gap: 12px;
  padding: 14px;
  overflow: auto;
}

.tg-profile-music-card, .tg-profile-channel, .tg-profile-share, .tg-profile-info-item, .tg-profile-home-details {
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--hairline) 86%);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.tg-profile-music-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 20px;
}

.tg-profile-music-card.playing {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 calc(var(--glow-strength, 22px) * 0.7) color-mix(in srgb, var(--accent) 22%, transparent);
}

.tg-profile-music-card .player-progress {
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--accent) 92%, #fff 8%) 0 var(--player-progress, 0%),
      color-mix(in srgb, var(--text) 14%, transparent) var(--player-progress, 0%) 100%);
  -webkit-appearance: none;
  appearance: none;
}

.tg-profile-music-card .player-progress::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  -webkit-appearance: none;
  appearance: none;
}

.tg-profile-music-card .player-progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
}

.tg-profile-channel {
  padding: 12px 14px;
  border-radius: 18px;
}

.tg-profile-channel a, .tg-profile-link-box a {
  color: color-mix(in srgb, var(--accent) 88%, #fff 12%);
  font-weight: 900;
  text-decoration: none;
  overflow-wrap: anywhere;
}

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

.tg-profile-info-item {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 18px;
}

.tg-profile-info-item.privacy-note {
  min-height: 96px;
  align-content: center;
  border-color: color-mix(in srgb, var(--accent) 28%, var(--hairline) 72%);
  background:
    radial-gradient(circle at 12% 16%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 34%),
    rgba(255, 255, 255, 0.045);
}

.profile-hidden-view .tg-profile-cover {
  min-height: 246px;
}

.profile-hidden-view .tg-profile-avatar {
  filter: saturate(0.78);
}

.tg-profile-info-item.accent .tg-profile-info-value {
  color: color-mix(in srgb, var(--accent) 82%, #fff 18%);
}

.tg-profile-info-value {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.tg-profile-label, .tg-profile-info-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tg-profile-share {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
}

.tg-profile-share.hidden, .tg-profile-channel.hidden, .tg-profile-music.hidden {
  display: none !important;
}

.tg-profile-qr {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 2px;
  width: 118px;
  height: 118px;
  padding: 9px;
  border-radius: 18px;
  background: #f7f5ef;
}

.tg-profile-qr span {
  border-radius: 2px;
}

.tg-profile-qr img {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: contain;
}

.tg-profile-qr span.filled {
  background: #151515;
}

.tg-profile-link-box {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.tg-profile-home-details {
  width: min(560px, 100%);
  display: grid;
  gap: 8px;
  margin: 18px auto 0;
  padding: 12px;
  border-radius: 24px;
}

.tg-profile-home-music {
  width: min(560px, 100%);
  margin: 18px auto 0;
}

.tg-profile-home-music.hidden {
  display: none !important;
}

.tg-profile-home-music .tg-profile-music-card {
  width: 100%;
}

.tg-profile-home-row {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 12px;
  align-items: start;
  padding: 9px 10px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.028);
}

.tg-profile-home-row[data-profile-field] {
  cursor: context-menu;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
  border: 1px solid transparent;
}

.tg-profile-home-row[data-profile-field]:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--accent) 10%, rgba(255, 255, 255, 0.035));
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

.tg-profile-info-item[data-profile-field] {
  cursor: pointer;
}

.tg-profile-info-item[data-profile-field]:hover {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border) 66%);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel2) 90%);
}

.profile-single-field-editor .form-group.hidden, #profileHomeApplyThemeBtn.hidden {
  display: none !important;
}

.own-profile-card {
  max-width: 520px;
}

.tg-profile-home-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tg-profile-home-row strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.tg-profile-preview-btn {
  justify-self: center;
  margin-top: 4px;
}

.avatar.has-avatar, .logo.has-avatar, .profile-home-avatar.has-avatar {
  background-size: cover !important;
  background-position: center !important;
  color: transparent !important;
  text-shadow: none !important;
}

.profile-home-card.own-profile-card {
  width: min(460px, calc(100vw - 24px));
  padding: 0 0 16px;
  gap: 0;
}

.profile-home-card.own-profile-card::before {
  height: 258px;
  opacity: 1;
  background-image:
    radial-gradient(circle at 50% 18%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--panel2) 76%, transparent), color-mix(in srgb, var(--panel) 92%, transparent)),
    var(--profile-home-wallpaper, none);
  background-size: auto, auto, cover;
  background-position: center;
}

.profile-home-card.own-profile-card:not(.has-wallpaper)::before {
  background-image:
    radial-gradient(circle at 50% 18%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--panel2) 88%, transparent), color-mix(in srgb, var(--panel) 96%, transparent));
}

.profile-home-card.own-profile-card .profile-home-top {
  align-self: stretch;
  padding: 12px 12px 0;
}

.profile-home-card.own-profile-card .profile-home-avatar {
  width: clamp(104px, 22vw, 136px);
  height: clamp(104px, 22vw, 136px);
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  margin-top: 14px;
  border-radius: 31%;
  background-size: cover !important;
  background-position: center !important;
  box-shadow:
    0 22px 50px rgba(0, 0, 0, 0.38),
    0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}

.profile-home-card.own-profile-card .profile-home-name {
  max-width: calc(100% - 32px);
  margin-top: 14px;
  overflow-wrap: anywhere;
}

.profile-home-card.own-profile-card .profile-home-tag {
  max-width: calc(100% - 32px);
  overflow-wrap: anywhere;
}

.profile-home-card.own-profile-card .tg-profile-home-music, .profile-home-card.own-profile-card .tg-profile-home-details, .profile-home-card.own-profile-card .profile-home-actions {
  width: calc(100% - 28px);
}

.avatar-drop-target {
  cursor: pointer;
  position: relative;
}

.avatar-drop-target::after {
  content: "Drop";
  position: absolute;
  inset: auto 4px 4px 4px;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.avatar-drop-target:hover::after, .avatar-drop-target.drag-over::after {
  opacity: 1;
  transform: translateY(0);
}

.avatar-drop-target.drag-over {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent),
    0 0 var(--glow-strength, 22px) color-mix(in srgb, var(--accent) 34%, transparent) !important;
}

.avatar-crop-modal {
  width: min(460px, calc(100vw - 24px));
}

.avatar-crop-frame {
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25% 50%, rgba(255, 255, 255, 0.035) 50% 75%, transparent 75%),
    var(--panel2);
  background-size: 24px 24px;
}

#avatarCropCanvas {
  width: min(320px, 74vw);
  aspect-ratio: 1 / 1;
  border-radius: 32px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.avatar-crop-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  justify-content: flex-end;
}

.chat-context-menu {
  min-width: 210px;
}

.chat-archive-quick {
  position: absolute;
  right: 14px;
  top: 50%;
  min-width: 62px;
  min-height: 32px;
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--hairline) 78%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 88%, transparent);
  color: color-mix(in srgb, var(--text) 88%, var(--accent) 12%);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transform: translate(12px, -50%) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.chatItem:hover .chat-archive-quick, .chatItem:focus-within .chat-archive-quick, .chatItem.archived .chat-archive-quick {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, -50%) scale(1);
}

.chatItem:hover .chat-unread-badge, .chatItem:focus-within .chat-unread-badge {
  opacity: 0;
  transform: translate(-12px, -50%) scale(0.9);
}

.chat-archive-quick:hover, .chat-archive-quick:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border) 38%);
  background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%);
  box-shadow: var(--focus-ring);
}

.chatItem.archived {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 55%),
    transparent;
}

.chatItem.archived .chat-archive-quick {
  color: var(--accent);
}

.recording-indicator {
  position: fixed;
  right: 18px;
  bottom: 82px;
  z-index: 2800;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 52%, var(--hairline) 48%);
  border-radius: 999px;
  background:
    radial-gradient(circle at left, rgba(229, 57, 53, 0.18), transparent 60%),
    color-mix(in srgb, var(--panel2) 88%, transparent);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(var(--glass-blur, 18px));
  animation: menuIslandIn var(--motion-fast, 0.22s) ease both;
}

.recording-indicator span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: recordingDot 0.9s ease-in-out infinite;
}

.recording-indicator strong {
  font-size: 13px;
}

@keyframes recordingDot {
  0%,
  100% {
    transform: scale(0.82);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.22);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .recording-indicator {
    left: 14px;
    right: 14px;
    bottom: 74px;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  body::after, #sidebar::before, .message.in::before, .message.out::before {
    display: none;
  }

  #chatHeader::after, #messageInput::before {
    left: 14px;
    right: 14px;
  }

  .chat-item-badges {
    display: none;
  }

  .chat-item-actions {
    opacity: 1;
    max-height: 48px;
  }

  #messages {
    background-size: 34px 34px, auto;
  }
}

.theme-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.theme-presets button {
  min-height: 74px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0 !important;
  cursor: pointer;
  text-align: left;
  padding: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 26px rgba(0, 0, 0, 0.14);
}

.theme-presets button[data-theme-preset="forest"] {
  background:
    radial-gradient(circle at 22% 14%, rgba(255, 255, 255, 0.35), transparent 16%),
    linear-gradient(145deg, #5cd372, #142317);
}

.theme-presets button[data-theme-preset="neon"] {
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.38), transparent 16%),
    linear-gradient(145deg, #4df0ff, #15142a 58%, #0b0d18);
}

.theme-presets button[data-theme-preset="ocean"] {
  background:
    radial-gradient(circle at 22% 16%, rgba(255, 255, 255, 0.36), transparent 18%),
    linear-gradient(145deg, #6fb6ff, #102638 64%, #071018);
}

.theme-presets button[data-theme-preset="sand"] {
  background:
    radial-gradient(circle at 24% 16%, rgba(255, 255, 255, 0.32), transparent 18%),
    linear-gradient(145deg, #f0b35f, #312111 62%, #120d08);
}

.theme-presets button[data-theme-preset="negative"] {
  color: #fff;
  background:
    radial-gradient(circle at 22% 15%, rgba(255, 255, 255, 0.75), transparent 16%),
    radial-gradient(circle at 78% 72%, rgba(255, 47, 69, 0.58), transparent 22%),
    linear-gradient(145deg, #ff2f45 0%, #0a0a0a 42%, #000 72%, #f7f7f7 160%);
}

.theme-presets button:hover, .theme-presets button:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    var(--focus-ring),
    0 18px 40px rgba(0, 0, 0, 0.22);
}

.theme-preview-card {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  min-height: 190px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 36%),
    color-mix(in srgb, var(--panel2) 82%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 44px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.theme-preview-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
}

.theme-preview-sidebar span {
  display: block;
  height: 34px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 25%, transparent), transparent),
    color-mix(in srgb, var(--panel2) 84%, transparent);
}

.theme-preview-chat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 20px;
  background: var(--chat-bg);
  overflow: hidden;
}

.theme-preview-chat::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18px 18px, rgba(255, 255, 255, 0.035) 1px, transparent 1.5px);
  background-size: 28px 28px;
  pointer-events: none;
}

.theme-preview-top, .theme-preview-input, .theme-preview-bubble {
  position: relative;
  z-index: 1;
}

.theme-preview-top {
  height: 28px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}

.theme-preview-bubble {
  width: fit-content;
  max-width: 78%;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 700;
}

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

.theme-preview-bubble.out {
  align-self: flex-end;
  background: var(--bubble-out);
  color: var(--accent-text);
}

.theme-preview-input {
  margin-top: auto;
  height: 32px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel2) 88%, transparent);
  border: 1px solid var(--hairline);
}

.form-group input[type="color"] {
  min-height: 44px;
  padding: 4px;
  cursor: pointer;
}

.form-group input[type="range"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.form-group select {
  min-height: 44px;
  cursor: pointer;
}

body[data-density="compact"] #layout {
  grid-template-columns: 64px 360px 1fr;
}

body[data-density="compact"] .chatItem {
  min-height: 62px;
  padding-top: 9px;
  padding-bottom: 9px;
}

body[data-density="compact"] #messages {
  gap: 5px;
  padding: 14px 18px;
}

body[data-density="compact"] .message {
  padding: 8px 12px;
}

body[data-density="compact"] #messageInput {
  padding-top: 9px;
  padding-bottom: 9px;
}

body[data-density="spacious"] #layout {
  grid-template-columns: 78px 460px 1fr;
}

body[data-density="spacious"] .chatItem {
  min-height: 88px;
  padding-top: 17px;
  padding-bottom: 17px;
}

body[data-density="spacious"] #messages {
  gap: 13px;
  padding: 26px;
}

body[data-density="spacious"] .message {
  padding: 13px 17px;
}

body[data-bubbles="soft"] .message {
  border-radius: 26px;
}

body[data-bubbles="soft"] .message.in, body[data-bubbles="soft"] .message.out {
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
}

body[data-bubbles="soft"] .message.in::before, body[data-bubbles="soft"] .message.out::before {
  display: none;
}

body[data-bubbles="block"] .message {
  border-radius: 12px;
}

body[data-bubbles="block"] .message.in, body[data-bubbles="block"] .message.out {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

body[data-bubbles="block"] .message.in::before, body[data-bubbles="block"] .message.out::before {
  display: none;
}

body[data-pattern="grid"] #messages {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: var(--pattern-scale, 36px) var(--pattern-scale, 36px);
}

body[data-pattern="waves"] #messages {
  background-image:
    radial-gradient(ellipse at 20% 12%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 28%),
    repeating-radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.026) 0 1px, transparent 1px 18px);
  background-size: auto, calc(var(--pattern-scale, 58px) * 1.25) calc(var(--pattern-scale, 58px) * 1.25);
}

body[data-pattern="none"] #messages {
  background-image: none;
}

#sidebar, #chatList, #chatHeader, #messageInput, .pinned-bar, .chat-search-bar, .reply-bar, .modal-content, .call-peer-footer, .call-peer-badge {
  backdrop-filter: blur(var(--glass-blur, 18px));
}

@media (max-width: 768px) {
  .voice-transcript-popout {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .chat-archive-quick {
    display: none !important;
  }

  .tg-profile-modal {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .tg-profile-share, .tg-profile-home-row {
    grid-template-columns: 1fr;
  }

  .privacy-choice-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .privacy-choice-row .tg-settings-row-value {
    grid-column: 2;
    justify-self: start;
  }

  .tg-profile-qr {
    justify-self: center;
  }

  .theme-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-density="compact"] #layout, body[data-density="spacious"] #layout {
    grid-template-columns: 1fr;
  }

  body.profile-home-mode #layout, body.news-home-mode #layout, body.calls-home-mode #layout, body.settings-home-mode #layout {
    grid-template-columns: 1fr !important;
  }

  body.profile-home-mode #chat, body.news-home-mode #chat, body.calls-home-mode #chat, body.settings-home-mode #chat {
    grid-column: 1 / -1;
    display: flex !important;
    width: 100%;
  }

  body.profile-home-mode #chatList, body.news-home-mode #chatList, body.calls-home-mode #chatList, body.settings-home-mode #chatList {
    display: none !important;
  }

  body[data-density="spacious"] #messages {
    padding: 18px;
  }

  .news-panel {
    padding: 14px;
    min-width: 0;
  }

  .news-title-row {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }

  .news-title {
    min-width: 0;
    text-align: center;
  }

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

  .news-card, .call-log-card {
    width: 100%;
    min-width: 0;
  }
}

#settingsModal .modal-content {
  width: min(760px, calc(100vw - 24px));
  max-height: min(860px, calc(100dvh - 24px));
}

#settingsModal .modal-body {
  max-height: calc(100dvh - 164px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  padding-bottom: 26px;
}

body.settings-home-mode #settingsHome #settingsModal {
  position: static;
  inset: auto;
  flex: 1 1 auto;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  overflow: hidden;
  z-index: auto;
  display: block !important;
}

body.settings-home-mode #settingsHome #settingsModal.hidden {
  display: none !important;
}

body.settings-home-mode #settingsModal .modal-content {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.settings-home-mode #settingsModal .modal-header {
  position: sticky;
  top: 0;
  z-index: 14;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(var(--glass-blur, 18px));
}

body.settings-home-mode #settingsModal .modal-body {
  flex: 1 1 auto;
  max-height: none;
  padding: 18px;
}

body.settings-home-mode #settingsModal .modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 14;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(var(--glass-blur, 18px));
}

body.settings-home-mode #settingsModal .tg-settings-shell {
  min-height: 0;
}

.settings-scroll-nav {
  position: sticky;
  top: -1px;
  z-index: 10;
  display: flex;
  gap: 8px;
  margin: -2px -2px 16px;
  padding: 10px 2px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  background:
    linear-gradient(180deg, var(--panel) 0%, color-mix(in srgb, var(--panel) 84%, transparent) 78%, transparent);
  backdrop-filter: blur(var(--glass-blur, 18px));
  scroll-snap-type: x proximity;
}

.settings-scroll-nav::-webkit-scrollbar {
  display: none;
}

.settings-scroll-nav button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 84%, transparent);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  scroll-snap-align: start;
}

.settings-scroll-nav button:hover, .settings-scroll-nav button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 56%, var(--border) 44%);
  background: color-mix(in srgb, var(--accent) 16%, var(--panel2) 84%);
  box-shadow: var(--focus-ring);
}

.tg-settings-modal .modal-content {
  width: min(980px, calc(100vw - 24px));
}

.tg-settings-modal .modal-header {
  padding: 18px 20px;
}

.tg-settings-modal .modal-header h2 {
  font-size: 21px;
  letter-spacing: -0.03em;
}

.tg-settings-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  min-height: min(660px, calc(100dvh - 190px));
  flex: 1 1 auto;
  width: 100%;
  overflow: hidden;
}

.tg-settings-nav.settings-scroll-nav {
  position: sticky;
  top: 0;
  display: grid;
  align-self: start;
  gap: 4px;
  margin: 0;
  padding: 8px;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--hairline) 90%);
  border-radius: 24px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel2) 92%, transparent), color-mix(in srgb, var(--panel) 88%, transparent)),
    rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(var(--glass-blur, 18px));
  scroll-snap-type: none;
  max-height: calc(100dvh - 190px);
  overflow-y: auto;
}

.tg-settings-nav button {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: color-mix(in srgb, var(--text) 92%, transparent);
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tg-settings-nav button:hover, .tg-settings-nav button:focus-visible, .tg-settings-nav button.active {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent) 7%, transparent));
  color: var(--text);
  box-shadow: none;
}

.tg-settings-nav button.active {
  color: color-mix(in srgb, var(--accent) 76%, #fff 24%);
}

.tg-settings-nav button em {
  color: color-mix(in srgb, var(--accent) 80%, #fff 20%);
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.tg-settings-nav-icon {
  width: 24px;
  height: 24px;
  position: relative;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  opacity: 0.92;
}

.tg-settings-nav-icon::before, .tg-settings-nav-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
  border-color: currentColor;
}

.tg-settings-nav-icon.bell::before {
  width: 15px;
  height: 17px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 5px 5px;
  top: 3px;
}

.tg-settings-nav-icon.bell::after {
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  bottom: 3px;
}

.tg-settings-nav-icon.lock::before {
  width: 17px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 4px;
  bottom: 3px;
}

.tg-settings-nav-icon.lock::after {
  width: 11px;
  height: 10px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  top: 2px;
}

.tg-settings-nav-icon.chat::before {
  width: 18px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 9px;
}

.tg-settings-nav-icon.chat::after {
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-18deg);
  left: 5px;
  bottom: 3px;
}

.tg-settings-nav-icon.folder::before {
  width: 19px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 3px;
  bottom: 4px;
}

.tg-settings-nav-icon.folder::after {
  width: 9px;
  height: 4px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-radius: 3px 0 0 0;
  top: 5px;
  left: 3px;
}

.tg-settings-nav-icon.sliders::before {
  width: 20px;
  height: 15px;
  background:
    linear-gradient(currentColor 0 0) 0 2px / 20px 2px no-repeat,
    linear-gradient(currentColor 0 0) 0 7px / 20px 2px no-repeat,
    linear-gradient(currentColor 0 0) 0 12px / 20px 2px no-repeat;
}

.tg-settings-nav-icon.sliders::after {
  width: 4px;
  height: 17px;
  background:
    radial-gradient(circle at 50% 2px, currentColor 0 2px, transparent 2.5px),
    radial-gradient(circle at 50% 8px, currentColor 0 2px, transparent 2.5px),
    radial-gradient(circle at 50% 14px, currentColor 0 2px, transparent 2.5px);
}

.tg-settings-nav-icon.speaker::before {
  width: 16px;
  height: 16px;
  border-left: 7px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  left: 2px;
}

.tg-settings-nav-icon.speaker::after {
  width: 9px;
  height: 14px;
  border: 2px solid currentColor;
  border-left: 0;
  border-radius: 0 12px 12px 0;
  right: 1px;
}

.tg-settings-nav-icon.battery::before {
  width: 19px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.tg-settings-nav-icon.battery::after {
  width: 4px;
  height: 7px;
  right: 0;
  border-radius: 0 2px 2px 0;
  background: currentColor;
}

.tg-settings-nav-icon.language::before {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.tg-settings-nav-icon.language::after {
  width: 20px;
  height: 2px;
  background: currentColor;
  transform: rotate(-28deg);
}

.tg-settings-panels {
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.tg-settings-panel {
  display: none;
  animation: settingsPanelIn var(--motion-fast, 0.24s) ease both;
}

.tg-settings-panel.active {
  display: grid;
  gap: 14px;
}

.tg-settings-panel-head {
  display: grid;
  gap: 5px;
  padding: 2px 2px 6px;
}

.tg-settings-kicker {
  color: color-mix(in srgb, var(--accent) 80%, #fff 20%);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tg-settings-panel-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.tg-settings-panel-head p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.tg-settings-group {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 11%, var(--hairline) 89%);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.tg-settings-group-title {
  display: grid;
  gap: 3px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 72%, transparent);
}

.tg-settings-group-title strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
}

.tg-settings-group-title span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.tg-settings-group .theme-presets {
  padding: 12px;
}

.tg-settings-group .theme-preview-card {
  margin: 12px;
}

.tg-setting-control.form-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 8px 16px;
  align-items: center;
  margin: 0;
  padding: 13px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 64%, transparent);
}

.tg-setting-control.form-group:last-child, .tg-settings-row:last-child {
  border-bottom: 0;
}

.tg-setting-control label {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.tg-setting-hint {
  grid-column: 1 / 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.tg-setting-control input, .tg-setting-control select {
  grid-column: 2 / 3;
  grid-row: 1 / span 2;
  width: 100%;
  min-height: 40px;
}

.tg-settings-row {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 64%, transparent);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.tg-settings-row:hover, .tg-settings-row:focus-visible {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.privacy-choice-row {
  grid-template-columns: 34px minmax(0, 1fr) minmax(74px, auto);
  min-height: 70px;
  transition: background 0.18s ease, transform 0.18s ease;
}

.privacy-choice-row:hover, .privacy-choice-row:focus-visible {
  transform: translateY(-1px);
}

.privacy-choice-row .tg-settings-row-icon {
  border-radius: 50%;
  position: relative;
}

.privacy-choice-row .tg-settings-row-icon::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  background: color-mix(in srgb, var(--accent) 72%, transparent);
  transform: scale(0.6);
  opacity: 0.78;
}

.privacy-choice-row .tg-settings-row-value {
  min-width: 74px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--hairline) 80%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 70%, transparent);
  text-align: center;
}

.tg-settings-row-icon {
  width: 22px;
  height: 22px;
  border: 2px solid color-mix(in srgb, var(--accent) 58%, var(--text) 42%);
  border-radius: 8px;
  opacity: 0.82;
}

.tg-settings-row.enabled .tg-settings-row-icon {
  background: color-mix(in srgb, var(--accent) 80%, transparent);
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--panel2) 90%, transparent);
}

.tg-settings-row.touched {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.theme-wallpaper-tools {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.theme-wallpaper-preview {
  min-height: 120px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--hairline) 82%);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 34%),
    color-mix(in srgb, var(--panel) 88%, #000 12%);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.theme-wallpaper-tools.has-wallpaper .theme-wallpaper-preview {
  min-height: 150px;
}

.theme-wallpaper-actions, .theme-wallpaper-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-wallpaper-actions button, .theme-wallpaper-examples button {
  min-height: 38px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--hairline) 82%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
  color: var(--text);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.theme-wallpaper-actions button:hover, .theme-wallpaper-examples button:hover, .theme-wallpaper-actions button:focus-visible, .theme-wallpaper-examples button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border) 38%);
  background: color-mix(in srgb, var(--accent) 14%, var(--panel2) 86%);
}

.theme-wallpaper-examples button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-wallpaper-examples span {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--panel2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.theme-wallpaper-examples [data-wallpaper-example="aurora"] span {
  background: radial-gradient(circle at 30% 20%, #5cd372, #2c355f 52%, #101511);
}

.theme-wallpaper-examples [data-wallpaper-example="sand"] span {
  background: radial-gradient(circle at 30% 20%, #f0b35f, #4a321d 54%, #16120d);
}

.theme-wallpaper-examples [data-wallpaper-example="mono"] span {
  background: radial-gradient(circle at 30% 20%, #9aa4b2, #2a2d33 54%, #0f1012);
}

.translation-tools {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border) 82%);
  border-radius: 18px;
  background:
    radial-gradient(circle at 10% 0, color-mix(in srgb, var(--accent) 10%, transparent), transparent 42%),
    color-mix(in srgb, var(--panel2) 78%, transparent);
}

.translation-tools-head {
  display: grid;
  gap: 4px;
}

.translation-tools-head strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
}

.translation-tools-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.translation-tools-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.translation-tools-actions button {
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border) 76%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 84%, var(--accent) 16%);
  color: var(--text);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.translation-tools-actions button:hover, .translation-tools-actions button:focus-visible {
  background: color-mix(in srgb, var(--accent) 24%, var(--panel) 76%);
}

.translation-editor {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel2) 88%, #000 12%);
  color: var(--text);
  padding: 12px;
  font-family: "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  outline: none;
}

.translation-editor:focus {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border) 54%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.language-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.language-switch button, .admin-badges-panel button {
  min-height: 38px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border) 78%);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.language-switch button.active {
  background: color-mix(in srgb, var(--accent) 26%, var(--panel2) 74%);
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
}

.language-choice-row .tg-settings-row-icon {
  border-radius: 999px;
}

.language-choice-row.enabled .tg-settings-row-icon::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: inherit;
  background: var(--accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 65%, transparent);
}

.language-choice-row:not(.enabled) .tg-settings-row-value {
  color: var(--muted);
}

.admin-badges-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border) 84%);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel2) 76%, transparent);
}

.admin-badges-panel select, .emoji-status-tools input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel2);
  color: var(--text);
  padding: 10px 12px;
}

.admin-badges-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

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

.chat-manage-advanced {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.chat-manage-advanced textarea {
  min-height: 76px;
  resize: vertical;
}

.chat-manage-grid {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border) 84%);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
}

.chat-manage-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

#manageLinkedChannelSelect, #manageChatDescriptionInput {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel2);
  color: var(--text);
  padding: 10px 12px;
}

.emoji-status-tools {
  display: grid;
  gap: 7px;
}

.emoji-status-tools label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.emoji-status-tools div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.emoji-status-tools input[readonly] {
  cursor: default;
}

.emoji-status-tools button {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel2);
  color: var(--text);
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
}

.emoji-status-tools .emoji-status-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 8px;
}

.emoji-status-picker button {
  aspect-ratio: 1;
  padding: 0;
  border-radius: 14px;
  font-size: 20px;
  display: grid;
  place-items: center;
}

.emoji-status-picker button.active {
  border-color: color-mix(in srgb, var(--accent) 64%, var(--border) 36%);
  background: color-mix(in srgb, var(--accent) 24%, var(--panel2) 76%);
  transform: translateY(-1px);
}

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

.verification-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.verification-line button {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%);
  color: var(--text);
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
}

.profile-verification-tools small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-verification-tools small.success {
  color: color-mix(in srgb, #6dff95 78%, var(--text) 22%);
}

.profile-verification-tools small.error {
  color: color-mix(in srgb, #ff6b6b 82%, var(--text) 18%);
}

.firebase-recaptcha-container {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 2000;
}

.sticker-panel {
  position: absolute;
  left: auto;
  right: 18px;
  bottom: 76px;
  z-index: 30;
  width: min(380px, calc(100vw - 36px));
  max-height: min(440px, 58vh);
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border) 78%);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
  overflow: auto;
  transform-origin: right bottom;
  animation: stickerPanelIn var(--motion-fast, 0.24s) ease both;
}

.attachment-panel {
  position: absolute;
  left: 18px;
  right: auto;
  bottom: 76px;
  z-index: 31;
  width: min(320px, calc(100vw - 36px));
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border) 78%);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
  transform-origin: left bottom;
  animation: stickerPanelIn var(--motion-fast, 0.24s) ease both;
}

.pending-attachment-tray {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 76px;
  z-index: 32;
  display: grid;
  gap: 10px;
  max-height: min(360px, 48vh);
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.pending-attachment-head, .pending-attachment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pending-attachment-head strong {
  font-weight: 950;
}

.pending-attachment-head span {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 950;
}

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

.pending-attachment-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border) 86%);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel2) 80%, transparent);
}

.pending-attachment-icon {
  width: 40px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel) 82%);
  color: var(--text);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.pending-attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.pending-attachment-size {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pending-attachment-item button, .pending-attachment-actions button {
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border) 76%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 82%, transparent);
  color: var(--text);
  padding: 0 12px;
  font-weight: 950;
  cursor: pointer;
}

.pending-attachment-actions button:last-child {
  background: var(--accent);
  color: var(--accent-text);
}

body.chat-file-drag-over::after {
  content: "Отпустите файл, чтобы прикрепить";
  position: fixed;
  inset: 12px;
  z-index: 2200;
  display: grid;
  place-items: center;
  border: 2px dashed color-mix(in srgb, var(--accent) 76%, #fff 24%);
  border-radius: 28px;
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  font-size: clamp(18px, 4vw, 28px);
  font-weight: 950;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.attachment-panel-title {
  padding: 2px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.attachment-menu-grid {
  display: grid;
  gap: 8px;
}

.attachment-menu-grid button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border) 86%);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel2) 80%, transparent);
  color: var(--text);
  font-weight: 950;
  text-align: left;
  cursor: pointer;
}

.attachment-menu-grid button:hover, .attachment-menu-grid button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border) 52%);
  background: color-mix(in srgb, var(--accent) 13%, var(--panel2) 87%);
}

.attachment-menu-grid img {
  width: 22px;
  height: 22px;
  justify-self: center;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.sticker-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.sticker-tabs button, .sticker-content [data-create-sticker], .custom-emoji-create [data-create-emoji] {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel2);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

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

.sticker-search-row {
  display: block;
}

.custom-emoji-create, .sticker-create-box {
  display: grid;
  gap: 8px;
}

.custom-emoji-create {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.sticker-create-box {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.sticker-content {
  display: grid;
  gap: 10px;
}

.sticker-content[data-sticker-content="emoji"] {
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  align-items: center;
}

.emoji-item, .sticker-item {
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border) 86%);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  color: var(--text);
  cursor: pointer;
}

.emoji-item {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  font-size: 22px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.emoji-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
}

.emoji-item.is-custom-image {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel2) 90%);
}

.emoji-status.emoji-status-custom {
  display: inline-grid !important;
  place-items: center;
  width: 21px;
  height: 21px;
  overflow: hidden;
  vertical-align: middle;
}

.emoji-status.emoji-status-custom img, .emoji-status-picker button.is-custom-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.emoji-status-picker button.is-custom-image {
  padding: 4px;
}

.sticker-pack-title {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  cursor: pointer;
}

.sticker-pack-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
}

.sticker-pack-row .sticker-pack-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-pack-delete {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, #ff6b6b 34%, var(--border) 66%);
  border-radius: 50%;
  background: color-mix(in srgb, #ff6b6b 10%, var(--panel2) 90%);
  color: color-mix(in srgb, #ff6b6b 78%, var(--text) 22%);
  cursor: pointer;
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
}

.sticker-pack-title:hover, .sticker-pack-title:focus-visible, .sticker-pack-delete:hover, .sticker-pack-delete:focus-visible {
  color: var(--text);
}

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

.sticker-item {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 34px;
  overflow: hidden;
}

.sticker-item-file {
  grid-template-rows: 1fr auto;
  gap: 4px;
  padding: 8px;
  font-size: 12px;
  font-weight: 950;
}

.sticker-item-file small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
}

.sticker-item img, .sticker-item video, .sticker-message {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sticker-item video {
  display: block;
  pointer-events: none;
}

.sticker-item-live {
  position: relative;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 48%),
    color-mix(in srgb, var(--panel2) 78%, transparent);
}

.sticker-item-live::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel2) 80%, transparent);
  pointer-events: none;
}

.sticker-message {
  max-width: min(230px, 56vw);
  border-radius: 24px;
  background: transparent;
}

.sticker-message.media-placeholder-loading, .sticker-message.media-placeholder-empty {
  display: block;
  width: min(230px, 56vw);
  height: min(230px, 56vw);
}

.sticker-video-message {
  display: block;
  aspect-ratio: 1;
  object-fit: contain;
  outline: none;
}

.message.sticker-only {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 2px 0 !important;
  max-width: min(280px, 72vw);
  color: var(--text);
}

.message.sticker-only::before {
  display: none !important;
}

.message.sticker-only .content {
  overflow: visible;
}

.message.sticker-only .meta {
  width: fit-content;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 72%, transparent);
  color: var(--muted);
}

.message.sticker-only.out .meta {
  margin-left: auto;
}

.message.sticker-only .sticker-media-file {
  max-width: min(260px, 70vw);
}

.sticker-content input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel2);
  color: var(--text);
  padding: 10px 12px;
}

.sticker-content input[type="file"] {
  cursor: pointer;
}

.sticker-search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel2);
  color: var(--text);
  padding: 10px 14px;
  font-weight: 800;
}

.sticker-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  padding: 14px 8px;
}

@media (max-width: 768px) {
  .sticker-panel {
    right: 10px;
    left: auto;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    width: min(360px, calc(100vw - 20px));
    max-height: min(430px, 56vh);
  }

  .attachment-panel {
    left: 10px;
    right: auto;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    width: min(320px, calc(100vw - 20px));
    max-height: min(430px, 56vh);
  }

  .pending-attachment-tray {
    left: 10px;
    right: 10px;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    max-height: min(330px, 46vh);
  }

  .pending-attachment-item {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .pending-attachment-size {
    display: none;
  }
}

.tg-settings-row-text {
  display: grid;
  gap: 3px;
}

.tg-settings-row-text strong {
  font-size: 14px;
  font-weight: 900;
}

.tg-settings-row-text small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tg-settings-row-value {
  color: color-mix(in srgb, var(--accent) 82%, #fff 18%);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

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

body[data-pattern="dots"] #messages, .theme-preview-chat::before {
  background-size: var(--pattern-scale, 28px) var(--pattern-scale, 28px);
}

body[data-vibe="luminous"] {
  --ink-glow: color-mix(in srgb, var(--accent) 32%, transparent);
}

body[data-vibe="luminous"] .message.out, body[data-vibe="luminous"] .send-btn, body[data-vibe="luminous"] .btn-primary, body[data-vibe="luminous"] .create-chat-btn {
  box-shadow:
    0 0 var(--glow-strength, 22px) color-mix(in srgb, var(--accent) 44%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

body[data-vibe="aurora"] #chat::before, body[data-vibe="aurora"] .theme-preview-card {
  background:
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 34%),
    radial-gradient(circle at 78% 32%, rgba(93, 164, 255, 0.16), transparent 32%),
    radial-gradient(circle at 48% 88%, rgba(255, 255, 255, 0.052), transparent 36%);
}

body[data-vibe="aurora"] .modal-content, body[data-vibe="aurora"] .auth-box, body[data-vibe="aurora"] .profile-home-card {
  box-shadow:
    0 0 calc(var(--glow-strength, 22px) * 1.35) color-mix(in srgb, var(--accent) 16%, transparent),
    var(--shadow-popover);
}

body[data-vibe="radar"] #messages {
  background-image:
    radial-gradient(circle at center, transparent 0 26%, color-mix(in srgb, var(--accent) 8%, transparent) 26.5% 27%, transparent 27.5% 100%),
    linear-gradient(90deg, transparent 49.7%, color-mix(in srgb, var(--accent) 9%, transparent) 50%, transparent 50.3%),
    linear-gradient(transparent 49.7%, color-mix(in srgb, var(--accent) 9%, transparent) 50%, transparent 50.3%);
  background-size:
    calc(var(--pattern-scale, 34px) * 4) calc(var(--pattern-scale, 34px) * 4),
    calc(var(--pattern-scale, 34px) * 2) calc(var(--pattern-scale, 34px) * 2),
    calc(var(--pattern-scale, 34px) * 2) calc(var(--pattern-scale, 34px) * 2);
}

body[data-composer="solid"] #messageInput {
  background: var(--panel2);
}

body[data-composer="solid"] .input-wrapper::before {
  display: none;
}

body[data-composer="terminal"] #textInput {
  border-radius: 8px;
  font-family: "Cascadia Mono", "Consolas", monospace;
  letter-spacing: -0.02em;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 40%),
    #080b09;
}

body[data-composer="terminal"] .send-btn {
  border-radius: 12px;
}

body[data-avatars="circle"] .avatar, body[data-avatars="circle"] .logo, body[data-avatars="circle"] .profile-home-avatar {
  border-radius: 50% !important;
}

body[data-avatars="cut"] .avatar, body[data-avatars="cut"] .logo, body[data-avatars="cut"] .profile-home-avatar {
  border-radius: 6px 20px 6px 20px !important;
}

body[data-chrome="solid"] #sidebar, body[data-chrome="solid"] #chatList, body[data-chrome="solid"] #chatHeader, body[data-chrome="solid"] #messageInput, body[data-chrome="solid"] .modal-content {
  backdrop-filter: none;
  background-color: var(--panel);
}

body[data-chrome="rail"] #sidebar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 48%),
    #0c0f0d;
}

body[data-chrome="rail"] #chatList {
  border-right-color: color-mix(in srgb, var(--accent) 26%, var(--border) 74%);
}

body[data-chrome="rail"] #chatHeader::after, body[data-chrome="rail"] #messageInput::before {
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.message, .chatItem, .theme-preview-card, .modal-content {
  transition-duration: var(--motion-fast, 0.273s);
}

body[data-vibe="calm"] .message.out {
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 12%, rgba(0, 0, 0, 0.18));
}

@media (max-width: 768px) {
  #settingsModal .modal-body {
    max-height: calc(100dvh - 150px);
  }

  .tg-settings-shell {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: 0;
  }

  .tg-settings-nav.settings-scroll-nav {
    position: sticky;
    top: 0;
    display: flex;
    margin: -2px -2px 6px;
    padding: 8px 2px 10px;
    overflow-x: auto;
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(180deg, var(--panel) 0%, color-mix(in srgb, var(--panel) 84%, transparent) 82%, transparent);
    scrollbar-width: none;
  }

  .tg-settings-nav button {
    width: auto;
    min-width: 190px;
    grid-template-columns: 24px 1fr auto;
    min-height: 46px;
    border: 1px solid var(--hairline);
    background: color-mix(in srgb, var(--panel2) 84%, transparent);
  }

  .tg-settings-panel-head h3 {
    font-size: 22px;
  }

  .tg-setting-control.form-group {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 13px 14px;
  }

  .tg-setting-hint, .tg-setting-control input, .tg-setting-control select {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .tg-settings-row {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .tg-settings-row-value {
    grid-column: 2;
    justify-self: start;
  }

  .media-device-grid {
    grid-template-columns: 1fr;
  }

  .media-device-actions, .settings-utility-grid, .settings-cache-grid {
    display: grid;
  }

  .media-device-actions button, .settings-utility-grid button, .settings-cache-grid button {
    width: 100%;
  }

  .message {
    max-width: min(var(--message-max-width, 88%), 88%);
  }
}

#sidebar .sidebar-header {
  display: none !important;
}

#logoutBtn {
  display: none !important;
}

#chatSearchBtn {
  display: none !important;
}

@media (min-width: 769px) {
  .back-btn, .profile-mobile-btn, .settings-mobile-btn {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .back-btn, .profile-mobile-btn, .settings-mobile-btn {
    display: inline-flex !important;
  }
}

.composer-media-btn {
  background: color-mix(in srgb, var(--panel2) 82%, transparent);
  border: 1px solid var(--hairline);
  flex-shrink: 0;
}

.composer-media-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border) 48%);
  background: color-mix(in srgb, var(--accent) 14%, var(--panel2) 86%);
}

.composer-media-btn.recording {
  border-color: color-mix(in srgb, var(--danger) 68%, var(--accent) 32%);
  background: color-mix(in srgb, var(--danger) 18%, var(--panel2) 82%);
  animation: recordingPulse 1s ease-in-out infinite;
}

.message-context-menu {
  position: fixed;
  z-index: 3000;
  min-width: 178px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--hairline) 78%);
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 14%, transparent), transparent 46%),
    color-mix(in srgb, var(--panel2) 88%, transparent);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(var(--glass-blur, 18px));
  animation: menuIslandIn var(--motion-fast, 0.22s) cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.message-context-menu button {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.message-context-menu button:hover, .message-context-menu button:focus-visible {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.message-context-menu button.danger {
  color: #ff8b86;
}

.message-context-reactions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px;
  margin-bottom: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.028);
}

.message-context-reactions button {
  min-height: 34px;
  text-align: center;
  padding: 0;
  font-size: 16px;
}

.message > .message-actions {
  display: none !important;
}

.media-message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: min(280px, 68vw);
}

.media-message-label {
  font-size: 12px;
  font-weight: 800;
  color: inherit;
  opacity: 0.72;
}

.voice-message audio {
  width: 100%;
  min-width: 230px;
  max-width: 320px;
  filter: saturate(0.9);
}

.video-note-message {
  min-width: 0;
}

.video-note-message video {
  width: min(260px, 58vw);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  background: #000;
  box-shadow:
    0 0 var(--glow-strength, 22px) color-mix(in srgb, var(--accent) 20%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.media-caption {
  margin-top: 8px;
}

.private-text-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.private-text-canvas.media-caption {
  margin-top: 8px;
}

.custom-player {
  display: grid;
  gap: 10px;
  min-width: min(310px, 70vw);
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--hairline) 82%);
  border-radius: 20px;
  background:
    radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 40%),
    rgba(255, 255, 255, 0.032);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  animation: playerFloatIn var(--motion-fast, 0.24s) ease both;
}

.tg-audio-player {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-width: min(320px, 72vw);
  padding: 12px;
}

.tg-audio-player .player-play, .yt-video-player .player-play, .tg-video-note-player .player-play, .tg-profile-music-card .player-play {
  position: relative;
  font-size: 0;
}

.tg-audio-player .player-play::before, .yt-video-player .player-play::before, .tg-video-note-player .player-play::before, .tg-profile-music-card .player-play::before {
  content: "";
  width: 0;
  height: 0;
  display: block;
  margin-left: 3px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid currentColor;
}

.tg-audio-player.playing .player-play::before, .yt-video-player.playing .player-play::before, .tg-video-note-player.playing .player-play::before, .tg-profile-music-card.playing .player-play::before {
  width: 14px;
  height: 16px;
  margin-left: 0;
  border: 0;
  background:
    linear-gradient(90deg, currentColor 0 38%, transparent 38% 62%, currentColor 62% 100%);
}

.tg-audio-player .player-progress {
  height: 34px;
  margin: 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at var(--player-progress, 0%) 50%, color-mix(in srgb, #fff 36%, transparent), transparent 18px),
    linear-gradient(90deg,
      color-mix(in srgb, var(--accent) 92%, #fff 8%) 0 var(--player-progress, 0%),
      color-mix(in srgb, var(--text) 13%, transparent) var(--player-progress, 0%) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -8px 14px rgba(0, 0, 0, 0.16),
    0 0 calc(var(--glow-strength, 22px) * 0.55) color-mix(in srgb, var(--accent) 18%, transparent);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: filter 0.2s ease, box-shadow 0.2s ease;
  position: absolute;
  inset: 0 0 auto 0;
  opacity: 0;
  z-index: 3;
}

.tg-audio-player.playing .player-progress {
  animation: oneUiListenBar 1.15s ease-in-out infinite;
}

.tg-audio-player .player-progress::-webkit-slider-runnable-track {
  height: 16px;
  border-radius: 999px;
  background: transparent;
}

.tg-audio-player .player-progress::-moz-range-track {
  height: 16px;
  border-radius: 999px;
  background: transparent;
}

.tg-audio-player .player-progress::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -1px;
  border: 2px solid color-mix(in srgb, #fff 72%, var(--accent) 28%);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 88%, #fff 12%);
  box-shadow: 0 4px 18px color-mix(in srgb, var(--accent) 40%, transparent);
  -webkit-appearance: none;
  appearance: none;
}

.tg-audio-player .player-progress::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, #fff 72%, var(--accent) 28%);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 88%, #fff 12%);
  box-shadow: 0 4px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}

.audio-player {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.player-play {
  width: 46px;
  height: 46px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border) 58%);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%);
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.custom-player.playing .player-play {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 0 var(--glow-strength, 22px) color-mix(in srgb, var(--accent) 36%, transparent);
}

.tg-profile-music-card.playing .player-play {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 0 var(--glow-strength, 22px) color-mix(in srgb, var(--accent) 36%, transparent);
}

.player-body {
  min-width: 0;
}

.player-title {
  margin-bottom: 6px;
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.76;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-progress {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.player-time {
  margin-top: 3px;
  color: inherit;
  font-size: 11px;
  opacity: 0.62;
}

.custom-player.player-error {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--hairline) 58%);
}

.custom-player.player-error .player-time {
  color: var(--danger);
  opacity: 1;
}

.custom-player.player-native-fallback audio, .custom-player.player-native-fallback video {
  display: block;
  width: 100%;
  margin-top: 8px;
}

.custom-player.player-native-fallback.tg-audio-player {
  grid-template-columns: 1fr;
}

.music-notification {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: min(520px, calc(100vw - 28px));
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border) 74%);
  border-radius: 24px;
  background:
    radial-gradient(circle at 10% 10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 44%),
    color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  animation: musicNoticeIn 0.26s cubic-bezier(0.2, 0.85, 0.2, 1) both;
  backdrop-filter: blur(calc(var(--glass-blur, 16px) * 0.85));
}

.music-notification-glow {
  position: absolute;
  inset: -40%;
  background:
    conic-gradient(from 180deg,
      transparent,
      color-mix(in srgb, var(--accent) 18%, transparent),
      transparent,
      color-mix(in srgb, var(--bubble-out) 16%, transparent),
      transparent);
  opacity: 0;
  pointer-events: none;
}

.music-notification.playing .music-notification-glow {
  opacity: 1;
  animation: musicNoticeGlow 4.8s linear infinite;
}

.music-notification-main {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 86px auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.music-notification-play, .music-notification-stop, .music-notification-close {
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border) 66%);
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  color: var(--text);
  cursor: pointer;
  font-weight: 950;
}

.music-notification-play {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.music-notification-play::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid currentColor;
}

.music-notification.playing .music-notification-play {
  background: var(--accent);
  color: var(--accent-text);
}

.music-notification.playing .music-notification-play::before {
  width: 14px;
  height: 16px;
  margin-left: 0;
  border: 0;
  background:
    linear-gradient(90deg, currentColor 0 38%, transparent 38% 62%, currentColor 62% 100%);
}

.music-notification-body {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.music-notification-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-notification-seek, .music-notification-volume {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.music-notification-seek {
  height: 12px;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      var(--accent) 0 var(--music-progress, 0%),
      color-mix(in srgb, var(--text) 12%, transparent) var(--music-progress, 0%) 100%);
  -webkit-appearance: none;
  appearance: none;
}

.music-notification-seek::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: transparent;
}

.music-notification-seek::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  margin-top: -2px;
  border: 2px solid color-mix(in srgb, #fff 70%, var(--accent) 30%);
  border-radius: 50%;
  background: var(--accent);
  -webkit-appearance: none;
  appearance: none;
}

.music-notification-time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.music-notification-stop, .music-notification-close {
  min-height: 38px;
  border-radius: 999px;
  padding: 0 13px;
}

.music-notification-close {
  width: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

@keyframes musicNoticeIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.transfer-indicator {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: grid;
  grid-template-columns: auto minmax(170px, 240px);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--hairline) 74%);
  border-radius: 22px;
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--accent) 18%, transparent), transparent 40%),
    color-mix(in srgb, var(--panel) 90%, #000 10%);
  color: var(--text);
  box-shadow: 0 20px 58px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
  animation: transferIn 0.22s ease both;
}

.transfer-indicator.hidden {
  display: none !important;
}

.transfer-indicator-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-top-color: var(--accent);
  animation: transferSpin 0.85s linear infinite;
}

.transfer-indicator-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.transfer-indicator-body strong {
  font-size: 13px;
  line-height: 1.1;
}

.transfer-indicator-body span {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-indicator-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.transfer-indicator-track i {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff 45%));
  transition: width 0.18s ease;
}

.transfer-indicator.indeterminate .transfer-indicator-track i {
  animation: transferBar 1s ease-in-out infinite;
}

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

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

@keyframes transferBar {
  0% {
    transform: translateX(-120%);
    width: 36%;
  }
  50% {
    width: 62%;
  }
  100% {
    transform: translateX(280%);
    width: 36%;
  }
}

@keyframes musicNoticeGlow {
  to {
    transform: rotate(1turn);
  }
}

@media (max-width: 720px) {
  .music-notification {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }

  .music-notification-main {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .music-notification-volume, .music-notification-stop {
    grid-column: 2 / 4;
  }
}

.custom-player.player-native-fallback.tg-audio-player .player-play, .custom-player.player-native-fallback.tg-audio-player .player-body {
  display: none;
}

.yt-video-player video:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
  background: #000;
}

.voice-transcript-popout {
  position: absolute;
  top: 8px;
  width: min(260px, 34vw);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--hairline) 80%);
  border-radius: 16px;
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--accent) 12%, transparent), transparent 44%),
    color-mix(in srgb, var(--panel2) 88%, transparent);
  color: var(--text);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
}

.message.in .voice-transcript-popout {
  left: calc(100% + 10px);
}

.message.out .voice-transcript-popout {
  right: calc(100% + 10px);
}

.voice-transcript-popout span {
  color: color-mix(in srgb, var(--accent) 78%, #fff 22%);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.voice-transcript-popout strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.38;
  font-weight: 800;
}

.yt-video-player {
  min-width: 0 !important;
  padding: 0 !important;
  position: relative;
  overflow: hidden;
  border: 0 !important;
  border-radius: 22px !important;
  background: #000 !important;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  width: min(260px, 62vw) !important;
  aspect-ratio: 1 / 1;
}

.yt-video-player video {
  display: block;
  width: 100% !important;
  max-height: none !important;
  border-radius: 22px !important;
  background: #000;
  object-fit: cover !important;
  height: 100% !important;
}

.tg-video-note-player {
  min-width: 0;
  width: fit-content;
  border-radius: 999px;
  padding: 8px;
  position: relative;
}

.tg-video-note-player video {
  width: min(260px, 58vw);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
}

.video-player-controls {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  backdrop-filter: blur(12px);
}

.tg-video-note-player .video-player-controls {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 8px;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.36), transparent 52%);
  opacity: 1;
  transition: opacity 0.18s ease;
  pointer-events: auto;
}

.tg-video-note-player:hover .video-player-controls, .tg-video-note-player.playing .video-player-controls {
  opacity: 1;
}

.tg-video-note-player .player-play {
  width: 58px;
  height: 58px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.player-fullscreen {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.player-fullscreen:hover {
  background: rgba(255, 255, 255, 0.16);
}

.custom-player.player-loading .player-progress {
  filter: saturate(1.2) brightness(1.1);
}

.custom-player.player-loading .player-play, .tg-profile-music-card.player-loading .player-play {
  position: relative;
  color: transparent;
}

.custom-player.player-loading .player-play::after, .tg-profile-music-card.player-loading .player-play::after {
  content: "";
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: var(--text);
  animation: spin 0.7s linear infinite;
}

.custom-player.player-loading .player-play::before, .tg-profile-music-card.player-loading .player-play::before {
  display: none;
}

.image-attachment {
  display: block;
  width: auto;
  max-width: min(360px, 100%);
  max-height: 420px;
  border-radius: 20px;
  object-fit: contain;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.media-placeholder-loading, .media-placeholder-empty {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--panel2) 82%, transparent), color-mix(in srgb, var(--accent) 9%, var(--panel) 91%));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent),
    0 12px 34px rgba(0, 0, 0, 0.18);
}

.media-placeholder-loading {
  position: relative;
  overflow: hidden;
}

.media-placeholder-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transform: translateX(-100%);
  animation: mediaPlaceholderSweep 1.2s ease-in-out infinite;
  pointer-events: none;
}

canvas.media-placeholder-loading::after, canvas.media-placeholder-empty::after {
  content: none;
}

@keyframes mediaPlaceholderSweep {
  to {
    transform: translateX(100%);
  }
}

.message, .message .content, .media-caption, .custom-player, .file-attachment-card, .yt-video-player {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.message .content > .image-attachment, .message .content > canvas.image-attachment {
  max-width: 100%;
  height: auto;
}

.file-attachment-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  min-width: min(320px, 72vw);
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--hairline) 80%);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.034);
}

.file-attachment-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 20%, var(--panel2) 80%);
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
}

.file-attachment-body {
  min-width: 0;
}

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

.file-attachment-meta {
  margin: 4px 0 8px;
  color: inherit;
  font-size: 12px;
  opacity: 0.62;
}

.file-attachment-download {
  color: inherit;
  font-weight: 900;
  text-decoration: none;
}

.file-attachment-download:hover {
  color: var(--accent);
}

.pinned-stack {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.pinned-chip {
  min-width: min(220px, 48vw);
  max-width: 280px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border) 82%);
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 13%, transparent), rgba(255, 255, 255, 0.025));
  color: var(--text);
  padding: 7px 9px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.pinned-chip:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border) 62%);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, transparent), rgba(255, 255, 255, 0.045));
}

.pinned-chip-thumb {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  background: #000;
}

.pinned-chip-thumb.round {
  border-radius: 50%;
}

.pinned-chip-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.pinned-chip-body strong {
  color: var(--accent);
  font-size: 11px;
  font-weight: 950;
}

.pinned-chip-body span {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-music-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.profile-music-tools small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.audio-waveform {
  position: relative;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 8px;
  border-radius: 999px;
  overflow: hidden;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--accent) 28%, transparent) 0 var(--player-progress, 0%),
      color-mix(in srgb, var(--text) 9%, transparent) var(--player-progress, 0%) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -10px 20px rgba(0, 0, 0, 0.13);
}

.audio-waveform::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--player-progress, 0%) 50%, color-mix(in srgb, #fff 22%, transparent), transparent 24px);
  opacity: 0.65;
}

.audio-waveform span {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 2px;
  height: var(--wave-h, 26%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 76%, #fff 24%);
  opacity: 0.62;
  transform-origin: center;
  transition: height 0.09s linear, opacity 0.18s ease, filter 0.18s ease;
}

.tg-audio-player.playing .audio-waveform span {
  opacity: 0.95;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 36%, transparent));
}

.tg-audio-player .player-body {
  position: relative;
  display: grid;
  gap: 4px;
}

.tg-audio-player .player-time {
  margin-left: 8px;
}

.yt-video-player .video-player-controls {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  grid-template-columns: 42px 1fr auto auto;
  margin: 0 !important;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(15, 15, 15, 0.55), rgba(0, 0, 0, 0.76));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  inset: auto 8px 8px;
}

.yt-video-player:hover .video-player-controls, .yt-video-player.playing .video-player-controls, .yt-video-player:focus-within .video-player-controls, .yt-video-player:fullscreen .video-player-controls {
  opacity: 1;
  transform: translateY(0);
}

.yt-video-player:fullscreen {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: #000 !important;
}

.yt-video-player:fullscreen video {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
}

.player-mute, .player-speed, .player-fullscreen {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.player-speed {
  color-scheme: dark;
}

.player-volume {
  width: 86px;
  accent-color: var(--accent);
  cursor: pointer;
}

.tg-video-note-player:not(.playing) .video-player-controls {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.4), transparent 54%);
}

#layout, #sidebar, #chatList, #chat, #messages, #messageInput, #profileHome, #newsHome, #callsHome, #settingsHome, .news-panel, .modal-content, .modal-body, .tg-settings-shell, .tg-settings-panels, .tg-settings-panel {
  min-height: 0;
}

#profileHome .profile-home-card {
  margin: auto;
}

#profileHome .profile-home-actions {
  display: none !important;
}

.settings-home-panel {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--chat-bg);
}

.settings-home-panel.hidden {
  display: none !important;
}

.privacy-logout-group {
  gap: 12px;
}

.settings-privacy-logout {
  align-self: flex-start;
  min-width: 160px;
  border-color: color-mix(in srgb, var(--danger) 44%, var(--border) 56%) !important;
  color: color-mix(in srgb, var(--danger) 82%, var(--text) 18%) !important;
}

.news-content, #callsContent, #newsContent, .member-picker, .forward-targets {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.tg-settings-modal .modal-body {
  display: flex;
}

body.settings-save-motion {
  --motion-fast: 0.08s;
  --motion-shell: 0.1s;
  --motion-message: 0.08s;
  --glow-strength: 0px;
}

body.settings-profile-link-disabled .tg-profile-share {
  opacity: 0.46;
  pointer-events: none;
}

body.settings-compact-voice-player .tg-audio-player {
  min-width: min(260px, 68vw);
  padding: 9px;
}

body.settings-compact-voice-player .tg-audio-player .player-progress {
  height: 8px;
}

body.settings-hide-video-notes .tg-video-note-player {
  filter: saturate(0.78);
}

body.settings-compact-video-player .yt-video-player {
  min-width: min(300px, 68vw);
}

body.settings-compact-video-player .yt-video-player video {
  width: min(340px, 68vw);
  max-height: 260px;
}

#chat.chat-switching #messages {
  animation: chatSwapIn var(--motion-shell, 0.28s) ease both;
}

.chat-search-bar.hidden {
  display: none !important;
}

body:not(.chat-search-open) .chat-search-bar {
  display: none !important;
}

.pinned-bar:not(.hidden), .chat-search-bar:not(.hidden), .reply-bar:not(.hidden) {
  animation: slideUtilityIn var(--motion-fast, 0.24s) ease both;
}

.send-btn:not(:disabled):active, .composer-media-btn:not(:disabled):active, .message-context-menu button:active {
  transform: scale(0.96);
}

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

@keyframes recordingPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 42%, transparent);
  }
  50% {
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--danger) 0%, transparent);
  }
}

@keyframes messagePopIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes chatItemIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

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

@keyframes oneUiWave {
  0%,
  100% {
    transform: scaleY(0.45);
    filter: saturate(0.9);
  }
  35% {
    transform: scaleY(1.2);
    filter: saturate(1.35);
  }
  65% {
    transform: scaleY(0.72);
  }
}

@keyframes oneUiListenBar {
  0%,
  100% {
    filter: saturate(1) brightness(1);
  }
  50% {
    filter: saturate(1.28) brightness(1.12);
  }
}

@keyframes chatSwapIn {
  from {
    opacity: 0.42;
    transform: translateX(14px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0);
  }
}

@media (max-width: 768px) {
  :root {
    --mobile-gap: 8px;
  }

  #chatHeader {
    height: 58px;
    gap: 8px;
    padding: 0 10px;
  }

  .chat-user {
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .chat-user .avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    font-size: 14px;
  }

  .chat-user .name {
    max-width: 42vw;
    font-size: 15px;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-user .status {
    max-width: 42vw;
    font-size: 11px;
  }

  .chat-actions {
    gap: 5px;
    flex: 0 0 auto;
  }

  .chat-actions .action-btn, .composer-media-btn, .send-btn, .back-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
  }

  .chat-actions .action-btn img, .composer-media-btn img, .send-btn img {
    width: 18px;
    height: 18px;
  }

  #messages {
    padding: 10px;
    gap: 8px;
  }

  .message {
    max-width: min(86%, 420px);
    padding: 8px 10px;
    border-radius: 17px;
    font-size: 13px;
  }

  .message .sender {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .message .content {
    font-size: 13px;
    line-height: 1.38;
  }

  .message.out {
    max-width: min(80%, 390px);
  }

  .message .reply-preview, .message .forward-preview {
    padding: 7px 8px;
    border-radius: 11px;
  }

  .image-attachment {
    width: auto;
    max-width: 100%;
    max-height: min(46vh, 300px);
    border-radius: 16px;
  }

  .yt-video-player {
    min-width: 0;
    width: min(100%, 82vw);
  }

  .yt-video-player video {
    width: 100%;
    max-height: min(46vh, 300px);
  }

  .tg-audio-player, .file-attachment-card {
    width: min(100%, 78vw);
    min-width: 0;
  }

  #messageInput {
    gap: 7px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  #textInput {
    min-height: 38px;
    padding: 9px 11px;
    font-size: 13px;
  }

  .input-wrapper {
    min-width: 0;
  }

  .transfer-indicator {
    left: 10px;
    right: 10px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: auto 1fr;
    padding: 10px 12px;
  }

  .transfer-indicator-ring {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 420px) {
  .chat-user .name, .chat-user .status {
    max-width: 34vw;
  }

  #callAudioBtn, #callVideoBtn, #chatManageBtn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .message {
    max-width: 88%;
  }

  .message.out {
    max-width: 82%;
  }
}

@media (max-width: 520px) {
  #profileHome {
    padding: 8px;
  }

  #profileHome .profile-home-card.own-profile-card {
    width: 100%;
    border-radius: 24px;
  }

  .profile-home-card.own-profile-card::before {
    height: 218px;
  }

  .profile-home-card.own-profile-card .profile-home-avatar {
    width: 104px;
    height: 104px;
  }

  .profile-home-card.own-profile-card .profile-home-name {
    font-size: clamp(24px, 7vw, 30px);
  }

  .profile-home-card.own-profile-card .tg-profile-home-row {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
  }
}

#videoNoteBtn {
  display: none !important;
}

#voiceRecordBtn, #stickerToggleBtn {
  display: inline-flex !important;
}

#fileAttachBtn {
  order: 2;
  --scp-icon-url: url("icons/paperclip.svg");
}

#stickerToggleBtn {
  order: 0;
  --scp-icon-url: url("icons/sticker.svg");
}

#messageInput .input-wrapper {
  order: 1;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 50px;
  border: 1px solid var(--scp-composer-border);
  border-radius: 999px;
  background: var(--scp-composer-input-bg);
}

#sendBtn {
  order: 4;
  --scp-icon-url: url("icons/send.svg");
}

#voiceRecordBtn {
  order: 5;
  --scp-icon-url: url("icons/micro.svg");
}

#fileAttachBtn.composer-media-btn, #stickerToggleBtn.composer-media-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
}

#voiceRecordBtn.composer-media-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
  touch-action: none;
  user-select: none;
}

#voiceRecordBtn.video-note-mode {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--hairline) 38%);
  background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%);
  --scp-icon-url: url("icons/video.svg");
}

.chatItem.official .chat-item-actions, .chatItem.official .chat-archive-quick {
  display: none !important;
}

.message.system.friend-request-system {
  max-width: min(460px, 90%);
}

.message.system.friend-request-system .system-content {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border) 66%);
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--accent) 14%, transparent), transparent 48%),
    color-mix(in srgb, var(--panel2) 88%, #000 12%);
}

.friend-request-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.friend-request-actions button {
  min-height: 36px;
  border-radius: 999px;
  padding: 0 14px;
}

.friend-request-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  font-size: 12px;
  font-weight: 900;
}

#chat > .music-notification {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: 4;
  width: 100%;
  flex-shrink: 0;
  border-width: 0 0 1px;
  border-radius: 0;
  background: color-mix(in srgb, var(--accent) 34%, var(--panel) 66%);
  box-shadow: none;
  backdrop-filter: none;
  animation: none;
}

#chat > .music-notification.hidden {
  display: none !important;
}

#chat > .music-notification .music-notification-main {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 12px 10px;
}

#chat > .music-notification .music-notification-play {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #050505;
}

#chat > .music-notification .music-notification-title {
  color: #050505;
  font-size: 18px;
  font-weight: 950;
}

#chat > .music-notification .music-notification-time {
  color: rgba(0, 0, 0, 0.78);
}

#chat > .music-notification .music-notification-seek {
  height: 10px;
  background:
    linear-gradient(90deg,
      #050505 0 var(--music-progress, 0%),
      rgba(0, 0, 0, 0.28) var(--music-progress, 0%) 100%);
}

#chat > .music-notification .music-notification-volume, #chat > .music-notification .music-notification-stop {
  display: none;
}

#chat > .music-notification .music-notification-close {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: #050505;
  font-size: 36px;
}

@media (prefers-reduced-motion: reduce) {
  .composer-media-btn.recording, .message-context-menu, .custom-player, .message, .chatItem, .pinned-bar:not(.hidden), .chat-search-bar:not(.hidden), .reply-bar:not(.hidden) {
    animation: none !important;
  }
}

#profileHome.scp-profile-page {
  display: none;
  flex: 1 1 auto;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  overflow: auto;
  background: var(--chat-bg);
}

body.profile-home-mode #profileHome.scp-profile-page {
  display: flex !important;
}

.scp-profile-modal-shell {
  padding: 0;
}

.scp-profile-page-modal {
  width: min(420px, calc(100vw - 24px));
  max-height: min(820px, calc(100dvh - 24px));
  border-radius: 0;
  background: var(--chat-bg);
  overflow: auto !important;
}

.scp-profile-page {
  min-width: 0;
  color: var(--text);
}

.scp-profile-card {
  width: min(430px, 100%);
  min-height: 100%;
  margin: 0 auto;
  background: var(--chat-bg);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.scp-profile-hero {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  min-height: 232px;
  padding: 14px 18px 28px;
  overflow: hidden;
  border-radius: 0 0 22px 22px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.5)),
    radial-gradient(circle at 48% 12%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 38%),
    color-mix(in srgb, var(--panel2) 82%, #111 18%);
  margin-bottom: 0;
}

.scp-profile-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.48)),
    var(--profile-wallpaper, none);
  background-size: cover;
  background-position: center;
  filter: blur(1.5px) saturate(0.92);
  transform: scale(1.02);
  opacity: 0;
}

.scp-profile-hero.has-wallpaper::before {
  opacity: 1;
}

.scp-profile-hero > * {
  position: relative;
  z-index: 1;
}

.scp-profile-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  font-size: 15px;
  font-weight: 950;
  cursor: pointer;
}

.scp-profile-back img {
  filter: invert(1);
}

.scp-profile-reveal-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
  cursor: pointer;
}

.scp-profile-reveal-btn:hover, .scp-profile-reveal-btn:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 62%, #fff 38%);
  background: color-mix(in srgb, var(--accent) 28%, rgba(0, 0, 0, 0.42));
  box-shadow: var(--focus-ring);
}

.scp-profile-avatar {
  width: 96px;
  height: 96px;
  margin-top: 2px;
  border-radius: 22px;
  font-size: 30px;
  background: #dedede;
  color: #242424;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.scp-profile-title-wrap {
  display: grid;
  justify-items: center;
  margin-top: 10px;
}

.scp-profile-name {
  margin: 0;
  max-width: min(320px, calc(100vw - 48px));
  color: #fff;
  font-size: 25px;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.72);
  overflow-wrap: anywhere;
}

.scp-profile-username {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 18px;
  line-height: 1.05;
  font-weight: 950;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

.scp-profile-strip, .scp-profile-block, .scp-profile-line, .scp-profile-share-row {
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border) 84%);
  background: color-mix(in srgb, var(--panel) 90%, #000 10%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.scp-profile-strip {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 14px 34px;
}

.scp-profile-music-row {
  margin-top: 8px;
  border-radius: 22px 22px 0 0;
}

.scp-profile-channel-row {
  border-top: 0;
  border-radius: 0 0 22px 22px;
}

.scp-profile-music-row.hidden + .scp-profile-channel-row {
  margin-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border) 84%);
  border-radius: 22px;
}

.scp-profile-music-row:has(+ .scp-profile-channel-row.hidden) {
  border-radius: 22px;
}

.scp-profile-thumb {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #dedede;
  background-size: cover;
  background-position: center;
  color: #1b1712;
  font-size: 18px;
  font-weight: 950;
}

.scp-profile-thumb.has-cover, .scp-profile-thumb.has-avatar {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.scp-profile-thumb.has-avatar {
  color: transparent;
}

.scp-profile-strip-text {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: #fff;
}

.scp-profile-strip-text strong, .scp-profile-strip-text a {
  color: #fff;
  font-size: 21px;
  line-height: 1.05;
  font-weight: 950;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.scp-profile-strip-text span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  line-height: 1.05;
  font-weight: 900;
}

.scp-profile-block {
  min-height: 148px;
  margin-top: 8px;
  padding: 17px 24px;
  border-radius: 22px 22px 0 0;
}

.scp-profile-block h2 {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1;
  font-weight: 950;
}

.scp-profile-block p {
  margin: 0;
  color: #fff;
  font-size: 21px;
  line-height: 1.18;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.scp-profile-line {
  display: grid;
  align-items: center;
  min-height: 78px;
  padding: 16px 24px;
  border-top: 0;
}

.scp-profile-birth-row strong, .scp-profile-badges-row strong {
  color: #fff;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.scp-profile-badges-row {
  min-height: 46px;
  border-radius: 0 0 22px 22px;
  text-align: center;
}

.scp-profile-badges-row strong {
  font-size: 16px;
}

.scp-profile-share-row {
  display: grid;
  grid-template-columns: 102px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 148px;
  margin-top: 8px;
  padding: 22px 20px;
  border-radius: 22px;
}

.scp-profile-qr {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  padding: 6px;
}

.scp-profile-link-copy {
  display: grid;
  gap: 12px;
}

.scp-profile-link-copy strong {
  color: #fff;
  font-size: 20px;
  line-height: 1;
  font-weight: 950;
}

.scp-profile-copy-btn {
  min-height: 58px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border) 82%);
  border-radius: 999px;
  background: var(--surface-sunken, color-mix(in srgb, var(--panel2) 88%, var(--bg) 12%)) !important;
  color: #fff;
  font-size: 16px;
  font-weight: 950;
  cursor: pointer;
}

.scp-profile-copy-btn:hover, .scp-profile-copy-btn:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border) 42%);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: var(--focus-ring);
}

.scp-profile-page [data-profile-field] {
  cursor: pointer;
}

.scp-profile-page [data-profile-field]:hover, .scp-profile-page [data-profile-field]:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border) 52%);
}

.scp-profile-page.show-empty-profile-sections .scp-profile-reveal-btn {
  display: none;
}

.scp-profile-page.show-empty-profile-sections .scp-profile-strip.hidden.profile-empty-field, .scp-profile-page.show-empty-profile-sections .scp-profile-line.hidden.profile-empty-field {
  display: grid !important;
}

.scp-profile-page.show-empty-profile-sections .scp-profile-block.hidden.profile-empty-field {
  display: block !important;
}

.scp-profile-page.show-empty-profile-sections .profile-empty-field {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border) 64%);
  opacity: 0.84;
}

.scp-profile-page.show-empty-profile-sections .scp-profile-music-row.hidden.profile-empty-field {
  border-radius: 22px 22px 0 0;
}

.scp-profile-page.show-empty-profile-sections .scp-profile-music-row.hidden + .scp-profile-channel-row {
  margin-top: 0;
  border-top: 0;
  border-radius: 0 0 22px 22px;
}

.scp-profile-page.show-empty-profile-sections .scp-profile-music-row:has(+ .scp-profile-channel-row.hidden.profile-empty-field) {
  border-radius: 22px 22px 0 0;
}

@media (max-width: 768px) {
  .scp-profile-modal-shell {
    align-items: stretch;
    justify-content: stretch;
  }

  .scp-profile-page-modal {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    overflow: auto !important;
  }

  .scp-profile-card {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .scp-profile-strip {
    padding-inline: 34px 20px;
  }

  .scp-profile-block, .scp-profile-line {
    padding-inline: 24px 20px;
  }
}

.message-status {
  display: inline-flex;
  align-items: center;
  min-width: 16px;
  font-size: 12px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
}

.message-status.seen {
  color: var(--accent);
}

.scp-profile-page .scp-profile-strip, .scp-profile-page .scp-profile-block, .scp-profile-page .scp-profile-line, .scp-profile-page .scp-profile-share-row {
  margin-top: 8px;
  border-radius: 22px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border) 84%);
}

.scp-profile-page .scp-profile-strip.hidden, .scp-profile-page .scp-profile-block.hidden, .scp-profile-page .scp-profile-line.hidden {
  display: none !important;
}

.scp-profile-music-interactive {
  cursor: pointer;
}

.scp-profile-music-interactive:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.scp-profile-music-row.is-player-active {
  grid-template-columns: minmax(0, 1fr);
  padding: 12px 16px;
}

.scp-profile-inline-player {
  min-width: 0;
}

.scp-profile-inline-player .tg-profile-music-card {
  width: 100%;
  min-height: 58px;
  margin: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
}

.scp-profile-inline-player .player-title {
  color: #fff;
  font-size: 16px;
  font-weight: 950;
}

.scp-profile-inline-player .player-time {
  color: rgba(255, 255, 255, 0.74);
}

.scp-chat-profile-page .scp-profile-card {
  background: var(--chat-bg);
}

.scp-chat-profile-actions {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 2px;
  margin: 8px auto 0;
  padding: 0 12px;
}

.scp-chat-profile-action {
  width: 76px;
  min-height: 76px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 8px 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border) 82%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 90%, #000 10%);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  font-weight: 950;
  text-align: center;
  cursor: pointer;
}

.scp-chat-profile-action img {
  width: 32px;
  height: 32px;
  filter: var(--theme-icon-filter, none);
}

.scp-chat-profile-action strong, .scp-action-glyph {
  color: #fff;
  font-size: 28px;
  line-height: 1;
  font-weight: 950;
}

.scp-chat-profile-action.is-static {
  cursor: default;
}

.scp-chat-profile-action:hover, .scp-chat-profile-action:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border) 42%);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  outline: none;
}

.scp-chat-profile-share {
  margin-top: 8px;
}

@media (max-width: 420px) {
  .scp-chat-profile-actions {
    padding-inline: 8px;
  }

  .scp-chat-profile-action {
    width: 76px;
  }
}

#chatList.scp-main-menu {
  --scp-menu-bg: var(--bg);
  --scp-menu-panel: var(--panel);
  --scp-menu-panel-dark: var(--panel2);
  --scp-menu-line: color-mix(in srgb, var(--border) 82%, var(--accent) 18%);
  --scp-menu-accent: var(--accent);
  --scp-menu-online: #54ff00;
  background: var(--scp-mock-bg) !important;
  border-right-color: var(--scp-menu-line) !important;
  --scp-menu-accent-text: var(--accent-text);
  --scp-menu-muted: color-mix(in srgb, var(--text) 62%, var(--panel) 38%);
  --scp-menu-soft: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

#chatList.scp-main-menu .scp-main-menu-header-hidden {
  display: flex !important;
}

#chatList.scp-main-menu .list-search {
  order: 1;
  padding: 9px 10px 4px;
  border: 1px solid #564636;
  border-bottom: 0;
  border-radius: 0;
  background: var(--scp-menu-panel);
}

#chatList.scp-main-menu .list-search input {
  width: 100%;
  height: 76px !important;
  min-height: 76px !important;
  padding: 0 26px 0 130px !important;
  border: 0 !important;
  border-radius: 36px !important;
  background: var(--scp-mock-card) !important;
  color: var(--text) !important;
  font-size: 25px !important;
  font-weight: 950 !important;
  outline: none;
  box-shadow: none;
  letter-spacing: 0;
  border-color: color-mix(in srgb, var(--text) 42%, var(--accent) 18%) !important;
  line-height: 1 !important;
  text-transform: lowercase !important;
  padding-left: 82px !important;
}

#chatList.scp-main-menu .list-search input::placeholder {
  color: var(--text) !important;
  opacity: 1 !important;
}

#chatList.scp-main-menu .list-tabs {
  order: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 1px 10px 8px;
  border: 1px solid #564636;
  border-top: 0;
  border-radius: 0 0 22px 22px;
  background: var(--scp-menu-panel);
  overflow-x: auto;
  scrollbar-width: none;
}

#chatList.scp-main-menu .list-tabs::-webkit-scrollbar {
  display: none;
}

#chatList.scp-main-menu .scp-main-menu-button, #chatList.scp-main-menu .list-tab {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--scp-menu-panel-dark);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 950;
  text-transform: lowercase;
  box-shadow: none;
  letter-spacing: 0;
}

#chatList.scp-main-menu .list-tab.active, #chatList.scp-main-menu .scp-main-menu-button.active {
  background: var(--scp-menu-accent);
  color: #120f0b;
}

#chatList.scp-main-menu .scp-main-menu-plus, #chatList.scp-main-menu .create-chat-btn {
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  background: var(--scp-menu-accent);
  color: #120f0b;
  font-size: 17px;
  font-weight: 950;
  text-transform: none;
  transform: none;
}

#chatList.scp-main-menu .chat-folders-bar {
  order: 3;
  width: max-content;
  max-width: calc(100% - 84px);
  align-self: center;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 8px;
  padding: 5px 22px 6px;
  border: 1px solid #564636;
  border-top: 0;
  border-radius: 0 0 25px 25px;
  background: var(--scp-menu-panel);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 7px;
}

#chatList.scp-main-menu .chat-folders-bar::-webkit-scrollbar {
  display: none;
}

#chatList.scp-main-menu .chat-folders-bar button {
  min-width: 46px;
  min-height: 26px;
  height: 26px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--scp-menu-panel-dark);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 950;
  text-transform: lowercase;
  transform: none;
  letter-spacing: 0;
}

#chatList.scp-main-menu .chat-folders-bar button.active {
  background: var(--scp-menu-accent);
  color: #120f0b;
}

#chatList.scp-main-menu .chat-folders-bar .folder-create {
  width: 26px;
  min-width: 26px;
  padding: 0;
  background: var(--scp-menu-accent);
  color: #120f0b;
  font-size: 17px;
}

#chatList.scp-main-menu .scp-main-menu-music {
  order: 4;
  flex: 0 0 auto;
  padding: 0 11px 8px;
  background: var(--scp-menu-bg);
}

#chatList.scp-main-menu .scp-main-menu-music.hidden {
  display: none !important;
}

#chatList.scp-main-menu .scp-main-menu-music-card {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--scp-menu-line);
  border-radius: 20px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--scp-menu-accent) 20%, transparent), transparent 52%),
    var(--scp-menu-panel);
  box-shadow: none;
}

#chatList.scp-main-menu .scp-main-menu-music-card .player-play {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--scp-menu-accent);
  color: #15120f;
}

#chatList.scp-main-menu .scp-main-menu-music-card .player-body {
  min-width: 0;
  gap: 5px;
}

#chatList.scp-main-menu .scp-main-menu-music-card .player-title {
  color: #f5f2ed;
  font-size: 16px;
  line-height: 1;
  font-weight: 950;
}

#chatList.scp-main-menu .scp-main-menu-music-card .player-time {
  color: #aebec6;
  font-size: 10px;
  font-weight: 900;
}

#chatList.scp-main-menu .scp-main-menu-music-card .player-progress {
  height: 8px;
  background:
    linear-gradient(90deg,
      var(--scp-menu-accent) 0 var(--player-progress, 0%),
      rgba(255, 255, 255, 0.16) var(--player-progress, 0%) 100%);
}

#chatList.scp-main-menu #chatListContent {
  order: 2 !important;
  background: transparent !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  padding: 10px 12px calc(104px + env(safe-area-inset-bottom, 0px)) !important;
  padding-inline: 8px !important;
}

#chatList.scp-main-menu .chatItem {
  position: relative;
  min-height: 75px;
  padding: 13px 14px;
  gap: 9px;
  border-bottom: 1px solid #2a231b;
  background: transparent;
}

#chatList.scp-main-menu .chatItem::after {
  display: none;
}

#chatList.scp-main-menu .chatItem:hover, #chatList.scp-main-menu .chatItem.active {
  background: #201b14;
}

#chatList.scp-main-menu .chatItem .avatar {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background: #dedede;
  color: #1b1712;
  font-size: 16px;
  font-weight: 950;
  box-shadow: none;
  position: relative !important;
}

#chatList.scp-main-menu .chatItem .info {
  min-width: 0;
  display: grid;
  gap: 1px;
  padding-right: 10px;
}

#chatList.scp-main-menu .chatItem .name {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: #fff;
  font-size: 19px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
}

#chatList.scp-main-menu .chatItem .name > span:first-child {
  min-width: 0;
  max-width: 168px;
}

#chatList.scp-main-menu .chatItem .last-message {
  color: #a7b4b9;
  font-size: 10px;
  line-height: 1.05;
  font-weight: 950;
  letter-spacing: 0;
}

#chatList.scp-main-menu .chat-item-badges, #chatList.scp-main-menu .chat-item-actions, #chatList.scp-main-menu .chat-archive-quick {
  display: none !important;
}

#chatList.scp-main-menu .user-decorations {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

#chatList.scp-main-menu .emoji-status, #chatList.scp-main-menu .system-badge {
  width: 16px;
  min-width: 16px;
  height: 16px;
  border: 1px solid color-mix(in srgb, var(--scp-menu-accent) 52%, #fff 18%);
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--text) 72%, transparent), transparent 28%),
    color-mix(in srgb, var(--accent) 32%, var(--panel2) 68%) !important;
  color: var(--text) !important;
  font-size: 9px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--bg) 42%, transparent) !important;
  line-height: 1;
  font-weight: 950;
  border-color: color-mix(in srgb, var(--accent) 44%, var(--text) 20%) !important;
}

#chatList.scp-main-menu .chat-unread-badge {
  min-width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  background: var(--accent) !important;
  color: var(--accent-text) !important;
  font-size: 18px !important;
  font-weight: 950 !important;
  display: grid !important;
  place-items: center !important;
  width: 38px !important;
  border-radius: 50% !important;
}

#chatList.scp-main-menu .chat-presence-dot {
  width: 11px;
  height: 11px;
  margin-right: 2px;
  background: color-mix(in srgb, var(--text) 18%, var(--panel2) 82%) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bg) 36%, transparent) !important;
  opacity: 1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-color: color-mix(in srgb, var(--text) 16%, transparent) !important;
}

#chatList.scp-main-menu .chat-presence-dot.online {
  background: var(--scp-menu-online) !important;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--bg) 38%, transparent),
    0 0 12px color-mix(in srgb, var(--scp-menu-online) 34%, transparent) !important;
  opacity: 1;
  border-color: color-mix(in srgb, var(--scp-menu-online) 52%, var(--text) 12%) !important;
}

#chatList.scp-main-menu .empty-chat {
  color: #a7b4b9;
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 768px) {
  #chatList.scp-main-menu {
    border-right: 0;
  }

  #chatList.scp-main-menu .list-search {
    padding-top: 9px;
  }

  #chatList.scp-main-menu .list-tabs {
    justify-content: flex-start;
    padding-inline: 29px;
  }
}

@media (max-width: 390px) {
  #chatList.scp-main-menu .list-tabs {
    padding-inline: 28px;
  }

  #chatList.scp-main-menu .scp-main-menu-button, #chatList.scp-main-menu .list-tab {
    padding-inline: 10px;
    font-size: 9px;
  }
}

#chatList.scp-main-menu .scp-main-menu-top-island {
  order: 1 !important;
  display: grid;
  gap: 2px;
  margin: 12px 0 10px !important;
  padding: 0 24px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  overflow: hidden;
  padding-inline: 12px !important;
}

#chatList.scp-main-menu .scp-main-menu-top-island .list-search, #chatList.scp-main-menu .scp-main-menu-top-island .list-tabs {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#chatList.scp-main-menu .scp-main-menu-top-island .list-search {
  padding: 0;
}

#chatList.scp-main-menu .scp-main-menu-top-island .list-tabs {
  padding: 2px 20px 0;
}

#chatList.scp-main-menu .emoji-status:empty, #chatList.scp-main-menu .system-badge:empty {
  background: #dedede;
}

#chatList.scp-main-menu .scp-menu-feed-item {
  width: 100%;
  min-height: 75px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid #2a231b;
  background: transparent;
  color: #fff;
  text-align: left;
}

#chatList.scp-main-menu button.scp-menu-feed-item {
  cursor: pointer;
}

#chatList.scp-main-menu .scp-menu-feed-item .avatar {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background: #dedede;
  color: #1b1712;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 950;
}

#chatList.scp-main-menu .scp-menu-feed-item .info {
  min-width: 0;
  flex: 1;
}

#chatList.scp-main-menu .scp-menu-feed-body {
  margin-top: 5px;
  color: #d8d7ce;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 800;
}

#chatList.scp-main-menu .scp-menu-feed-meta {
  max-width: 84px;
  color: #a7b4b9;
  font-size: 10px;
  font-weight: 900;
  text-align: right;
}

.scp-profile-island {
  display: grid;
  gap: 2px;
  margin-top: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border) 84%);
  border-radius: 25px;
  background: color-mix(in srgb, var(--accent) 10%, var(--border) 90%) !important;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--accent) 16%, var(--border) 84%) !important;
}

.scp-profile-island > .scp-profile-strip, .scp-profile-island > .scp-profile-block, .scp-profile-island > .scp-profile-line, .scp-profile-island > .scp-profile-share-row {
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}

.scp-profile-island > .scp-profile-strip:first-child, .scp-profile-island > .scp-profile-block:first-child, .scp-profile-island > .scp-profile-line:first-child, .scp-profile-island > .scp-profile-share-row:first-child {
  border-radius: 25px 25px 0 0 !important;
}

.scp-profile-island > .scp-profile-strip:last-child, .scp-profile-island > .scp-profile-block:last-child, .scp-profile-island > .scp-profile-line:last-child, .scp-profile-island > .scp-profile-share-row:last-child {
  border-radius: 0 0 25px 25px !important;
}

.scp-profile-island > :only-child {
  border-radius: 25px !important;
}

.tg-settings-nav .tg-settings-nav-icon {
  display: none !important;
}

#chatList.scp-main-menu .scp-main-menu-top-island, #chatList.scp-main-menu .list-search, #chatList.scp-main-menu .list-tabs, #chatList.scp-main-menu .chat-folders-bar, #chatList.scp-main-menu .scp-main-menu-music-card {
  border-color: var(--scp-menu-line) !important;
  background: var(--scp-menu-panel) !important;
}

#chatList.scp-main-menu .scp-main-menu-button, #chatList.scp-main-menu .list-tab, #chatList.scp-main-menu .chat-folders-bar button {
  background: var(--scp-menu-panel-dark) !important;
  color: var(--text) !important;
}

#chatList.scp-main-menu .list-tab.active, #chatList.scp-main-menu .scp-main-menu-button.active, #chatList.scp-main-menu .chat-folders-bar button.active, #chatList.scp-main-menu .scp-main-menu-music-card .player-play, #chatList.scp-main-menu .scp-main-menu-plus, #chatList.scp-main-menu .create-chat-btn, #chatList.scp-main-menu .chat-folders-bar .folder-create, #chatList.scp-main-menu .chat-unread-badge {
  background: var(--scp-menu-accent) !important;
  color: var(--scp-menu-accent-text) !important;
}

#chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item {
  border-bottom-color: var(--scp-menu-line) !important;
  color: var(--text) !important;
  display: grid !important;
  grid-template-columns: 76px minmax(0, 1fr) 56px !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 88px !important;
  padding: 12px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: var(--scp-mock-card) !important;
  overflow: hidden !important;
}

#chatList.scp-main-menu .chatItem:hover, #chatList.scp-main-menu .chatItem.active, #chatList.scp-main-menu button.scp-menu-feed-item:hover, #chatList.scp-main-menu button.scp-menu-feed-item:focus-visible {
  background: color-mix(in srgb, var(--scp-mock-card) 88%, var(--accent) 12%) !important;
}

#chatList.scp-main-menu .chatItem .avatar, #chatList.scp-main-menu .scp-menu-feed-item .avatar, #chatList.scp-main-menu .emoji-status:empty, #chatList.scp-main-menu .system-badge:empty {
  background: var(--avatar-bg) !important;
  color: var(--avatar-text) !important;
}

#chatList.scp-main-menu .chatItem .name, #chatList.scp-main-menu .scp-menu-feed-item strong {
  color: var(--text) !important;
}

#chatList.scp-main-menu .chatItem .last-message, #chatList.scp-main-menu .empty-chat, #chatList.scp-main-menu .scp-menu-feed-body, #chatList.scp-main-menu .scp-menu-feed-meta {
  color: var(--scp-menu-muted) !important;
}

.scp-profile-page, .scp-chat-profile-page {
  color: var(--text);
}

.scp-profile-strip, .scp-profile-block, .scp-profile-line, .scp-profile-share-row, .scp-chat-profile-action {
  border-color: color-mix(in srgb, var(--accent) 16%, var(--border) 84%) !important;
  background: var(--surface-raised, color-mix(in srgb, var(--panel) 92%, var(--bg) 8%)) !important;
  color: var(--text) !important;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 7%, transparent);
}

.scp-profile-thumb, .scp-profile-avatar {
  background-color: var(--avatar-bg) !important;
  color: var(--avatar-text) !important;
}

.scp-profile-strip-text, .scp-profile-strip-text strong, .scp-profile-strip-text a, .scp-profile-block h2, .scp-profile-block p, .scp-profile-birth-row strong, .scp-profile-badges-row strong, .scp-profile-link-copy strong, .scp-profile-copy-btn, .scp-profile-inline-player .player-title, .scp-chat-profile-action, .scp-chat-profile-action strong, .scp-action-glyph {
  color: var(--text) !important;
}

.scp-profile-strip-text span, .scp-profile-inline-player .player-time {
  color: color-mix(in srgb, var(--text) 72%, var(--panel) 28%) !important;
}

.scp-profile-copy-btn:hover, .scp-profile-copy-btn:focus-visible, .scp-chat-profile-action:hover, .scp-chat-profile-action:focus-visible {
  background: color-mix(in srgb, var(--accent) 14%, var(--panel) 86%) !important;
}

@media (max-width: 768px) {
  body {
    font-size: calc(18px * var(--font-scale, 1));
  }

  #chatHeader {
    height: 68px;
    gap: 10px;
    padding: 0 12px;
  }

  .chat-user {
    gap: 10px;
  }

  .chat-user .avatar {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    font-size: 16px;
  }

  .chat-user .name {
    max-width: 46vw;
    font-size: 18px;
    line-height: 1.08;
  }

  .chat-user .status {
    max-width: 46vw;
    font-size: 13px;
    line-height: 1.15;
  }

  .chat-actions .action-btn, .composer-media-btn, .send-btn, .back-btn, .profile-mobile-btn, .settings-mobile-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .chat-actions .action-btn img, .composer-media-btn img, .send-btn img {
    width: 21px;
    height: 21px;
  }

  #messages {
    padding: 14px;
    gap: 10px;
  }

  .message {
    max-width: min(88%, 460px);
    padding: 11px 13px;
    border-radius: 18px;
    font-size: 15px;
  }

  .message.out {
    max-width: min(84%, 430px);
  }

  .message .sender {
    font-size: 12px;
  }

  .message .content {
    font-size: 15px;
    line-height: 1.42;
  }

  .message .meta, .message-status {
    font-size: 13px;
  }

  #messageInput {
    gap: 9px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  #textInput {
    min-height: 44px;
    padding: 11px 13px;
    font-size: 16px;
    line-height: 1.35;
  }

  #chatList.scp-main-menu .scp-main-menu-top-island {
    gap: 6px;
    padding: 12px;
  }

  #chatList.scp-main-menu .list-search input {
    height: 48px;
    min-height: 48px;
    padding: 0 18px;
    font-size: 14px;
  }

  #chatList.scp-main-menu .list-tabs {
    gap: 6px;
    padding: 4px 14px 0;
  }

  #chatList.scp-main-menu .scp-main-menu-button, #chatList.scp-main-menu .list-tab, #chatList.scp-main-menu .chat-folders-bar button {
    height: 36px;
    min-height: 36px;
    padding: 0 15px;
    font-size: 12px;
  }

  #chatList.scp-main-menu .scp-main-menu-plus, #chatList.scp-main-menu .create-chat-btn, #chatList.scp-main-menu .chat-folders-bar .folder-create {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    font-size: 20px;
  }

  #chatList.scp-main-menu .chat-folders-bar {
    max-width: calc(100% - 48px);
    gap: 6px;
    padding: 7px 20px 8px;
  }

  #chatList.scp-main-menu .chat-folders-bar button {
    min-width: 58px;
  }

  #chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item {
    min-height: 92px;
    gap: 12px;
    padding: 16px;
  }

  #chatList.scp-main-menu .chatItem .avatar, #chatList.scp-main-menu .scp-menu-feed-item .avatar {
    width: 58px;
    height: 58px;
    font-size: 18px;
  }

  #chatList.scp-main-menu .chatItem .name {
    gap: 6px;
    font-size: 22px;
  }

  #chatList.scp-main-menu .chatItem .name > span:first-child {
    max-width: calc(100vw - 176px);
  }

  #chatList.scp-main-menu .chatItem .last-message {
    font-size: 13px;
    line-height: 1.16;
  }

  #chatList.scp-main-menu .scp-menu-feed-body {
    font-size: 14px;
  }

  #chatList.scp-main-menu .scp-menu-feed-meta {
    font-size: 12px;
  }

  #chatList.scp-main-menu .emoji-status, #chatList.scp-main-menu .system-badge {
    width: 18px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
  }

  #chatList.scp-main-menu .chat-presence-dot {
    width: 13px;
    height: 13px;
  }

  #chatList.scp-main-menu .chat-unread-badge {
    min-width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .tg-settings-nav button {
    min-width: 220px;
    min-height: 54px;
    padding: 12px 14px;
    font-size: 15px;
  }

  .tg-settings-panel-head h3 {
    font-size: 25px;
  }

  .tg-settings-panel-head p, .tg-settings-group-title span, .tg-setting-hint, .tg-settings-row-text small {
    font-size: 13px;
  }

  .tg-settings-group-title strong, .tg-setting-control label, .tg-settings-row-text strong {
    font-size: 16px;
  }

  .tg-setting-control input, .tg-setting-control select {
    min-height: 46px;
    font-size: 15px;
  }

  .tg-settings-row {
    min-height: 68px;
    padding: 14px 16px;
    gap: 12px;
  }

  .tg-settings-row-icon {
    width: 26px;
    height: 26px;
  }

  .tg-settings-row-value {
    font-size: 14px;
  }

  .scp-profile-back {
    min-height: 40px;
    padding: 6px 12px;
    font-size: 17px;
  }

  .scp-profile-reveal-btn {
    width: 44px;
    height: 44px;
    font-size: 27px;
  }

  .scp-profile-avatar {
    width: 108px;
    height: 108px;
    font-size: 34px;
  }

  .scp-profile-name {
    font-size: 28px;
  }

  .scp-profile-username {
    font-size: 20px;
  }

  .scp-profile-strip {
    grid-template-columns: 58px minmax(0, 1fr);
    min-height: 88px;
    gap: 13px;
    padding: 16px 24px;
  }

  .scp-profile-thumb {
    width: 56px;
    height: 56px;
    font-size: 20px;
  }

  .scp-profile-strip-text strong, .scp-profile-strip-text a, .scp-profile-block h2, .scp-profile-link-copy strong {
    font-size: 22px;
  }

  .scp-profile-strip-text span {
    font-size: 17px;
  }

  .scp-profile-block p {
    font-size: 20px;
  }

  .scp-profile-birth-row strong {
    font-size: 21px;
  }

  .scp-profile-share-row {
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: 160px;
    gap: 12px;
    padding: 22px 20px;
  }

  .scp-profile-qr {
    width: 106px;
    height: 106px;
  }

  .scp-profile-copy-btn {
    min-height: 60px;
    font-size: 17px;
  }

  .scp-chat-profile-action {
    width: 84px;
    min-height: 84px;
    font-size: 12px;
  }

  .scp-chat-profile-action img {
    width: 34px;
    height: 34px;
  }

  .scp-chat-profile-action strong, .scp-action-glyph {
    font-size: 31px;
  }
}

@media (max-width: 420px) {
  .chat-user .name, .chat-user .status {
    max-width: 40vw;
  }

  #chatList.scp-main-menu .scp-main-menu-button, #chatList.scp-main-menu .list-tab, #chatList.scp-main-menu .chat-folders-bar button {
    padding-inline: 13px;
    font-size: 12px;
  }

  #chatList.scp-main-menu .chatItem .name {
    font-size: 21px;
  }

  .scp-profile-strip {
    padding-inline: 20px;
  }

  .scp-profile-share-row {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .scp-profile-qr {
    width: 98px;
    height: 98px;
  }
}

@media (max-width: 768px) {
  #chatList.scp-main-menu .scp-main-menu-top-island {
    flex: 0 0 auto;
    gap: 4px;
    margin: 0;
    padding: 9px 10px 7px;
    border-radius: 0 0 24px 24px;
  }

  #chatList.scp-main-menu .scp-main-menu-top-island .list-search {
    padding: 0;
  }

  #chatList.scp-main-menu .list-search input {
    height: 40px;
    min-height: 40px;
    padding: 0 16px;
    font-size: 12px;
  }

  #chatList.scp-main-menu .scp-main-menu-top-island .list-tabs, #chatList.scp-main-menu .list-tabs {
    gap: 4px;
    justify-content: center;
    padding: 1px 18px 0;
  }

  #chatList.scp-main-menu .scp-main-menu-button, #chatList.scp-main-menu .list-tab, #chatList.scp-main-menu .chat-folders-bar button {
    height: 26px;
    min-height: 26px;
    padding: 0 12px;
    font-size: 10px;
  }

  #chatList.scp-main-menu .scp-main-menu-plus, #chatList.scp-main-menu .create-chat-btn, #chatList.scp-main-menu .chat-folders-bar .folder-create {
    width: 26px;
    min-width: 26px;
    height: 26px;
    min-height: 26px;
    font-size: 17px;
  }

  #chatList.scp-main-menu .chat-folders-bar {
    flex: 0 0 auto;
    max-width: calc(100% - 108px);
    gap: 4px;
    margin: -1px auto 4px;
    padding: 5px 22px 6px;
  }

  #chatList.scp-main-menu .chat-folders-bar button {
    min-width: 46px;
  }

  #chatList.scp-main-menu #chatListContent {
    padding-top: 0;
  }

  #chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item {
    min-height: 75px;
    gap: 9px;
    padding: 13px 14px;
  }

  #chatList.scp-main-menu .chatItem .avatar, #chatList.scp-main-menu .scp-menu-feed-item .avatar {
    width: 50px;
    height: 50px;
    font-size: 16px;
  }

  #chatList.scp-main-menu .chatItem .name {
    gap: 5px;
    font-size: 19px;
  }

  #chatList.scp-main-menu .chatItem .name > span:first-child {
    max-width: calc(100vw - 160px);
  }

  #chatList.scp-main-menu .chatItem .last-message {
    font-size: 11px;
    line-height: 1.08;
  }

  #chatList.scp-main-menu .chat-presence-dot {
    width: 11px;
    height: 11px;
  }

  #chatList.scp-main-menu .chat-unread-badge {
    min-width: 22px;
    height: 22px;
    font-size: 11px;
  }
}

.scp-mobile-tab-bar {
  display: none;
}

@media (max-width: 768px) {
  :root {
    --scp-mobile-bg: #201b16;
    --scp-mobile-panel: #302a22;
    --scp-mobile-line: #504539;
    --scp-mobile-cream: #f5f2ed;
    --scp-mobile-muted: #9fb9c6;
    --scp-mobile-accent: #ffac43;
    --scp-mobile-bubble: #c9a675;
  }

  html, body, #layout, #chat, #chatList {
    background: var(--scp-mobile-bg) !important;
  }

  body {
    overflow: hidden;
  }

  #layout {
    min-height: 100svh;
  }

  .scp-mobile-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2200;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    height: 75px;
    padding: 8px 28px 10px;
    border: 1px solid var(--scp-mobile-line);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    background: var(--scp-mobile-panel);
    box-shadow: 0 -12px 22px rgba(0, 0, 0, 0.22);
  }

  .scp-mobile-tab-bar.hidden, body.mobile-chat-open:not(.settings-home-mode):not(.profile-home-mode) .scp-mobile-tab-bar {
    display: none !important;
  }

  .scp-mobile-tab-button {
    display: grid;
    place-items: center;
    width: 100%;
    height: 58px;
    border: 0;
    background: transparent;
    color: var(--scp-mobile-cream);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .scp-mobile-tab-button.active {
    color: var(--scp-mobile-accent);
  }

  .scp-mobile-tab-icon {
    position: relative;
    display: block;
    width: 56px;
    height: 56px;
    color: inherit;
  }

  .scp-mobile-tab-icon-chats::before {
    content: "";
    position: absolute;
    inset: 3px 5px 5px 5px;
    border-radius: 26px 26px 26px 2px;
    background: currentColor;
  }

  .scp-mobile-tab-icon-settings::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 7px;
    width: 42px;
    height: 42px;
    background: currentColor;
    clip-path: polygon(
        44% 0,
        56% 0,
        61% 18%,
        75% 10%,
        86% 21%,
        78% 36%,
        100% 44%,
        100% 56%,
        78% 64%,
        86% 79%,
        75% 90%,
        61% 82%,
        56% 100%,
        44% 100%,
        39% 82%,
        25% 90%,
        14% 79%,
        22% 64%,
        0 56%,
        0 44%,
        22% 36%,
        14% 21%,
        25% 10%,
        39% 18%
      );
  }

  .scp-mobile-tab-icon-settings::after {
    content: "";
    position: absolute;
    left: 20px;
    top: 20px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--scp-mobile-panel);
  }

  .scp-mobile-tab-icon-profile::before, .scp-mobile-tab-icon-profile::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: currentColor;
  }

  .scp-mobile-tab-icon-profile::before {
    top: 4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
  }

  .scp-mobile-tab-icon-profile::after {
    bottom: 5px;
    width: 42px;
    height: 27px;
    border-radius: 22px 22px 6px 6px;
  }

  .scp-mobile-tab-icon-chats {
    --scp-tab-icon-url: url("icons/tab-chats.svg");
  }

  .scp-mobile-tab-icon-settings {
    --scp-tab-icon-url: url("icons/tab-settings.svg");
  }

  .scp-mobile-tab-icon-profile {
    --scp-tab-icon-url: url("icons/tab-profile.svg");
  }

  .scp-mobile-tab-icon-chats::before, .scp-mobile-tab-icon-settings::before, .scp-mobile-tab-icon-profile::before {
    content: "";
    position: absolute;
    inset: 3px;
    width: auto;
    height: auto;
    border-radius: 0;
    background: currentColor !important;
    clip-path: none;
    -webkit-mask: var(--scp-tab-icon-url) center / contain no-repeat;
    mask: var(--scp-tab-icon-url) center / contain no-repeat;
    transform: none;
  }

  .scp-mobile-tab-icon-settings::after, .scp-mobile-tab-icon-profile::after {
    content: none !important;
  }

  #chatList.scp-main-menu {
    min-height: 100svh;
    padding-bottom: 88px;
  }

  #chatList.scp-main-menu .scp-main-menu-top-island {
    gap: 8px;
    min-height: 59px;
    padding: 9px 10px 8px;
    border: 1px solid var(--scp-mobile-line);
    border-top: 0;
    border-radius: 0 0 25px 25px;
    background: var(--scp-mobile-panel);
  }

  #chatList.scp-main-menu .scp-main-menu-top-island .list-tabs, #chatList.scp-main-menu .list-tabs, #chatList.scp-main-menu .create-chat-btn, #chatList.scp-main-menu .profile-mobile-btn, #chatList.scp-main-menu .settings-mobile-btn {
    display: none !important;
  }

  #chatList.scp-main-menu .scp-main-menu-top-island .list-search {
    width: 100%;
    padding: 0;
  }

  #chatList.scp-main-menu .list-search input {
    width: 100%;
    height: 41px;
    min-height: 41px;
    border: 1px solid #9aaeba;
    border-radius: 22px;
    background: #15120f !important;
    color: var(--scp-mobile-cream) !important;
    padding: 0 18px;
    font-size: 11px;
    font-weight: 900;
    border-color: #9aaeba !important;
  }

  #chatList.scp-main-menu .list-search input::placeholder {
    color: #9fb9c6;
    opacity: 1;
  }

  #chatList.scp-main-menu .chat-folders-bar {
    justify-content: center;
    width: min(305px, calc(100vw - 82px));
    max-width: none;
    min-height: 29px;
    gap: 5px;
    margin: 0 auto 11px;
    padding: 4px 33px 6px;
    border: 1px solid var(--scp-mobile-line);
    border-top: 0;
    border-radius: 0 0 25px 25px;
    background: var(--scp-mobile-panel);
    overflow: hidden;
  }

  #chatList.scp-main-menu .chat-folders-bar button {
    width: 48px;
    min-width: 48px;
    height: 24px;
    min-height: 24px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: #15120f !important;
    color: var(--scp-mobile-cream) !important;
    font-size: 10px;
    font-weight: 950;
    box-shadow: none;
  }

  #chatList.scp-main-menu .chat-folders-bar button.active {
    background: var(--scp-mobile-accent) !important;
    color: #15120f !important;
  }

  #chatList.scp-main-menu .chat-folders-bar .folder-create {
    display: none;
  }

  #chatList.scp-main-menu #chatListContent {
    padding: 0 0 90px;
    overflow-y: auto;
  }

  #chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item {
    position: relative;
    min-height: 100px;
    gap: 15px;
    padding: 12px 38px 12px 11px;
    border: 0;
    border-bottom: 1px solid var(--scp-mobile-line);
    border-radius: 0;
    background: var(--scp-mobile-panel);
    box-shadow: none;
  }

  #chatList.scp-main-menu .chatItem:first-child, #chatList.scp-main-menu .scp-menu-feed-item:first-child {
    border-radius: 24px 24px 0 0;
  }

  #chatList.scp-main-menu .chatItem:hover, #chatList.scp-main-menu .chatItem.active, #chatList.scp-main-menu .scp-menu-feed-item:hover {
    transform: none;
    background: var(--scp-mobile-panel) !important;
  }

  #chatList.scp-main-menu .chatItem::before, #chatList.scp-main-menu .chatItem::after, #chatList.scp-main-menu .scp-menu-feed-item::after {
    display: none !important;
  }

  #chatList.scp-main-menu .chatItem .avatar, #chatList.scp-main-menu .scp-menu-feed-item .avatar {
    width: 75px;
    height: 75px;
    border-radius: 25px;
    background: #d7d7d7 !important;
    color: #ffffff !important;
    font-size: 26px;
    font-weight: 950;
  }

  #chatList.scp-main-menu .chatItem .info, #chatList.scp-main-menu .scp-menu-feed-item .info {
    align-self: center;
    min-width: 0;
    gap: 1px;
  }

  #chatList.scp-main-menu .chatItem .name, #chatList.scp-main-menu .scp-menu-feed-item .name {
    min-height: 30px;
    gap: 5px;
    color: var(--scp-mobile-cream);
    font-size: 28px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: 0;
  }

  #chatList.scp-main-menu .chatItem .name > span:first-child, #chatList.scp-main-menu .scp-menu-feed-item .name > span:first-child {
    max-width: calc(100vw - 178px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #chatList.scp-main-menu .chatItem .last-message, #chatList.scp-main-menu .scp-menu-feed-item .last-message {
    color: var(--scp-mobile-muted) !important;
    font-size: 11px;
    line-height: 1.1;
    font-weight: 950;
  }

  #chatList.scp-main-menu .chat-item-badges, #chatList.scp-main-menu .chat-item-actions, #chatList.scp-main-menu .chat-archive-quick {
    display: none !important;
  }

  #chatList.scp-main-menu .user-decorations {
    gap: 3px;
    transform: translateY(-1px);
  }

  #chatList.scp-main-menu .emoji-status, #chatList.scp-main-menu .system-badge {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    font-size: 11px;
    line-height: 20px;
    color: var(--scp-mobile-cream) !important;
    box-shadow: none !important;
  }

  #chatList.scp-main-menu .system-badge-supporter {
    background: #7c5f36;
  }

  #chatList.scp-main-menu .system-badge-confirmed {
    background: #8a7044;
  }

  #chatList.scp-main-menu .chat-presence-dot {
    position: absolute;
    right: 24px;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1px solid var(--scp-mobile-line);
    border-radius: 50%;
    background: #4c4540 !important;
    transform: translateY(-50%);
    box-shadow: none !important;
    border-color: var(--scp-mobile-line) !important;
  }

  #chatList.scp-main-menu .chat-presence-dot.online {
    border: 5px solid #15120f;
    background: #00ff35 !important;
    box-shadow: none !important;
    border-color: #15120f !important;
  }

  #chatList.scp-main-menu .chat-unread-badge {
    right: 20px;
    bottom: 15px;
    background: var(--scp-mobile-accent);
    color: #15120f;
  }

  body.settings-home-mode #chat {
    min-height: 100svh;
    padding-bottom: 75px;
  }

  body.settings-home-mode #chatHeader, body.settings-home-mode #messages, body.settings-home-mode #messageInput, body.settings-home-mode #typingBar, body.settings-home-mode #replyBar, body.settings-home-mode #editBar, body.settings-home-mode #pinnedBar, body.settings-home-mode #chatSearchBar {
    display: none !important;
  }

  body.settings-home-mode #settingsHome {
    display: block;
    min-height: calc(100svh - 75px);
    padding: 0 0 80px;
    overflow-y: auto;
    background: var(--scp-mobile-bg);
  }

  body.settings-home-mode #settingsHome #settingsModal {
    position: static;
    display: block;
    width: 100%;
    height: auto;
    padding: 0;
    background: transparent;
  }

  body.settings-home-mode #settingsHome #settingsModal.hidden {
    display: none !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-content {
    width: 100%;
    max-width: none;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header, body.settings-home-mode #settingsHome #settingsModal .tg-settings-panels, body.settings-home-mode #settingsHome #settingsModal .modal-footer {
    display: none !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .modal-header {
    position: sticky;
    top: 0;
    z-index: 12;
    display: flex !important;
    min-height: 50px;
    padding: 0 12px;
    border: 0;
    border-bottom: 1px solid var(--scp-mobile-line);
    background: var(--scp-mobile-panel);
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .modal-header h2 {
    min-width: 0;
    color: var(--scp-mobile-cream);
    font-size: 24px;
    line-height: 1;
    font-weight: 950;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .modal-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    color: var(--scp-mobile-cream);
    font-size: 34px;
    line-height: 1;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .tg-settings-panels {
    display: block !important;
    min-height: 0;
    padding: 0 0 22px;
    overflow: visible;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-nav, body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-nav.settings-scroll-nav {
    display: none !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-panel.active {
    display: grid;
    gap: 8px;
    padding: 10px 0 0;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-panel-head {
    display: none;
  }

  body.settings-home-mode #settingsHome .tg-settings-shell {
    display: block !important;
    min-height: 0;
    padding: 0;
    background: transparent;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-body {
    display: block !important;
    max-height: none !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav, body.settings-home-mode #settingsHome .tg-settings-nav.settings-scroll-nav {
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    max-width: none !important;
    max-height: none;
    min-height: 0;
    gap: 0;
    margin: 0 !important;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
    scroll-snap-type: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 50px;
    height: 50px;
    padding: 0 16px;
    border: 0;
    border-bottom: 1px solid var(--scp-mobile-line);
    border-radius: 0;
    background: var(--scp-mobile-panel);
    color: var(--scp-mobile-cream);
    font-size: 24px;
    line-height: 1;
    font-weight: 950;
    text-align: center;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button.active, body.settings-home-mode #settingsHome .tg-settings-nav button:hover {
    transform: none;
    background: var(--scp-mobile-panel);
    color: var(--scp-mobile-cream);
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon, body.settings-home-mode #settingsHome .tg-settings-nav button small, body.settings-home-mode #settingsHome .tg-settings-nav button img, body.settings-home-mode #settingsHome .tg-settings-nav button em {
    display: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button span:not(.tg-settings-nav-icon) {
    display: block !important;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.profile-home-mode #chat {
    min-height: 100svh;
    padding-bottom: 75px;
    overflow: hidden;
  }

  body.profile-home-mode #chatHeader, body.profile-home-mode #messages, body.profile-home-mode #messageInput, body.profile-home-mode #typingBar, body.profile-home-mode #replyBar, body.profile-home-mode #editBar, body.profile-home-mode #pinnedBar, body.profile-home-mode #chatSearchBar {
    display: none !important;
  }

  #profileHome.scp-profile-page {
    display: block;
    height: calc(100svh - 75px);
    padding: 0 0 18px;
    overflow-y: auto;
    background: var(--scp-mobile-bg);
  }

  #profileHome.scp-profile-peer {
    height: 100svh;
    padding-bottom: 18px;
  }

  #profileHome .scp-profile-card {
    display: flex;
    width: 100%;
    max-width: none;
    min-height: 100%;
    gap: 0;
    padding: 0;
    background: transparent;
  }

  #profileHome .scp-profile-hero {
    position: relative;
    order: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 225px;
    height: 225px;
    margin: 0 0 8px;
    padding: 14px 16px 18px;
    border: 1px solid var(--scp-mobile-line);
    border-top: 0;
    border-radius: 0 0 25px 25px;
    overflow: hidden;
    background:
        linear-gradient(rgba(32, 27, 22, 0.38), rgba(32, 27, 22, 0.38)),
        var(--profile-wallpaper),
        linear-gradient(145deg, #3a3936, #202020);
    background-size: cover;
    background-position: center;
  }

  #profileHome .scp-profile-hero::before {
    content: "";
    position: absolute;
    inset: -18px;
    background: inherit;
    filter: blur(6px);
    transform: scale(1.04);
  }

  #profileHome .scp-profile-hero > * {
    position: relative;
    z-index: 1;
  }

  #profileHome .scp-profile-back, #profileHome .scp-profile-reveal-btn {
    display: inline-grid !important;
  }

  #profileHome .scp-profile-edit-row {
    display: none !important;
  }

  #profileHome.scp-profile-peer .scp-profile-back, #profileHome.scp-chat-profile-page .scp-profile-back {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.34);
    color: #fff;
    box-shadow: none;
  }

  #profileHome.scp-profile-peer .scp-profile-back span, #profileHome.scp-chat-profile-page .scp-profile-back span {
    display: none;
  }

  #profileHome.scp-profile-peer .scp-profile-back img, #profileHome.scp-chat-profile-page .scp-profile-back img {
    width: 22px;
    height: 22px;
    filter: brightness(0) invert(1);
  }

  #profileHome .scp-profile-avatar {
    width: 100px;
    height: 100px;
    border: 0;
    border-radius: 22px;
    background: #d7d7d7;
    color: #ffffff;
    font-size: 34px;
    box-shadow: none;
  }

  #profileHome .scp-profile-avatar .chat-presence-dot, #profileHome .scp-profile-avatar::after {
    border-color: #15120f;
  }

  #profileHome .scp-profile-title-wrap {
    align-items: center;
    gap: 0;
    margin-top: 5px;
    text-align: center;
  }

  #profileHome .scp-profile-name {
    color: var(--scp-mobile-cream);
    font-size: 24px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }

  #profileHome .scp-profile-username {
    color: var(--scp-mobile-cream);
    font-size: 18px;
    line-height: 1.1;
    font-weight: 950;
    opacity: 0.95;
  }

  #profileHome .user-decorations {
    justify-content: center;
    gap: 3px;
  }

  #profileHome .emoji-status, #profileHome .system-badge {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 22px;
  }

  #profileHome .scp-profile-island {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0 0 8px;
    border: 1px solid var(--scp-mobile-line);
    border-radius: 22px;
    background: var(--scp-mobile-panel);
    overflow: hidden;
  }

  #profileHome.scp-profile-own .scp-profile-island-media {
    order: 1;
  }

  #profileHome.scp-profile-own .scp-profile-island-about {
    order: 2;
  }

  #profileHome.scp-profile-own .scp-profile-island-share {
    order: 3;
  }

  #profileHome.scp-profile-peer .scp-profile-island-about {
    order: 1;
  }

  #profileHome.scp-profile-peer .scp-profile-island-media {
    order: 2;
  }

  #profileHome.scp-profile-peer .scp-profile-island-share {
    order: 3;
  }

  #profileHome.scp-profile-peer .scp-profile-badges-row {
    order: 1;
    min-height: 45px;
    justify-content: flex-start;
    padding: 0 24px;
  }

  #profileHome.scp-profile-peer .scp-profile-bio-row {
    order: 2;
  }

  #profileHome.scp-profile-peer .scp-profile-birth-row {
    order: 3;
  }

  #profileHome .scp-profile-strip, #profileHome .scp-profile-block, #profileHome .scp-profile-line, #profileHome .scp-profile-share-row {
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #profileHome .scp-profile-strip + .scp-profile-strip, #profileHome .scp-profile-block + .scp-profile-line, #profileHome .scp-profile-line + .scp-profile-line {
    border-top: 1px solid var(--scp-mobile-line);
  }

  #profileHome .scp-profile-strip {
    display: grid;
    grid-template-columns: 47px minmax(0, 1fr);
    align-items: center;
    min-height: 75px;
    gap: 16px;
    padding: 14px 35px;
  }

  #profileHome .scp-profile-thumb {
    width: 47px;
    height: 47px;
    border-radius: 9px;
    background: #d7d7d7;
  }

  #profileHome .scp-profile-strip-text {
    gap: 0;
  }

  #profileHome .scp-profile-strip-text strong, #profileHome .scp-profile-strip-text a, #profileHome .scp-profile-link-copy strong, #profileHome .scp-profile-block h2, #profileHome .scp-profile-line strong {
    color: var(--scp-mobile-cream);
    font-size: 22px;
    line-height: 1.05;
    font-weight: 950;
    letter-spacing: 0;
  }

  #profileHome .scp-profile-strip-text span, #profileHome .scp-profile-block p {
    color: var(--scp-mobile-cream);
    font-size: 18px;
    line-height: 1.18;
    font-weight: 950;
  }

  #profileHome .scp-profile-block {
    min-height: 147px;
    padding: 17px 24px 18px;
  }

  #profileHome .scp-profile-block h2 {
    margin: 0 0 13px;
  }

  #profileHome .scp-profile-block p {
    max-width: 330px;
    margin: 0;
  }

  #profileHome .scp-profile-line {
    display: flex;
    align-items: center;
    min-height: 77px;
    padding: 0 24px;
  }

  #profileHome .scp-profile-badges-row {
    min-height: 55px;
    justify-content: center;
    text-align: center;
  }

  #profileHome .scp-profile-badges-row strong {
    font-size: 17px;
  }

  #profileHome .scp-profile-share-row {
    display: grid;
    grid-template-columns: 94px minmax(0, 1fr);
    align-items: center;
    min-height: 148px;
    gap: 13px;
    padding: 22px 19px;
  }

  #profileHome .scp-profile-qr {
    width: 94px;
    height: 94px;
    border-radius: 11px;
    background: #ffffff;
  }

  #profileHome .scp-profile-link-copy {
    gap: 9px;
  }

  #profileHome .scp-profile-copy-btn {
    min-height: 56px;
    border: 1px solid var(--scp-mobile-line);
    border-radius: 28px;
    background: transparent;
    color: var(--scp-mobile-cream);
    font-size: 16px;
    font-weight: 950;
  }

  body.mobile-chat-open #chat {
    background: var(--scp-mobile-bg) !important;
  }

  body.mobile-chat-open:not(.profile-home-mode) #profileHome, body.mobile-chat-open:not(.settings-home-mode) #settingsHome, body.mobile-chat-open:not(.news-home-mode) #newsHome, body.mobile-chat-open:not(.calls-home-mode) #callsHome {
    display: none !important;
  }

  body.mobile-chat-open #chatHeader {
    min-height: 100px;
    height: 100px;
    padding: 12px 12px 12px 62px;
    border: 0;
    border-radius: 0 0 25px 25px;
    background: var(--scp-mobile-panel);
    box-shadow: none;
  }

  body.mobile-chat-open #backBtn {
    position: absolute;
    left: 10px;
    top: 28px;
    z-index: 4;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid #9aaeba;
    border-radius: 50%;
    background: #15120f;
    opacity: 1;
    box-shadow: none;
  }

  body.mobile-chat-open #backBtn img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
  }

  body.mobile-chat-open .chat-user {
    gap: 12px;
  }

  body.mobile-chat-open .chat-user .avatar {
    width: 75px;
    height: 75px;
    border-radius: 25px;
    background: #d7d7d7;
    color: #ffffff;
    font-size: 26px;
    font-weight: 950;
  }

  body.mobile-chat-open .chat-user .name {
    max-width: calc(100vw - 174px);
    color: var(--scp-mobile-cream);
    font-size: 28px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: 0;
  }

  body.mobile-chat-open .chat-user .status {
    max-width: calc(100vw - 174px);
    color: var(--scp-mobile-muted);
    font-size: 13px;
    line-height: 1.05;
    font-weight: 950;
  }

  body.mobile-chat-open #chatActions {
    display: none;
  }

  body.mobile-chat-open #messages {
    padding: 35px 13px 79px;
    background: var(--scp-mobile-bg);
  }

  body.mobile-chat-open .message.in, body.mobile-chat-open .message.out {
    max-width: min(66vw, 270px);
    min-width: 64px;
    border: 0;
    border-radius: 22px;
    background: var(--scp-mobile-bubble);
    color: #15120f;
    box-shadow: none;
  }

  body.mobile-chat-open .message.in {
    border-bottom-left-radius: 3px;
  }

  body.mobile-chat-open .message.out {
    border-bottom-right-radius: 3px;
  }

  body.mobile-chat-open #messageInput {
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 57px;
    padding: 7px 10px 9px;
    border: 1px solid var(--scp-mobile-line);
    border-radius: 20px 20px 0 0;
    background: var(--scp-mobile-panel);
  }

  body.mobile-chat-open #messageInput .composer-media-btn {
    display: none !important;
  }

  body.mobile-chat-open #messageInput #stickerToggleBtn.composer-media-btn, body.mobile-chat-open #messageInput #fileAttachBtn.composer-media-btn, body.mobile-chat-open #messageInput #voiceRecordBtn.composer-media-btn {
    display: inline-flex !important;
    width: 42px;
    min-width: 42px;
    height: 40px;
    min-height: 40px;
    border: 1px solid #9aaeba;
    border-radius: 50%;
    background: #15120f;
  }

  body.mobile-chat-open #messageInput .input-wrapper {
    min-height: 40px;
    border: 1px solid #9aaeba;
    border-radius: 21px 0 0 21px;
    background: #15120f;
  }

  body.mobile-chat-open #textInput {
    height: 40px;
    color: var(--scp-mobile-cream);
    font-size: 11px;
    font-weight: 900;
  }

  body.mobile-chat-open #textInput::placeholder {
    color: #9fb9c6;
    opacity: 1;
  }

  body.mobile-chat-open #sendBtn {
    width: 42px;
    min-width: 42px;
    height: 40px;
    border: 1px solid #9aaeba;
    border-left: 0;
    border-radius: 0 21px 21px 0;
    background: #15120f;
  }

  #chatList.scp-main-menu .scp-main-menu-top-island, #chatList.scp-main-menu .chat-folders-bar, #chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item {
    background: var(--scp-mobile-panel) !important;
    border-color: var(--scp-mobile-line) !important;
  }

  #chatList.scp-main-menu .chatItem .name, #chatList.scp-main-menu .scp-menu-feed-item .name, #chatList.scp-main-menu .chatItem .name > span:first-child {
    color: var(--scp-mobile-cream) !important;
  }
}

.system-badge::before {
  content: none !important;
}

.system-badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: none !important;
}

.system-badge:empty::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  -webkit-mask: var(--scp-system-badge-icon) center / contain no-repeat;
  mask: var(--scp-system-badge-icon) center / contain no-repeat;
}

.system-badge-verified {
  --scp-system-badge-icon: url("icons/status-verified.svg");
  color: #bd4cff !important;
}

.system-badge-beta {
  --scp-system-badge-icon: url("icons/status-beta.svg");
  color: #77a0ff !important;
}

#chatList.scp-main-menu .system-badge, #profileHome .system-badge {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.scp-profile-badge-strip.has-badge-icons strong {
  display: none !important;
}

img[src$="angle-left.svg"], img[src$="angle-right.svg"], img[src$="phone-call.svg"], img[src$="chat-enter.svg"], img[src$="chat-leave.svg"], img[src$="back.svg"], img[src$="join.svg"], img[src$="leave.svg"], img[src$="call.svg"] {
  filter: brightness(0) invert(1);
}

.scp-profile-edit-row {
  display: flex;
  justify-content: center;
  padding: 8px 14px 0;
}

.scp-profile-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  width: min(100%, 320px);
  border: 1px solid var(--scp-mobile-line, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel) 82%);
  color: var(--text);
  font-weight: 950;
  cursor: pointer;
}

.scp-profile-edit-btn img {
  filter: brightness(0) invert(1);
}

#chatList.scp-main-menu .avatar.has-avatar, #chatList.scp-main-menu .chatItem .avatar.has-avatar, #chatList.scp-main-menu .scp-menu-feed-item .avatar.has-avatar {
  background-color: transparent !important;
  background-size: cover !important;
  background-position: center !important;
  color: transparent !important;
}

.scp-mobile-tab-icon img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  pointer-events: none;
}

.scp-mobile-tab-button.active .scp-mobile-tab-icon img {
  filter: brightness(0) saturate(100%) invert(67%) sepia(64%) saturate(839%) hue-rotate(334deg) brightness(103%) contrast(102%);
}

.scp-mobile-tab-icon::before, .scp-mobile-tab-icon::after {
  display: none !important;
}

@media (max-width: 768px) {
  body.profile-home-mode #profileHome, body.settings-home-mode #settingsHome, body.news-home-mode #newsHome, body.calls-home-mode #callsHome {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #chatList.scp-main-menu {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #chatList.scp-main-menu #chatListContent {
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav, body.settings-home-mode #settingsHome .tg-settings-nav.settings-scroll-nav {
    max-height: calc(100dvh - 92px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-panel.active {
    max-height: none !important;
    overflow: visible !important;
  }
}

html, body, body * {
  -webkit-tap-highlight-color: transparent;
}

body, body * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#messages, #messages *, #messageInput, #messageInput *, input, textarea, select, [contenteditable="true"] {
  -webkit-touch-callout: text;
  -webkit-user-select: text;
  user-select: text;
}

#messages button, #messages [role="button"], #messages canvas, #messages img, #messages video, #messages audio, #messages .custom-player, #messages .file-attachment-card, #messages .image-attachment, #messages .message-reactions, #messageInput button, #messageInput img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body *::selection {
  background: transparent;
  color: inherit;
}

#messages ::selection, #messageInput ::selection, input::selection, textarea::selection {
  background: color-mix(in srgb, var(--accent) 34%, transparent);
  color: inherit;
}

a, a:visited, a:active, button, [role="button"], .chatItem, .scp-mobile-tab-button, .list-tab {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

#messageInput.channel-readonly {
  display: none !important;
}

#themeSaveBtn {
  display: none !important;
}

@media (max-width: 768px) {
  :root {
    --scp-mobile-bg: var(--chat-bg, var(--bg));
    --scp-mobile-panel: var(--panel);
    --scp-mobile-line: color-mix(in srgb, var(--border) 70%, var(--accent) 30%);
    --scp-mobile-cream: var(--text);
    --scp-mobile-muted: var(--muted);
    --scp-mobile-accent: var(--accent);
    --scp-mobile-on-accent: var(--accent-text);
    --scp-mobile-bubble: var(--bubble-out);
    --scp-mobile-input: var(--panel2);
  }

  html, body, #layout {
    width: 100%;
    height: 100dvh;
    max-width: 100%;
    overflow: hidden !important;
  }

  #layout, #chat, #chatList, #profileHome, #settingsHome, #newsHome, #callsHome {
    min-width: 0 !important;
    max-width: 100vw !important;
    background: var(--scp-mobile-bg) !important;
    color: var(--scp-mobile-cream) !important;
  }

  #chatList.scp-main-menu, body.profile-home-mode #profileHome, body.settings-home-mode #settingsHome, body.news-home-mode #newsHome, body.calls-home-mode #callsHome {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable both-edges;
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.profile-home-mode #chat, body.settings-home-mode #chat, body.news-home-mode #chat, body.calls-home-mode #chat {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  .scp-mobile-tab-bar, #chatList.scp-main-menu .scp-main-menu-top-island, #chatList.scp-main-menu .chat-folders-bar, #chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item, body.settings-home-mode #settingsHome .tg-settings-nav button, body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .modal-header {
    background: var(--scp-mobile-panel) !important;
    border-color: var(--scp-mobile-line) !important;
    color: var(--scp-mobile-cream) !important;
  }

  #chatList.scp-main-menu .list-search input, #chatList.scp-main-menu .chat-folders-bar button, body.mobile-chat-open #backBtn, body.mobile-chat-open #messageInput .input-wrapper, body.mobile-chat-open #sendBtn, body.mobile-chat-open #stickerToggleBtn.composer-media-btn, body.mobile-chat-open #fileAttachBtn.composer-media-btn, body.mobile-chat-open #voiceRecordBtn.composer-media-btn {
    background: var(--scp-mobile-input) !important;
    border-color: color-mix(in srgb, var(--scp-mobile-line) 78%, var(--scp-mobile-cream) 22%) !important;
    color: var(--scp-mobile-cream) !important;
  }

  #chatList.scp-main-menu .list-search input::placeholder, body.mobile-chat-open #textInput::placeholder {
    color: var(--scp-mobile-muted) !important;
  }

  #chatList.scp-main-menu .chat-folders-bar button.active, #chatList.scp-main-menu .chat-unread-badge, .scp-mobile-tab-button.active {
    color: var(--scp-mobile-accent) !important;
  }

  #chatList.scp-main-menu .chat-folders-bar button.active {
    background: var(--scp-mobile-accent) !important;
    color: var(--scp-mobile-on-accent) !important;
  }

  #chatList.scp-main-menu .chatItem .avatar, #chatList.scp-main-menu .scp-menu-feed-item .avatar, body.mobile-chat-open .chat-user .avatar, #profileHome .scp-profile-avatar, #profileHome .scp-profile-thumb {
    background: var(--avatar-bg) !important;
    color: var(--avatar-text) !important;
  }

  #chatList.scp-main-menu .chatItem .name, #chatList.scp-main-menu .scp-menu-feed-item .name, #chatList.scp-main-menu .chatItem .name > span:first-child, body.mobile-chat-open .chat-user .name {
    color: var(--scp-mobile-cream) !important;
  }

  #chatList.scp-main-menu .chatItem .last-message, #chatList.scp-main-menu .scp-menu-feed-item .last-message, body.mobile-chat-open .chat-user .status {
    color: var(--scp-mobile-muted) !important;
  }

  body.mobile-chat-open #messages {
    height: calc(100dvh - 100px - 58px) !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: var(--scp-mobile-bg) !important;
  }

  body.mobile-chat-open .message.in {
    background: var(--bubble-in) !important;
    color: var(--text) !important;
  }

  body.mobile-chat-open .message.out {
    background: var(--bubble-out) !important;
    color: var(--accent-text) !important;
  }

  #chatList.scp-main-menu #chatListContent {
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav, body.settings-home-mode #settingsHome .tg-settings-nav.settings-scroll-nav {
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open {
    overflow-y: auto !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-panel.active {
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #profileHome.scp-profile-page {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 0 calc(108px + env(safe-area-inset-bottom, 0px)) !important;
    background: var(--scp-mobile-bg) !important;
  }

  #profileHome .scp-profile-card {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    gap: 8px !important;
    padding: 0 0 8px !important;
    overflow: visible !important;
  }

  #profileHome .scp-profile-hero {
    width: 100% !important;
    height: auto !important;
    min-height: 218px !important;
    margin: 0 0 8px !important;
    padding: 14px 14px 18px !important;
    border-color: var(--scp-mobile-line) !important;
    background:
        linear-gradient(color-mix(in srgb, var(--scp-mobile-bg) 42%, transparent), color-mix(in srgb, var(--scp-mobile-bg) 42%, transparent)),
        var(--profile-wallpaper),
        linear-gradient(145deg, color-mix(in srgb, var(--panel) 74%, var(--text) 10%), var(--panel2)) !important;
  }

  #profileHome .scp-profile-avatar {
    width: clamp(78px, 27vw, 100px) !important;
    height: clamp(78px, 27vw, 100px) !important;
    flex: 0 0 auto !important;
    border-radius: clamp(18px, 6vw, 24px) !important;
    font-size: clamp(24px, 8vw, 34px) !important;
  }

  #profileHome .scp-profile-title-wrap {
    width: 100% !important;
    max-width: calc(100vw - 28px) !important;
    min-width: 0 !important;
    display: grid !important;
    justify-items: center !important;
    gap: 2px !important;
  }

  #profileHome .scp-profile-name {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px 5px !important;
    width: 100% !important;
    max-width: calc(100vw - 28px) !important;
    min-width: 0 !important;
    font-size: clamp(18px, 7vw, 24px) !important;
    line-height: 1.08 !important;
    text-align: center !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  #profileHome .scp-profile-username {
    width: 100% !important;
    max-width: calc(100vw - 28px) !important;
    min-width: 0 !important;
    font-size: clamp(14px, 5.2vw, 18px) !important;
    line-height: 1.12 !important;
    text-align: center !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  #profileHome .user-decorations {
    display: inline-flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 100% !important;
    gap: 3px !important;
  }

  #profileHome .emoji-status, #profileHome .system-badge {
    width: clamp(17px, 5.5vw, 22px) !important;
    min-width: clamp(17px, 5.5vw, 22px) !important;
    height: clamp(17px, 5.5vw, 22px) !important;
    line-height: clamp(17px, 5.5vw, 22px) !important;
  }

  #profileHome .scp-profile-island {
    width: calc(100% - 12px) !important;
    max-width: calc(100% - 12px) !important;
    min-width: 0 !important;
    margin: 0 6px 8px !important;
    border-color: var(--scp-mobile-line) !important;
    background: var(--surface-raised, color-mix(in srgb, var(--panel) 92%, var(--bg) 8%)) !important;
    overflow: hidden !important;
  }

  #profileHome .scp-profile-edit-row {
    width: 100% !important;
    padding: 0 14px !important;
  }

  #profileHome .scp-profile-edit-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 8px 12px !important;
    background: color-mix(in srgb, var(--accent) 24%, var(--panel) 76%) !important;
    color: var(--text) !important;
  }

  #profileHome .scp-profile-edit-btn span {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #profileHome .scp-profile-strip, #profileHome .scp-profile-block, #profileHome .scp-profile-line, #profileHome .scp-profile-share-row {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    background: transparent !important;
    color: var(--text) !important;
  }

  #profileHome .scp-profile-strip {
    grid-template-columns: clamp(42px, 14vw, 52px) minmax(0, 1fr) !important;
    min-height: auto !important;
    gap: clamp(10px, 4vw, 16px) !important;
    padding: 13px clamp(14px, 5vw, 24px) !important;
  }

  #profileHome .scp-profile-thumb {
    width: clamp(42px, 14vw, 52px) !important;
    height: clamp(42px, 14vw, 52px) !important;
    border-radius: 9px !important;
  }

  #profileHome .scp-profile-strip-text, #profileHome .scp-profile-link-copy {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  #profileHome .scp-profile-strip-text strong, #profileHome .scp-profile-strip-text a, #profileHome .scp-profile-link-copy strong, #profileHome .scp-profile-block h2, #profileHome .scp-profile-line strong {
    max-width: 100% !important;
    font-size: clamp(16px, 5.9vw, 22px) !important;
    line-height: 1.12 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  #profileHome .scp-profile-strip-text span, #profileHome .scp-profile-block p {
    max-width: 100% !important;
    font-size: clamp(13px, 4.8vw, 18px) !important;
    line-height: 1.18 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  #profileHome .scp-profile-block {
    min-height: auto !important;
    padding: 16px clamp(16px, 6vw, 24px) !important;
  }

  #profileHome .scp-profile-line {
    min-height: auto !important;
    padding: 14px clamp(16px, 6vw, 24px) !important;
  }

  #profileHome .scp-profile-badges-row {
    justify-content: center !important;
    text-align: center !important;
  }

  #profileHome .scp-profile-badges-row strong {
    font-size: clamp(13px, 4.5vw, 17px) !important;
  }

  #profileHome .scp-profile-share-row {
    grid-template-columns: clamp(78px, 27vw, 96px) minmax(0, 1fr) !important;
    gap: clamp(10px, 4vw, 14px) !important;
    min-height: auto !important;
    padding: 18px clamp(14px, 5vw, 20px) !important;
  }

  #profileHome .scp-profile-qr {
    width: clamp(76px, 26vw, 94px) !important;
    height: clamp(76px, 26vw, 94px) !important;
    min-width: 0 !important;
  }

  #profileHome .scp-profile-copy-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 50px !important;
    padding: 0 10px !important;
    font-size: clamp(13px, 4.4vw, 16px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

@media (max-width: 360px) {
  #chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item {
    min-height: 82px !important;
    gap: 10px !important;
    padding: 12px 34px 12px 10px !important;
  }

  #chatList.scp-main-menu .chatItem .avatar, #chatList.scp-main-menu .scp-menu-feed-item .avatar {
    width: 56px !important;
    height: 56px !important;
    border-radius: 18px !important;
  }

  #chatList.scp-main-menu .chatItem .name, #chatList.scp-main-menu .scp-menu-feed-item .name {
    font-size: 19px !important;
    line-height: 1.08 !important;
  }

  #profileHome .scp-profile-hero {
    min-height: 206px !important;
    padding-inline: 10px !important;
  }

  #profileHome .scp-profile-share-row {
    grid-template-columns: 74px minmax(0, 1fr) !important;
  }

  #profileHome .scp-profile-qr {
    width: 72px !important;
    height: 72px !important;
  }
}

@media (max-width: 768px) {
  #profileHome .scp-profile-edit-row {
    justify-content: center !important;
    padding: 0 14px 2px !important;
  }

  #profileHome .scp-profile-edit-btn {
    width: min(100%, 320px) !important;
    min-width: 0 !important;
    max-width: 320px !important;
    height: auto !important;
    min-height: 42px !important;
    padding: 8px 14px !important;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--accent) 18%, var(--panel) 82%) !important;
    color: var(--text) !important;
    font-size: 15px !important;
    line-height: 1.1 !important;
  }

  #profileHome .scp-profile-edit-btn img, #profileHome .scp-profile-edit-btn span {
    display: inline-flex !important;
  }

  #profileHome .scp-profile-edit-btn::before {
    content: none !important;
    display: none !important;
  }

  #profileHome .scp-profile-reveal-btn {
    display: inline-grid !important;
  }

  body.settings-home-mode, body.settings-home-mode #layout, body.settings-home-mode #chat {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  body.settings-home-mode #settingsHome {
    display: block !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome #settingsModal, body.settings-home-mode #settingsHome #settingsModal .modal-content, body.settings-home-mode #settingsHome #settingsModal .modal-body, body.settings-home-mode #settingsHome .tg-settings-shell, body.settings-home-mode #settingsHome .tg-settings-panels, body.settings-home-mode #settingsHome .tg-settings-panel {
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav, body.settings-home-mode #settingsHome .tg-settings-nav.settings-scroll-nav {
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open {
    overflow-y: auto !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .tg-settings-panels {
    display: block !important;
    overflow: visible !important;
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-panel.active {
    display: grid !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (max-width: 768px) {
  #profileHome.scp-profile-page {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 0 calc(116px + env(safe-area-inset-bottom, 0px)) !important;
    -webkit-overflow-scrolling: touch;
  }

  #profileHome .scp-profile-card {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    min-height: 0 !important;
    padding: 0 6px 12px !important;
    overflow: visible !important;
  }

  #profileHome .scp-profile-hero {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: calc(100% + 12px) !important;
    min-height: 232px !important;
    margin: 0 -6px 8px !important;
    padding: 58px 16px 14px !important;
    overflow: hidden !important;
  }

  #profileHome .scp-profile-back {
    position: absolute !important;
    top: 14px !important;
    left: 16px !important;
    z-index: 6 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 86px !important;
    height: 34px !important;
    min-height: 34px !important;
    gap: 5px !important;
    padding: 4px 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    border-radius: 6px !important;
    background: rgba(0, 0, 0, 0.34) !important;
    color: #fff !important;
    font-size: 15px !important;
    line-height: 1 !important;
    font-weight: 950 !important;
  }

  #profileHome .scp-profile-back span {
    display: inline-block !important;
    line-height: 1 !important;
  }

  #profileHome .scp-profile-back img {
    width: 16px !important;
    height: 16px !important;
    flex: 0 0 16px !important;
    filter: brightness(0) invert(1) !important;
  }

  #profileHome .scp-profile-reveal-btn {
    position: absolute !important;
    top: 14px !important;
    right: 16px !important;
    z-index: 6 !important;
    display: inline-grid !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #profileHome .scp-profile-edit-row {
    display: none !important;
  }

  #profileHome .scp-profile-avatar {
    width: clamp(82px, 22vw, 100px) !important;
    height: clamp(82px, 22vw, 100px) !important;
    margin: 0 !important;
  }

  #profileHome .scp-profile-title-wrap {
    width: 100% !important;
    max-width: calc(100vw - 32px) !important;
    margin-top: 8px !important;
    gap: 2px !important;
  }

  #profileHome .scp-profile-name {
    width: 100% !important;
    max-width: calc(100vw - 32px) !important;
    font-size: clamp(18px, 5.8vw, 24px) !important;
    line-height: 1.08 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  #profileHome .scp-profile-username {
    width: 100% !important;
    max-width: calc(100vw - 32px) !important;
    font-size: clamp(14px, 4.7vw, 18px) !important;
    line-height: 1.12 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  #profileHome .user-decorations {
    display: inline-flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 100% !important;
    gap: 3px !important;
  }

  #profileHome .emoji-status, #profileHome .system-badge {
    width: clamp(16px, 4.8vw, 21px) !important;
    min-width: clamp(16px, 4.8vw, 21px) !important;
    height: clamp(16px, 4.8vw, 21px) !important;
    line-height: clamp(16px, 4.8vw, 21px) !important;
  }

  #profileHome .scp-profile-strip, #profileHome .scp-profile-block, #profileHome .scp-profile-line, #profileHome .scp-profile-share-row {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  #profileHome .scp-profile-strip {
    grid-template-columns: clamp(42px, 13vw, 50px) minmax(0, 1fr) !important;
    align-items: start !important;
    gap: clamp(10px, 3.5vw, 14px) !important;
    padding: 14px clamp(16px, 5vw, 24px) !important;
  }

  #profileHome .scp-profile-thumb {
    width: clamp(42px, 13vw, 50px) !important;
    height: clamp(42px, 13vw, 50px) !important;
    margin-top: 2px !important;
  }

  #profileHome .scp-profile-strip-text strong, #profileHome .scp-profile-strip-text a, #profileHome .scp-profile-link-copy strong, #profileHome .scp-profile-block h2, #profileHome .scp-profile-line strong {
    max-width: 100% !important;
    font-size: clamp(16px, 5.2vw, 21px) !important;
    line-height: 1.12 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  #profileHome .scp-profile-strip-text span, #profileHome .scp-profile-block p {
    max-width: 100% !important;
    font-size: clamp(13px, 4.2vw, 16px) !important;
    line-height: 1.18 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  #profileHome .scp-profile-block {
    padding: 16px clamp(16px, 5.5vw, 24px) !important;
  }

  #profileHome .scp-profile-line {
    display: flex !important;
    align-items: center !important;
    padding: 14px clamp(16px, 5.5vw, 24px) !important;
  }

  #profileHome .scp-profile-badges-row {
    align-items: center !important;
    justify-content: center !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    text-align: center !important;
  }

  #profileHome .scp-profile-badges-row strong {
    display: block !important;
    font-size: clamp(12px, 3.7vw, 15px) !important;
    line-height: 1.16 !important;
  }

  #profileHome .scp-profile-share-row {
    grid-template-columns: clamp(78px, 24vw, 94px) minmax(0, 1fr) !important;
    align-items: center !important;
    gap: clamp(10px, 3.5vw, 14px) !important;
    padding: 16px clamp(14px, 5vw, 20px) !important;
  }

  #profileHome .scp-profile-qr {
    width: clamp(76px, 23vw, 90px) !important;
    height: clamp(76px, 23vw, 90px) !important;
  }

  #profileHome .scp-profile-copy-btn {
    min-height: 48px !important;
  }
}

@media (max-width: 360px) {
  #profileHome .scp-profile-hero {
    min-height: 218px !important;
    padding: 56px 12px 12px !important;
  }

  #profileHome .scp-profile-back {
    left: 12px !important;
    min-width: 78px !important;
    padding-inline: 8px !important;
    font-size: 14px !important;
  }

  #profileHome .scp-profile-reveal-btn {
    right: 12px !important;
  }
}

@media (max-width: 768px) {
  body.profile-home-mode #chat > .music-notification, body.settings-home-mode #chat > .music-notification {
    display: none !important;
  }

  #chatList.scp-main-menu {
    position: relative !important;
    padding-bottom: calc(142px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #chatList.scp-main-menu .scp-main-menu-top-island .list-tabs {
    display: contents !important;
  }

  #chatList.scp-main-menu .scp-main-menu-top-island .list-tabs .list-tab, #chatList.scp-main-menu .scp-main-menu-top-island .list-tabs .profile-mobile-btn, #chatList.scp-main-menu .scp-main-menu-top-island .list-tabs .settings-mobile-btn {
    display: none !important;
  }

  #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus {
    position: fixed !important;
    right: 18px !important;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 2195 !important;
    display: grid !important;
    place-items: center !important;
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    min-height: 58px !important;
    padding: 0 !important;
    border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--border) 64%) !important;
    border-radius: 50% !important;
    background: var(--accent) !important;
    color: var(--accent-text) !important;
    font-size: 34px !important;
    line-height: 1 !important;
    font-weight: 950 !important;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34) !important;
  }

  #chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item {
    display: grid !important;
    grid-template-columns: 76px minmax(0, 1fr) 28px !important;
    align-items: center !important;
    column-gap: 14px !important;
    min-height: 102px !important;
    padding: 12px 18px 12px 11px !important;
    overflow: hidden !important;
  }

  #chatList.scp-main-menu .chatItem .avatar, #chatList.scp-main-menu .scp-menu-feed-item .avatar {
    grid-column: 1 !important;
    width: 76px !important;
    height: 76px !important;
    min-width: 76px !important;
    min-height: 76px !important;
  }

  #chatList.scp-main-menu .chatItem .info, #chatList.scp-main-menu .scp-menu-feed-item .info {
    grid-column: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  #chatList.scp-main-menu .chatItem .name, #chatList.scp-main-menu .scp-menu-feed-item .name {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 24px !important;
    line-height: 1.05 !important;
    overflow: hidden !important;
  }

  #chatList.scp-main-menu .chatItem .name > span:first-child, #chatList.scp-main-menu .scp-menu-feed-item .name > span:first-child {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #chatList.scp-main-menu .chatItem .last-message, #chatList.scp-main-menu .scp-menu-feed-item .last-message {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #chatList.scp-main-menu .chat-presence-dot {
    grid-column: 3 !important;
    position: static !important;
    justify-self: center !important;
    transform: none !important;
  }

  #chatList.scp-main-menu .scp-main-menu-music {
    order: 4 !important;
    padding: 10px 18px 12px !important;
  }

  #chatList.scp-main-menu .scp-main-menu-music-card {
    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr) !important;
    min-height: 80px !important;
    padding: 10px 14px !important;
    border-radius: 22px !important;
    overflow: hidden !important;
  }

  #chatList.scp-main-menu .scp-main-menu-music-card.playing {
    box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 22%, transparent) !important;
  }

  #chatList.scp-main-menu .scp-main-menu-music-card .player-play {
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    min-height: 58px !important;
  }

  #chatList.scp-main-menu .scp-main-menu-music-card .player-body, #chatList.scp-main-menu .scp-main-menu-music-card .player-title, #chatList.scp-main-menu .scp-main-menu-music-card .player-time {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .modal-header {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    align-items: center !important;
    justify-content: start !important;
    gap: 10px !important;
    min-height: 58px !important;
    padding: 0 16px !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .modal-close {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    text-align: center !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .modal-header h2 {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    width: 100% !important;
    margin: 0 !important;
    text-align: left !important;
  }

  #profileHome.scp-profile-page {
    background: var(--bg) !important;
    scroll-padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #profileHome .scp-profile-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 18px calc(128px + env(safe-area-inset-bottom, 0px)) !important;
    gap: 14px !important;
  }

  #profileHome .scp-profile-hero {
    width: calc(100% + 36px) !important;
    min-height: 286px !important;
    margin: 0 -18px 14px !important;
    padding: 70px 20px 22px !important;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border) 78%) !important;
    border-top: 0 !important;
    border-radius: 0 0 34px 34px !important;
    background: var(--panel) !important;
  }

  #profileHome .scp-profile-avatar {
    width: 108px !important;
    height: 108px !important;
    min-width: 108px !important;
    min-height: 108px !important;
    border-radius: 30px !important;
  }

  #profileHome .scp-profile-title-wrap {
    display: grid !important;
    justify-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-top: 10px !important;
  }

  #profileHome .scp-profile-name {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 30px !important;
    margin: 0 !important;
    font-size: 25px !important;
    line-height: 1.08 !important;
    text-align: center !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #profileHome .scp-profile-name .user-decorations {
    display: none !important;
  }

  #profileHome .scp-profile-username {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 22px !important;
    margin: 0 !important;
    font-size: 18px !important;
    line-height: 1.12 !important;
    text-align: center !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #profileHome .scp-profile-island {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    margin: 0 0 14px !important;
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border) 80%) !important;
    border-radius: 24px !important;
    background: var(--surface-raised, var(--panel)) !important;
    overflow: hidden !important;
  }

  #profileHome .scp-profile-strip, #profileHome .scp-profile-block, #profileHome .scp-profile-line, #profileHome .scp-profile-share-row {
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    overflow: hidden !important;
  }

  #profileHome .scp-profile-strip + .scp-profile-strip, #profileHome .scp-profile-block + .scp-profile-line, #profileHome .scp-profile-line + .scp-profile-line {
    border-top: 1px solid color-mix(in srgb, var(--border) 82%, var(--accent) 18%) !important;
  }

  #profileHome .scp-profile-badge-strip, #profileHome.scp-profile-peer .scp-profile-badges-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    place-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-height: 72px !important;
    padding: 12px 18px !important;
    text-align: center !important;
  }

  #profileHome .scp-profile-badge-icons {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 30px !important;
    max-width: 100% !important;
  }

  #profileHome .scp-profile-badge-icons.hidden {
    display: none !important;
  }

  #profileHome .scp-profile-badge-icons .emoji-status, #profileHome .scp-profile-badge-icons .system-badge {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    line-height: 30px !important;
  }

  #profileHome .scp-profile-badge-strip strong {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  #profileHome .scp-profile-music-row, #profileHome .scp-profile-channel-row {
    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr) !important;
    align-items: center !important;
    min-height: 86px !important;
    padding: 14px 18px !important;
  }

  #profileHome .scp-profile-music-row.is-player-active {
    display: block !important;
    min-height: 86px !important;
    padding: 0 !important;
  }

  #profileHome .scp-profile-inline-player, #profileHome .scp-profile-inline-player .tg-profile-music-card {
    width: 100% !important;
    min-height: 86px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  #profileHome .scp-profile-inline-player .tg-profile-music-card {
    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr) !important;
    align-items: center !important;
    padding: 14px 18px !important;
    overflow: hidden !important;
  }

  #profileHome .scp-profile-inline-player .player-body, #profileHome .scp-profile-inline-player .player-title, #profileHome .scp-profile-inline-player .player-time {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #profileHome .scp-profile-thumb {
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    min-height: 58px !important;
    border-radius: 10px !important;
  }

  #profileHome .scp-profile-strip-text {
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  #profileHome .scp-profile-strip-text strong, #profileHome .scp-profile-strip-text a {
    display: block !important;
    width: 100% !important;
    max-height: 70px !important;
    font-size: 22px !important;
    line-height: 1.08 !important;
    overflow: hidden !important;
    overflow-wrap: anywhere !important;
  }

  #profileHome .scp-profile-strip-text span {
    display: block !important;
    width: 100% !important;
    font-size: 15px !important;
    line-height: 1.15 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #profileHome .scp-profile-block {
    min-height: 122px !important;
    padding: 18px 20px !important;
  }

  #profileHome .scp-profile-block h2, #profileHome .scp-profile-line strong, #profileHome .scp-profile-link-copy strong {
    font-size: 22px !important;
    line-height: 1.12 !important;
  }

  #profileHome .scp-profile-block p {
    display: block !important;
    max-height: 92px !important;
    margin: 8px 0 0 !important;
    font-size: 18px !important;
    line-height: 1.18 !important;
    overflow: hidden !important;
    overflow-wrap: anywhere !important;
  }

  #profileHome .scp-profile-line {
    min-height: 78px !important;
    padding: 16px 20px !important;
  }

  #profileHome .scp-profile-share-row {
    display: grid !important;
    grid-template-columns: 98px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 16px !important;
    min-height: 132px !important;
    padding: 16px 18px !important;
  }

  #profileHome .scp-profile-qr {
    width: 98px !important;
    height: 98px !important;
    min-width: 98px !important;
    min-height: 98px !important;
    overflow: hidden !important;
  }

  #profileHome .scp-profile-link-copy {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  #profileHome .scp-profile-copy-btn {
    width: 100% !important;
    min-height: 54px !important;
    font-size: 16px !important;
    overflow: hidden !important;
  }
}

@media (max-width: 380px) {
  #profileHome .scp-profile-card {
    padding-inline: 10px !important;
  }

  #profileHome .scp-profile-hero {
    width: calc(100% + 20px) !important;
    min-height: 264px !important;
    margin-inline: -10px !important;
  }

  #profileHome .scp-profile-name {
    font-size: 23px !important;
  }

  #profileHome .scp-profile-username {
    font-size: 16px !important;
  }

  #profileHome .scp-profile-strip-text strong, #profileHome .scp-profile-strip-text a, #profileHome .scp-profile-block h2, #profileHome .scp-profile-line strong, #profileHome .scp-profile-link-copy strong {
    font-size: 20px !important;
  }
}

@media (max-width: 768px) {
  #profileHome .scp-profile-card {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
  }

  #profileHome .scp-profile-island, #profileHome .scp-profile-island > .scp-profile-strip, #profileHome .scp-profile-island > .scp-profile-block, #profileHome .scp-profile-island > .scp-profile-line, #profileHome .scp-profile-island > .scp-profile-share-row {
    height: auto !important;
    max-height: none !important;
    min-width: 0 !important;
  }

  #profileHome .scp-profile-island {
    flex: 0 0 auto !important;
    overflow: hidden !important;
  }

  #profileHome.scp-profile-own .scp-profile-island-badges, #profileHome.scp-profile-peer .scp-profile-island-badges {
    order: 1 !important;
  }

  #profileHome.scp-profile-own .scp-profile-island-media, #profileHome.scp-profile-peer .scp-profile-island-media {
    order: 2 !important;
  }

  #profileHome.scp-profile-own .scp-profile-island-about, #profileHome.scp-profile-peer .scp-profile-island-about {
    order: 3 !important;
  }

  #profileHome.scp-profile-own .scp-profile-island-share, #profileHome.scp-profile-peer .scp-profile-island-share {
    order: 4 !important;
  }

  #profileHome .scp-profile-island-badges {
    min-height: 72px !important;
    border-radius: 999px !important;
  }

  #profileHome .scp-profile-badge-strip, #profileHome.scp-profile-peer .scp-profile-badges-row {
    min-height: 72px !important;
    padding: 12px 16px !important;
    overflow: visible !important;
  }

  #profileHome .scp-profile-badge-strip strong {
    display: none !important;
  }

  #profileHome .scp-profile-badge-icons {
    min-height: 38px !important;
  }

  #profileHome .scp-profile-badge-icons .emoji-status, #profileHome .scp-profile-badge-icons .system-badge {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    line-height: 34px !important;
  }

  #profileHome .scp-profile-island-media {
    min-height: 96px !important;
  }

  #profileHome .scp-profile-music-row, #profileHome .scp-profile-channel-row {
    min-height: 96px !important;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
  }

  #profileHome .scp-profile-strip-text strong, #profileHome .scp-profile-strip-text a {
    max-height: none !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
  }

  #profileHome .scp-profile-island-about {
    min-height: 104px !important;
  }

  #profileHome .scp-profile-birth-row {
    min-height: 104px !important;
    align-items: center !important;
    overflow: visible !important;
  }

  #profileHome .scp-profile-birth-row strong {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    white-space: normal !important;
  }

  #profileHome .scp-profile-island-share {
    min-height: 150px !important;
  }

  #profileHome .scp-profile-share-row {
    min-height: 150px !important;
    overflow: visible !important;
  }

  #profileHome .scp-profile-qr {
    align-self: center !important;
  }

  #profileHome .scp-profile-link-copy {
    display: grid !important;
    gap: 10px !important;
    align-content: center !important;
  }
}

@media (max-width: 380px) {
  #profileHome .scp-profile-island-badges {
    min-height: 66px !important;
  }

  #profileHome .scp-profile-badge-strip {
    min-height: 66px !important;
  }

  #profileHome .scp-profile-badge-icons .emoji-status, #profileHome .scp-profile-badge-icons .system-badge {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    line-height: 30px !important;
  }

  #profileHome .scp-profile-music-row, #profileHome .scp-profile-channel-row {
    min-height: 92px !important;
  }

  #profileHome .scp-profile-birth-row {
    min-height: 100px !important;
  }
}

@media (max-width: 768px) {
  .scp-mobile-tab-bar {
    left: 50% !important;
    right: auto !important;
    bottom: 0 !important;
    width: min(184px, calc(100vw - 64px)) !important;
    height: 64px !important;
    min-height: 64px !important;
    padding: 6px 14px 8px !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    border: 1px solid color-mix(in srgb, var(--scp-mobile-line) 88%, transparent) !important;
    border-bottom: 0 !important;
    border-radius: 14px 14px 0 0 !important;
    background: var(--scp-mobile-panel) !important;
    box-shadow: none !important;
    transform: translateX(-50%) !important;
  }

  .scp-mobile-tab-button {
    width: 44px !important;
    height: 50px !important;
    min-width: 44px !important;
    min-height: 50px !important;
    padding: 0 !important;
    justify-self: center !important;
  }

  .scp-mobile-tab-icon {
    width: 42px !important;
    height: 42px !important;
  }

  .scp-mobile-tab-icon img {
    width: 38px !important;
    height: 38px !important;
  }

  #chatList.scp-main-menu {
    padding-bottom: calc(98px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus {
    left: calc(50% + 70px) !important;
    right: auto !important;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    min-height: 45px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    overflow: visible !important;
  }

  #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus img {
    display: block !important;
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    min-height: 45px !important;
    object-fit: contain !important;
    pointer-events: none !important;
    filter: none !important;
  }
}

@media (max-width: 320px) {
  .scp-mobile-tab-bar {
    width: min(172px, calc(100vw - 48px)) !important;
    padding-inline: 10px !important;
  }

  #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus {
    left: calc(50% + 62px) !important;
  }
}

@media (max-width: 768px) {
  .scp-mobile-tab-bar {
    bottom: calc(7px + env(safe-area-inset-bottom, 0px)) !important;
    border: 1px solid color-mix(in srgb, var(--scp-mobile-line) 88%, transparent) !important;
    border-radius: 25px !important;
    overflow: hidden !important;
  }

  #chatList.scp-main-menu {
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus {
    position: fixed !important;
    left: auto !important;
    right: max(16px, env(safe-area-inset-right, 0px)) !important;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 85 !important;
  }

  body.profile-home-mode #profileHome.scp-profile-peer ~ .scp-mobile-tab-bar, body.profile-home-mode .scp-mobile-tab-bar.hidden {
    display: none !important;
  }

  #profileHome.scp-profile-peer .scp-profile-strip.hidden, #profileHome.scp-profile-peer .scp-profile-block.hidden, #profileHome.scp-profile-peer .scp-profile-line.hidden, #profileHome.scp-profile-peer .scp-profile-island:empty {
    display: none !important;
  }
}

body.encrypted-temple-mode, body.encrypted-temple-mode #layout, body.encrypted-temple-mode #chat, body.encrypted-temple-mode #settingsHome, body.encrypted-temple-mode #settingsModal, body.encrypted-temple-mode #settingsModal .modal-content, body.encrypted-temple-mode #settingsModal .modal-body, body.encrypted-temple-mode #settingsModal .tg-settings-shell, body.encrypted-temple-mode #settingsModal .tg-settings-panels, body.encrypted-temple-mode #settingsModal .tg-settings-panel.active {
  background: #000 !important;
  background-image: none !important;
  color: #fff !important;
  border-color: #000 !important;
  box-shadow: none !important;
}

body.encrypted-temple-mode #settingsModal .modal-header, body.encrypted-temple-mode #settingsModal .modal-footer, body.encrypted-temple-mode #settingsModal .tg-settings-nav, body.encrypted-temple-mode .scp-mobile-tab-bar, body.encrypted-temple-mode #chat > .music-notification {
  display: none !important;
}

body.encrypted-temple-mode #settingsHome {
  padding: 0 !important;
}

body.encrypted-temple-mode #settingsModal .tg-settings-panels {
  padding: 0 !important;
  overflow: hidden !important;
}

.encrypted-temple-panel.active {
  position: relative !important;
  display: flex !important;
  place-items: center !important;
  min-height: 100dvh !important;
  width: 100% !important;
  padding: 0 !important;
  background: #000 !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 16px !important;
}

.encrypted-temple-text {
  color: #fff !important;
  font: 700 clamp(18px, 5vw, 32px) / 1.15 var(--font, inherit) !important;
  text-align: center !important;
  letter-spacing: 0 !important;
}

.encrypted-temple-back {
  position: static !important;
  top: calc(18px + env(safe-area-inset-top, 0px)) !important;
  left: calc(18px + env(safe-area-inset-left, 0px)) !important;
  z-index: 120 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 42px !important;
  padding: 8px 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.36) !important;
  border-radius: 12px !important;
  background: #000 !important;
  color: #fff !important;
  inset: auto !important;
}

.encrypted-temple-back img {
  width: 18px !important;
  height: 18px !important;
  filter: invert(1) !important;
}

body.encrypted-temple-mode #settingsModal.encrypted-temple-active .modal-header, body.encrypted-temple-mode #settingsHome.encrypted-temple-active #settingsModal .modal-header, body.encrypted-temple-mode.settings-home-mode #settingsHome.scp-settings-section-open.encrypted-temple-active #settingsModal .modal-header {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.encrypted-temple-mode #settingsModal.encrypted-temple-active .modal-content, body.encrypted-temple-mode #settingsHome.encrypted-temple-active #settingsModal .modal-content {
  padding-top: 0 !important;
}

#forwardModal.scp-forward-modal .modal-content {
  width: min(560px, calc(100vw - 18px));
  max-height: min(820px, calc(100dvh - 18px));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
  border-radius: 25px;
  background: var(--scp-mobile-bg, var(--panel));
  overflow: hidden;
}

#forwardModal.scp-forward-modal .modal-body {
  padding: 12px;
}

#forwardModal.scp-forward-modal .forward-preview-card {
  margin: 0 0 10px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel2) 84%, transparent);
}

#forwardModal.scp-forward-modal .forward-targets {
  display: block;
  max-height: min(560px, calc(100dvh - 240px));
  overflow-y: auto;
  border-radius: 20px;
  background: var(--scp-mobile-panel, color-mix(in srgb, var(--panel2) 80%, transparent));
}

#forwardModal.scp-forward-modal .forward-target.chatItem {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 20px;
  align-items: center;
  width: 100%;
  min-height: 86px;
  gap: 14px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border) 78%);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

#forwardModal.scp-forward-modal .forward-target.chatItem:last-child {
  border-bottom: 0;
}

#forwardModal.scp-forward-modal .forward-target.chatItem:hover, #forwardModal.scp-forward-modal .forward-target.chatItem:focus-visible {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel2) 88%);
  transform: none;
}

#forwardModal.scp-forward-modal .forward-target .avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: #d7d0c2;
  color: #fff;
  font-size: 22px;
  font-weight: 950;
  box-shadow: none;
}

#forwardModal.scp-forward-modal .forward-target .info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

#forwardModal.scp-forward-modal .forward-target .name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--scp-mobile-cream, var(--text));
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1;
  font-weight: 950;
}

#forwardModal.scp-forward-modal .forward-target .name > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#forwardModal.scp-forward-modal .forward-target .last-message {
  overflow: hidden;
  color: var(--scp-mobile-muted, var(--muted));
  font-size: 12px;
  line-height: 1.15;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#forwardModal.scp-forward-modal .forward-target .chat-presence-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 26%, transparent);
}

#forwardModal.scp-forward-modal .forward-target .chat-presence-dot.online {
  background: var(--scp-menu-online, #00ec43);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.38);
}

.comment-modal {
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.comment-modal-card.comment-chat-card {
  width: min(680px, 100vw);
  height: min(840px, 100dvh);
  max-width: none;
  max-height: none;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border) 72%);
  border-radius: 25px;
  background: var(--scp-mobile-bg, var(--panel));
  overflow: hidden;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.48);
}

.comment-chat-header {
  display: grid;
  grid-template-columns: auto 46px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 10px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border) 80%);
  background: color-mix(in srgb, var(--panel2) 84%, transparent);
}

.comment-chat-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--text) 28%, var(--border) 72%);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-weight: 950;
  cursor: pointer;
}

.comment-chat-back img, .comment-compose button img {
  width: 18px;
  height: 18px;
  filter: var(--scp-icon-filter, none);
}

.comment-chat-avatar, .comment-message-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #d7d0c2;
  color: #fff;
  font-weight: 950;
}

.comment-chat-avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 17px;
}

.comment-chat-heading {
  min-width: 0;
}

.comment-chat-title {
  overflow: hidden;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-chat-meta {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-modal-card.comment-chat-card .comment-post-preview {
  margin: 10px 14px;
  border-radius: 16px;
  padding: 10px 12px;
}

.comment-post-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
}

.comment-post-text {
  overflow: hidden;
  margin-top: 3px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-modal-card.comment-chat-card .comment-thread-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 6px 14px 14px;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 0, rgba(255, 170, 48, 0.08), transparent 32%), var(--scp-mobile-bg, var(--panel));
}

.comment-chat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.comment-chat-row.is-own {
  justify-content: flex-end;
}

.comment-message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 13px;
}

.comment-modal-card.comment-chat-card .comment-thread-item {
  width: fit-content;
  max-width: min(74%, 430px);
  border-radius: 18px;
  padding: 10px 12px 8px;
}

.comment-modal-card.comment-chat-card .comment-thread-item.is-peer {
  border-bottom-left-radius: 7px;
}

.comment-modal-card.comment-chat-card .comment-thread-item.is-own {
  border-bottom-right-radius: 7px;
}

.comment-thread-author .user-decorations {
  display: inline-flex;
  margin-left: 5px;
  vertical-align: middle;
}

.comment-thread-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.comment-thread-reply {
  margin-top: 6px;
}

.comment-modal-card.comment-chat-card .comment-reply-bar {
  margin: 0 14px 8px;
}

.comment-modal-card.comment-chat-card .comment-compose {
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border) 82%);
  background: color-mix(in srgb, var(--panel2) 86%, transparent);
}

.comment-modal-card.comment-chat-card .comment-compose textarea {
  min-height: 42px;
  max-height: 120px;
  resize: none;
  border-radius: 999px;
  padding: 11px 14px;
}

.comment-modal-card.comment-chat-card .comment-compose button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
}

@media (max-width: 768px) {
  #forwardModal.scp-forward-modal {
    align-items: stretch;
    justify-content: stretch;
  }

  #forwardModal.scp-forward-modal .modal-content {
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }

  #forwardModal.scp-forward-modal .forward-targets {
    max-height: calc(100dvh - 220px);
  }

  .comment-modal {
    align-items: stretch;
    justify-content: stretch;
  }

  .comment-modal-card.comment-chat-card {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .comment-chat-header {
    grid-template-columns: auto 42px minmax(0, 1fr);
    min-height: 64px;
  }

  .comment-chat-title {
    font-size: 18px;
  }

  .comment-modal-card.comment-chat-card .comment-thread-item {
    max-width: calc(100vw - 88px);
  }
}

.message-virtual-spacer {
  flex: 0 0 auto;
  width: 100%;
  pointer-events: none;
}

#messages.messages-virtualized {
  overflow-anchor: none;
}

#chatList.scp-main-menu .chat-folders-bar.hidden {
  display: none !important;
}

#chatList.scp-main-menu .chatItem .avatar .chat-presence-dot {
  position: absolute !important;
  right: -3px !important;
  bottom: -3px !important;
  grid-column: auto !important;
  justify-self: auto !important;
  width: 17px !important;
  height: 17px !important;
  margin: 0 !important;
  border: 3px solid var(--scp-mobile-panel, var(--panel)) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--muted) 55%, var(--panel) 45%) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  transform: none !important;
}

#chatList.scp-main-menu .chatItem .avatar .chat-presence-dot.online {
  background: #63f596 !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.28) !important;
}

.chatItem .avatar, .chat-user .avatar {
  position: relative !important;
  overflow: visible !important;
}

#chatList.scp-main-menu .chatItem > .chat-presence-dot {
  display: none !important;
}

.chatItem .avatar .chat-presence-dot, #chatList.scp-main-menu .chatItem .avatar .chat-presence-dot, .chat-user .avatar .chat-presence-dot {
  position: absolute !important;
  right: -4px !important;
  bottom: -4px !important;
  top: auto !important;
  left: auto !important;
  grid-column: auto !important;
  justify-self: auto !important;
  width: 17px !important;
  height: 17px !important;
  min-width: 17px !important;
  min-height: 17px !important;
  margin: 0 !important;
  border: 3px solid var(--scp-mobile-panel, var(--panel)) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--muted) 55%, var(--panel) 45%) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  transform: none !important;
  pointer-events: none !important;
  z-index: 6 !important;
}

.chatItem .avatar .chat-presence-dot.online, #chatList.scp-main-menu .chatItem .avatar .chat-presence-dot.online, .chat-user .avatar .chat-presence-dot.online {
  background: var(--scp-menu-online, #00ec43) !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.28) !important;
}

body.mobile-chat-open .chat-user .avatar .chat-presence-dot {
  right: -3px !important;
  bottom: -3px !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  border-width: 4px !important;
}

.create-chat-btn.scp-main-menu-plus {
  display: none !important;
}

#layout.hidden ~ .create-chat-btn.scp-main-menu-plus {
  display: none !important;
}

@media (min-width: 769px) {
  .create-chat-btn.scp-main-menu-plus {
    position: fixed !important;
    right: 24px !important;
    bottom: 24px !important;
    z-index: 1200 !important;
    display: grid !important;
    place-items: center !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: var(--accent) !important;
  }
}

@media (max-width: 768px) {
  body:not(.mobile-chat-open):not(.profile-home-mode):not(.settings-home-mode):not(.news-home-mode):not(.calls-home-mode) .create-chat-btn.scp-main-menu-plus {
    position: fixed !important;
    left: auto !important;
    right: max(16px, env(safe-area-inset-right, 0px)) !important;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 2305 !important;
    display: grid !important;
    place-items: center !important;
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    min-height: 45px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    overflow: visible !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  body:not(.mobile-chat-open):not(.profile-home-mode):not(.settings-home-mode):not(.news-home-mode):not(.calls-home-mode) .create-chat-btn.scp-main-menu-plus img {
    display: block !important;
    width: 45px !important;
    height: 45px !important;
    object-fit: contain !important;
    pointer-events: none !important;
  }
}

#profileHome .scp-profile-back.hidden {
  display: none !important;
}

#profileHome .profile-empty-field {
  border: 1px dashed color-mix(in srgb, var(--accent) 56%, var(--border) 44%) !important;
  background: color-mix(in srgb, var(--panel2) 68%, transparent) !important;
}

#profileHome .scp-profile-island .profile-empty-field {
  border-inline: 0 !important;
  border-radius: 0 !important;
}

#profileHome .scp-profile-island .profile-empty-field:first-child {
  border-top: 0 !important;
}

#profileHome .scp-profile-island .profile-empty-field:last-child {
  border-bottom: 0 !important;
}

.account-security-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
}

.account-security-summary {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.account-security-summary strong, .account-device-row strong {
  color: var(--text);
  font-weight: 950;
}

.account-security-summary span, .account-security-summary small, .account-device-row small, .account-device-status, .account-device-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.account-security-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.account-security-actions button, .account-device-row button {
  min-height: 38px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border) 66%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%);
  color: var(--text);
  padding: 0 14px;
  font-weight: 950;
  cursor: pointer;
}

.account-security-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

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

.account-device-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
}

.account-device-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 28%, var(--panel) 72%);
  color: var(--text);
  font-weight: 950;
}

.account-device-text {
  display: grid;
  min-width: 0;
  gap: 2px;
}

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

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: grid;
  place-items: center;
  background: #000;
}

.media-viewer.hidden {
  display: none !important;
}

.media-viewer-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: calc(68px + env(safe-area-inset-top, 0px)) 0 calc(22px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}

.media-viewer-media {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100dvh;
  object-fit: contain;
  background: #000;
}

.media-viewer-back {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: calc(14px + env(safe-area-inset-left, 0px));
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-weight: 950;
  cursor: pointer;
}

.media-viewer-back img {
  filter: invert(1);
}

.image-attachment.media-fill {
  width: min(260px, 62vw) !important;
  height: min(260px, 62vw) !important;
  max-width: min(260px, 62vw) !important;
  max-height: min(260px, 62vw) !important;
  border-radius: 22px !important;
  cursor: zoom-in;
}

.yt-video-player .player-mute, .yt-video-player .player-volume, .yt-video-player .player-speed {
  display: none !important;
}

@media (max-width: 420px) {
  .account-device-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .account-device-row button {
    grid-column: 2;
    justify-self: start;
  }

  .image-attachment.media-fill, .yt-video-player {
    width: min(150px, 40vw) !important;
    height: min(150px, 40vw) !important;
    max-width: min(150px, 40vw) !important;
    max-height: min(150px, 40vw) !important;
  }
}

#messages > .message {
  content-visibility: visible;
  contain: layout paint style;
  contain-intrinsic-size: none;
  will-change: auto !important;
}

#messages > .message.active, #messages > .message.search-hit {
  content-visibility: visible;
}

#messages > .message-virtual-spacer {
  display: none !important;
}

#profileHome .scp-profile-hero > .scp-profile-wallpaper-img, .scp-profile-hero > .scp-profile-wallpaper-img {
  position: absolute !important;
  inset: -2px !important;
  z-index: 0 !important;
  display: block !important;
  width: calc(100% + 4px) !important;
  height: calc(100% + 4px) !important;
  object-fit: cover !important;
  object-position: center !important;
  border: 0 !important;
  border-radius: inherit !important;
  opacity: 1 !important;
  filter: saturate(0.95) brightness(0.74) !important;
  transform: scale(1.01) !important;
  pointer-events: none !important;
  user-select: none !important;
}

#profileHome .scp-profile-hero.has-wallpaper::before, .scp-profile-hero.has-wallpaper::before {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.46)) !important;
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
  pointer-events: none !important;
}

#profileHome .scp-profile-hero > :not(.scp-profile-wallpaper-img), .scp-profile-hero > :not(.scp-profile-wallpaper-img) {
  position: relative;
  z-index: 2;
}

.profile-channel-hidden-input {
  display: none !important;
}

.profile-channel-select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 58%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel2) 86%, #000 14%);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.profile-channel-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}

.profile-channel-select:disabled {
  opacity: 0.62;
}

.profile-channel-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

body.global-music-visible {
  --global-music-compact-offset: 0px;
  --global-music-expanded-offset: 0px;
  --global-music-offset: 0px;
}

body.global-music-visible.global-music-expanded {
  --global-music-offset: var(--global-music-expanded-offset);
}

body.global-music-visible #layout {
  height: 100vh !important;
  margin-top: 0 !important;
}

body.global-music-visible #profileHome, body.global-music-visible #settingsHome {
  height: 100% !important;
  margin-top: 0 !important;
}

body > .music-notification {
  top: calc(10px + env(safe-area-inset-top, 0px)) !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  width: min(620px, calc(100vw - 24px)) !important;
  max-height: 92px !important;
  transform: translateX(-50%) !important;
  z-index: 160 !important;
  transition:
    width 0.18s ease,
    max-height 0.18s ease,
    border-radius 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

body > .music-notification.hidden {
  display: none !important;
}

body > .music-notification:not(:hover):not(.music-notification-expanded) {
  width: min(360px, calc(100vw - 56px)) !important;
  max-height: 38px !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28) !important;
}

body > .music-notification .music-notification-main {
  grid-template-columns: 46px minmax(0, 1fr) 72px auto auto !important;
  gap: 10px !important;
  padding: 10px 12px !important;
  min-height: 70px;
}

body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-main {
  grid-template-columns: minmax(0, 1fr) !important;
  min-height: 36px !important;
  padding: 7px 14px !important;
}

body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-play, body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-artist, body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-seek, body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-time, body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-volume, body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-stop, body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-close {
  display: none !important;
}

body > .music-notification .music-notification-title, .player-title {
  min-width: 0;
}

.music-notification-artist, .player-artist {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-title {
  text-align: center;
  font-size: 14px;
  line-height: 1.1;
}

.music-notification[data-music-surface] {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: min(620px, calc(100% - 28px)) !important;
  max-height: 94px !important;
  margin: 8px auto 10px !important;
  transform: none !important;
  z-index: 8 !important;
  flex: 0 0 auto !important;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border) 66%) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 12% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 44%),
    color-mix(in srgb, var(--panel2) 70%, var(--panel) 30%) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) {
  width: min(360px, calc(100% - 48px)) !important;
  max-height: 38px !important;
  margin-top: 8px !important;
  margin-bottom: 8px !important;
  border-radius: 14px !important;
}

.music-notification[data-music-surface] .music-notification-main {
  grid-template-columns: 44px minmax(0, 1fr) 70px auto auto !important;
  gap: 10px !important;
  min-height: 68px !important;
  padding: 10px 12px !important;
}

.music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) .music-notification-main {
  grid-template-columns: minmax(0, 1fr) !important;
  min-height: 36px !important;
  padding: 7px 14px !important;
}

.music-notification[data-music-surface] .music-notification-title {
  color: var(--text) !important;
  font-size: 14px !important;
  line-height: 1.1 !important;
}

.music-notification[data-music-surface] .music-notification-time, .music-notification[data-music-surface] .music-notification-artist {
  color: var(--muted) !important;
}

.music-notification[data-music-surface] .music-notification-play, .music-notification[data-music-surface] .music-notification-stop, .music-notification[data-music-surface] .music-notification-close {
  display: inline-grid !important;
  place-items: center !important;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border) 66%) !important;
  background: color-mix(in srgb, var(--panel2) 78%, transparent) !important;
  color: var(--text) !important;
}

.music-notification[data-music-surface] .music-notification-volume {
  display: block !important;
}

.music-notification[data-music-surface].playing .music-notification-play {
  background: var(--accent) !important;
  color: var(--accent-text) !important;
}

.music-notification[data-music-surface] .music-notification-seek {
  height: 10px !important;
  background:
    linear-gradient(90deg,
      var(--accent) 0 var(--music-progress, 0%),
      color-mix(in srgb, var(--text) 18%, transparent) var(--music-progress, 0%) 100%) !important;
}

.music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) .music-notification-play, .music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) .music-notification-artist, .music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) .music-notification-seek, .music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) .music-notification-time, .music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) .music-notification-volume, .music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) .music-notification-stop, .music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) .music-notification-close {
  display: none !important;
}

.music-notification[data-music-surface="chat"] {
  order: 1;
}

#pinnedBar, #chatSearchBar, #messages, #typingBar, #replyBar, #editBar, #messageInput, #appStatusBar {
  order: 2;
}

.music-notification[data-music-surface="menu"] {
  order: 4;
}

.music-notification[data-music-surface="profile"] {
  margin-top: 0 !important;
}

body.encrypted-temple-mode .music-notification {
  display: none !important;
}

.music-notification-cover {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 18px;
  font-weight: 950;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent),
    color-mix(in srgb, var(--panel2) 86%, #000 14%);
  background-position: center;
  background-size: cover;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border) 70%);
  overflow: hidden;
}

.music-notification-cover.has-cover span {
  display: none;
}

body > .music-notification .music-notification-main, .music-notification[data-music-surface] .music-notification-main {
  grid-template-columns: 48px 44px minmax(0, 1fr) 74px auto auto !important;
}

body > .music-notification:not(:hover):not(.music-notification-expanded) .music-notification-cover, .music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) .music-notification-cover {
  display: none !important;
}

#profileHome .scp-profile-strip.hidden, #profileHome .scp-profile-block.hidden, #profileHome .scp-profile-line.hidden, #profileHome .scp-profile-share-row.hidden, #profileHome .scp-profile-island > .hidden, #profileHome .profile-empty-field.hidden {
  display: none !important;
}

#profileHome:not(.show-empty-profile-sections) .profile-empty-field.hidden, #profileHome:not(.show-empty-profile-sections) .scp-profile-island:empty {
  display: none !important;
}

body.mobile-chat-open #messageInput {
  gap: 6px !important;
}

body.mobile-chat-open #messageInput .input-wrapper {
  flex: 1 1 auto !important;
  border-right: 0 !important;
  margin-right: 0 !important;
}

body.mobile-chat-open #sendBtn {
  margin-left: 0 !important;
  transform: none !important;
}

@media (max-width: 768px) {
  .music-notification[data-music-surface] {
    width: calc(100% - 36px) !important;
    margin-top: 7px !important;
    margin-bottom: 9px !important;
  }

  .music-notification[data-music-surface]:not(:hover):not(.music-notification-expanded) {
    width: min(360px, calc(100% - 52px)) !important;
  }
}

.message.local-sending {
  opacity: 0.76;
}

.message.local-failed {
  outline: 1px solid color-mix(in srgb, #ff5b5b 48%, transparent);
}

.message-status.pending {
  color: var(--muted);
}

.message-status.queued {
  color: color-mix(in srgb, var(--accent) 58%, var(--muted));
}

.message-status.delivered {
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
}

.message-status.failed {
  color: #ff6b6b;
}

.message.multi-selected {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 3px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.chat-multi-select-bar {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 74;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 560px);
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, #000 8%);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.chat-multi-select-bar.hidden {
  display: none !important;
}

.chat-multi-select-bar strong {
  white-space: nowrap;
  font-size: 13px;
}

.chat-multi-select-actions {
  display: flex;
  gap: 8px;
}

.chat-multi-select-actions button, .transfer-indicator-cancel {
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 10px;
  cursor: pointer;
}

.transfer-indicator-cancel.hidden {
  display: none !important;
}

.reply-preview-clickable {
  cursor: pointer;
  transition: background 0.14s ease, transform 0.14s ease, border-color 0.14s ease;
}

.reply-preview-clickable:hover, .reply-preview-clickable:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  transform: translateY(-1px);
}

.message-retry-btn {
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, #ff6b6b 18%, transparent);
  color: #ff8a8a;
  padding: 2px 7px;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
}

.message-retry-btn:hover, .message-retry-btn:focus-visible {
  background: color-mix(in srgb, #ff6b6b 30%, transparent);
  color: #ffd0d0;
}

.message-date-separator {
  align-self: center;
  position: sticky;
  top: 8px;
  z-index: 3;
  margin: 10px 0 6px;
  padding: 5px 12px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 88%, transparent);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.message-new-separator {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.message-new-separator::before, .message-new-separator::after {
  content: "";
  height: 1px;
  flex: 1;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.message.grouped-with-prev {
  margin-top: -5px;
}

.message.grouped-with-prev .sender {
  display: none;
}

.message.in.message-group-first, .message.in.message-group-middle {
  border-bottom-left-radius: 9px;
}

.message.in.message-group-middle, .message.in.message-group-last {
  border-top-left-radius: 9px;
}

.message.out.message-group-first, .message.out.message-group-middle {
  border-bottom-right-radius: 9px;
}

.message.out.message-group-middle, .message.out.message-group-last {
  border-top-right-radius: 9px;
}

.chat-scroll-bottom-btn {
  position: absolute;
  right: 22px;
  bottom: 86px;
  z-index: 24;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 46%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 86%, #000 14%);
  color: var(--text);
  font-size: 19px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 10px 30px color-mix(in srgb, #000 34%, transparent);
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.chat-scroll-bottom-btn.has-new {
  background: var(--accent);
  color: #1a1208;
}

.chat-scroll-bottom-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
}

.chat-scroll-bottom-btn:not(.hidden):hover {
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .chat-scroll-bottom-btn {
    right: 18px;
    bottom: 78px;
  }
}

.music-platform-view {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: block;
  min-height: 100dvh;
  background: var(--scp-mock-bg) !important;
  color: var(--text);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.music-platform-view.hidden {
  display: none !important;
}

.music-platform-shell {
  width: min(720px, 100%) !important;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 24px calc(110px + env(safe-area-inset-bottom, 0px)) !important;
  padding-inline: 12px !important;
}

.music-platform-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  min-height: 136px !important;
  margin: 0 -12px 12px !important;
  padding: 28px 12px 26px !important;
  border-radius: 0 0 14px 14px !important;
  background: var(--scp-mock-card) !important;
}

.music-platform-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid color-mix(in srgb, var(--text) 26%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  color: var(--text);
  font-weight: 950;
  cursor: pointer;
}

.music-platform-back img {
  width: 18px;
  height: 18px;
  filter: var(--scp-icon-filter, none);
}

.music-platform-heading {
  min-width: 0;
}

.music-platform-heading h2 {
  margin: 0;
  font-size: 46px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  color: var(--text) !important;
}

.music-platform-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.music-platform-content {
  display: grid;
  gap: 14px;
}

.music-platform-now {
  display: flex !important;
  gap: 0 !important;
  padding: 0 !important;
  flex-direction: column !important;
}

.music-platform-cover {
  display: grid;
  place-items: center;
  width: 100% !important;
  justify-self: center;
  aspect-ratio: 1 / 1;
  border: 0 !important;
  border-radius: 26px !important;
  background: var(--scp-mock-card) !important;
  overflow: hidden;
  order: 1 !important;
  max-width: none !important;
}

.music-platform-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-platform-cover span {
  color: var(--text) !important;
  font-size: 30px !important;
  font-weight: 950 !important;
  max-width: 90% !important;
  line-height: 1.05 !important;
  text-align: center !important;
  text-transform: lowercase !important;
}

.music-platform-title-card, .music-platform-subtitle, .music-platform-search, .music-platform-status, .music-platform-track, .music-platform-profile-btn {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--panel) 86%, #000 14%);
}

.music-platform-title-card {
  display: grid;
  place-items: start !important;
  width: 100%;
  min-height: 86px !important;
  padding: 8px 0 18px !important;
  border-radius: 0 !important;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: left !important;
  order: 2 !important;
  border: 0 !important;
  background: transparent !important;
}

.music-platform-title-card h3 {
  width: 100%;
  margin: 0;
  overflow: hidden;
  font-size: 34px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text) !important;
  text-transform: lowercase !important;
}

.music-platform-title-card p {
  margin: 4px 0 0;
  color: var(--text) !important;
  font-size: 20px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  margin-top: 4px !important;
  text-transform: lowercase !important;
}

.music-platform-subtitle {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 82px;
  padding: 10px 16px;
  border-radius: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
  font-weight: 900;
  text-align: center;
}

.music-platform-subtitle.disabled {
  opacity: 0.64;
}

.music-platform-lyric-line {
  display: block;
  min-height: 1.15em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-platform-lyric-line.previous, .music-platform-lyric-line.next {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
  font-size: 12px;
  opacity: 0.72;
}

.music-platform-lyric-line.current {
  color: var(--text);
  font-size: 15px;
  line-height: 1.1;
  font-weight: 950;
}

.music-platform-subtitle[data-lyric-tone="melody"] .music-platform-lyric-line.current, .music-platform-subtitle[data-lyric-tone="loading"] .music-platform-lyric-line.current {
  color: color-mix(in srgb, var(--accent) 74%, var(--text));
}

.music-platform-controls {
  display: grid !important;
  grid-template-columns: 48px 48px 64px 48px 48px !important;
  align-items: center;
  gap: 14px !important;
  width: 100% !important;
  margin: 2px auto 22px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  order: 5 !important;
  justify-content: center !important;
}

.music-platform-controls button, .music-platform-profile-btn, .music-platform-search button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-weight: 950;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.music-platform-controls button {
  display: grid;
  place-items: center;
  min-height: 48px !important;
  color: var(--text) !important;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
}

.music-platform-controls .music-platform-main-play {
  display: grid;
  place-items: center;
  width: 64px !important;
  height: 64px !important;
  background: transparent !important;
  color: var(--text) !important;
  box-shadow: none !important;
  min-width: 64px !important;
  min-height: 64px !important;
}

.music-platform-icon {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.music-platform-main-play .music-platform-icon, .music-platform-track.active .music-platform-icon {
  fill: currentColor;
  stroke-width: 0;
}

.music-platform-progress-row {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-items: center;
  gap: 12px !important;
  color: var(--text) !important;
  font-size: 20px !important;
  font-weight: 950 !important;
  order: 3 !important;
  margin: 18px 0 12px !important;
  line-height: 1 !important;
  margin-bottom: 92px !important;
}

.music-platform-progress-row input {
  width: 100%;
  accent-color: var(--text) !important;
  height: 18px !important;
}

.music-platform-profile-btn {
  width: min(340px, 100%);
  min-height: 46px;
  margin: 0 auto;
  padding: 10px 16px;
}

.music-platform-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 54px;
  padding: 8px;
  border-radius: 18px;
}

.music-platform-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
  outline: none;
}

.music-platform-search button {
  min-width: 76px;
  padding: 0 14px;
  background: var(--accent);
  color: var(--accent-text);
}

.music-platform-status {
  min-height: 36px;
  padding: 9px 12px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.music-platform-results {
  display: grid;
  gap: 8px;
}

.music-platform-file-input {
  display: none !important;
}

.music-platform-source-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.music-platform-source-row button {
  min-height: 46px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 80%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  cursor: pointer;
}

.music-platform-track {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 9px 12px;
  border-radius: 18px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 78px;
}

.music-platform-artist {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 86%, #000 14%);
}

.music-platform-artist-main {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.music-platform-artist-avatar, .music-platform-artist-profile-avatar {
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  overflow: hidden;
}

.music-platform-artist-avatar {
  width: 58px;
  height: 58px;
}

.music-platform-artist-avatar img, .music-platform-artist-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-platform-artist-main strong, .music-platform-artist-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-platform-artist-main strong {
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
}

.music-platform-artist-main small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.music-platform-artist-subscribe {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.music-platform-artist-subscribe.active {
  background: var(--accent);
  color: var(--accent-text);
}

.music-platform-artist-profile {
  display: grid;
  gap: 12px;
}

.music-platform-artist-back {
  justify-self: start;
}

.music-platform-artist-profile-head {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 86%, #000 14%);
}

.music-platform-artist-profile-avatar {
  width: 92px;
  height: 92px;
  border-radius: 24px;
}

.music-platform-artist-profile h3 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(26px, 7vw, 40px);
  line-height: 1;
  font-weight: 950;
  text-overflow: ellipsis;
}

.music-platform-artist-profile p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.music-platform-artist-pills {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.music-platform-artist-pills span {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
}

.music-platform-track.active {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel) 88%);
}

.music-platform-track-cover {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  overflow: hidden;
}

.music-platform-track-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-platform-track-main {
  min-width: 0;
}

.music-platform-track-main strong, .music-platform-track-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-platform-track-main strong {
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
}

.music-platform-track-main small, .music-platform-track-time, .music-platform-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.music-platform-social-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(420px, 100%);
  margin: 0 auto;
}

.music-platform-social-actions button {
  display: inline-grid;
  grid-template-columns: auto minmax(0, auto);
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  cursor: pointer;
}

.music-platform-playlist {
  display: grid;
  gap: 8px;
}

.music-platform-playlist h3 {
  margin: 5px 4px 1px;
  color: var(--text);
  font-size: clamp(19px, 5vw, 26px);
  line-height: 1;
  font-weight: 950;
}

.music-platform-track-actions {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 74px;
}

.music-platform-mini-actions {
  display: inline-flex;
  gap: 5px;
}

.music-platform-mini-actions span {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  min-width: 28px;
  padding: 4px 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 999px;
  color: var(--text);
  font-size: 10px;
  line-height: 1;
  font-weight: 950;
}

.music-platform-mini-actions .music-platform-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke-width: 0;
}

.music-platform-detail {
  display: grid;
  gap: 12px;
}

.music-platform-detail-back {
  justify-self: start;
}

.music-platform-subscriptions > div {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 6px;
}

.music-platform-subscriptions span {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 80%, transparent);
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
}

.music-platform-empty {
  padding: 18px;
  text-align: center;
}

.instant-loading-toast {
  position: fixed;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top, 0px));
  z-index: 2600;
  max-width: min(360px, calc(100vw - 28px));
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel2) 92%, #000 8%);
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
  pointer-events: none;
}

.instant-loading-toast.hidden {
  display: none !important;
}

body.music-platform-mode #layout {
  pointer-events: none;
}

body.music-platform-mode .create-chat-btn, body.music-platform-mode #createChatBtn, body.music-platform-mode #createChatBtn.create-chat-btn.scp-main-menu-plus, body.music-platform-mode #chatList.scp-main-menu .create-chat-btn, body.music-platform-mode #chatList.scp-main-menu .scp-main-menu-plus {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.music-platform-mode .scp-mobile-tab-bar {
  display: grid !important;
}

@media (max-width: 768px) {
  .scp-mobile-tab-bar {
    width: min(244px, calc(100vw - 44px)) !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  .scp-mobile-tab-button {
    width: 42px !important;
    min-width: 42px !important;
  }

  .scp-mobile-tab-icon-music {
    --scp-tab-icon-url: url("icons/tab-music.svg");
  }

  .scp-mobile-tab-icon-music::before {
    content: "";
    position: absolute;
    inset: 3px;
    background: currentColor !important;
    -webkit-mask: var(--scp-tab-icon-url) center / contain no-repeat;
    mask: var(--scp-tab-icon-url) center / contain no-repeat;
  }

  .scp-mobile-tab-icon-music img {
    opacity: 1;
  }

  .music-platform-view {
    z-index: 110;
  }

  .music-platform-shell {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 10px calc(100px + env(safe-area-inset-bottom, 0px));
  }

  .music-platform-header {
    margin-bottom: 10px;
  }

  .music-platform-cover {
    width: min(100%, calc(100vw - 20px));
  }

  .music-platform-title-card {
    min-height: 78px;
  }

  .music-platform-controls {
    width: min(348px, calc(100vw - 24px));
    grid-template-columns: 1fr 40px 56px 40px 1fr;
  }

  .music-platform-track {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .music-platform-track-actions {
    display: none;
  }

  .music-platform-social-actions {
    grid-template-columns: 1fr;
  }

  .music-platform-source-row {
    grid-template-columns: 1fr;
  }

  .music-platform-artist {
    grid-template-columns: minmax(0, 1fr);
  }

  .music-platform-artist-subscribe {
    width: 100%;
  }

  .music-platform-artist-profile-head {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .music-platform-artist-profile-avatar {
    width: 74px;
    height: 74px;
  }
}

#profileHome .scp-profile-badge-strip.has-badge-icons strong, .scp-profile-badge-strip.has-badge-icons strong {
  display: none !important;
}

#chatList.scp-main-menu .emoji-status, #profileHome .emoji-status, .emoji-status {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: inherit !important;
}

.message.frameless-message, .message.sticker-only {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 2px 0 !important;
  color: var(--text) !important;
  max-width: min(420px, 82vw) !important;
}

.message.frameless-message.in, .message.frameless-message.out, .message.sticker-only.in, .message.sticker-only.out {
  border-radius: 0 !important;
}

.message.frameless-message::before, .message.sticker-only::before, .message.frameless-message.in::before, .message.frameless-message.out::before, .message.sticker-only.in::before, .message.sticker-only.out::before {
  display: none !important;
}

.message.frameless-message .content, .message.sticker-only .content {
  overflow: visible !important;
  background: transparent !important;
  box-shadow: none !important;
}

.message.frameless-message .meta, .message.sticker-only .meta {
  width: fit-content !important;
  margin-top: 4px !important;
  padding: 2px 7px !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--panel2) 72%, transparent) !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}

.message.frameless-message.out .meta, .message.sticker-only.out .meta {
  margin-left: auto !important;
}

.message.frameless-message.emoji-only {
  max-width: min(160px, 48vw) !important;
}

.message.frameless-message.emoji-only .content {
  display: grid;
  justify-items: center;
}

.message.frameless-message .image-attachment, .message.frameless-message canvas.image-attachment {
  max-width: min(360px, 82vw) !important;
}

.message.frameless-message .file-attachment-card {
  max-width: min(360px, 82vw) !important;
}

.message.frameless-message .sticker-message, .message.sticker-only .sticker-message {
  max-width: min(250px, 64vw) !important;
}

@media (max-width: 768px) {
  body.mobile-chat-open .message.frameless-message, body.mobile-chat-open .message.sticker-only, body.mobile-chat-open .message:has(.image-attachment), body.mobile-chat-open .message:has(.yt-video-player), body.mobile-chat-open .message:has(.tg-video-note-player), body.mobile-chat-open .message:has(.sticker-message) {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: var(--text) !important;
    padding: 2px 0 !important;
    max-width: min(82vw, 360px) !important;
  }

  body.mobile-chat-open .message.frameless-message::before, body.mobile-chat-open .message.sticker-only::before, body.mobile-chat-open .message:has(.image-attachment)::before, body.mobile-chat-open .message:has(.yt-video-player)::before, body.mobile-chat-open .message:has(.tg-video-note-player)::before, body.mobile-chat-open .message:has(.sticker-message)::before {
    display: none !important;
  }

  body.mobile-chat-open .message.frameless-message .content, body.mobile-chat-open .message.sticker-only .content, body.mobile-chat-open .message:has(.image-attachment) .content, body.mobile-chat-open .message:has(.yt-video-player) .content, body.mobile-chat-open .message:has(.tg-video-note-player) .content, body.mobile-chat-open .message:has(.sticker-message) .content {
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  body.mobile-chat-open .message.frameless-message .meta, body.mobile-chat-open .message.sticker-only .meta, body.mobile-chat-open .message:has(.image-attachment) .meta, body.mobile-chat-open .message:has(.yt-video-player) .meta, body.mobile-chat-open .message:has(.tg-video-note-player) .meta, body.mobile-chat-open .message:has(.sticker-message) .meta {
    width: fit-content !important;
    margin-top: 4px !important;
    margin-left: auto !important;
    padding: 2px 7px !important;
    border-radius: 999px !important;
    background: color-mix(in srgb, var(--panel2) 72%, transparent) !important;
    color: var(--muted) !important;
  }
}

.rich-composer-preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 0 12px;
  overflow: hidden;
  pointer-events: none;
  color: var(--text);
}

.rich-composer-preview.hidden {
  display: none !important;
}

#textInput.has-rich-emoji-preview {
  position: relative;
  z-index: 2;
  color: transparent !important;
  caret-color: var(--text);
  background: transparent !important;
}

#textInput.has-rich-emoji-preview::placeholder {
  color: transparent !important;
}

.private-rich-text {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
}

.private-rich-text.mine {
  color: var(--accent-text);
}

.private-rich-text.composer-rich-text {
  flex-wrap: nowrap;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-custom-emoji {
  width: 1.35em;
  height: 1.35em;
  object-fit: contain;
  vertical-align: -0.25em;
  flex: 0 0 auto;
}

.shared-pack-modal {
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1800;
}

.shared-pack-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(330px, calc(100vw - 36px));
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border) 76%);
  border-radius: 24px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.shared-pack-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel2);
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
}

.shared-pack-preview {
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 24px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
}

.shared-pack-preview img, .shared-pack-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shared-pack-preview span {
  font-size: 74px;
}

.shared-pack-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-height: min(310px, 42vh);
  overflow: auto;
  padding: 4px;
}

.shared-pack-grid-item {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border) 86%);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  font-size: 30px;
}

.shared-pack-grid-item img, .shared-pack-grid-item video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shared-pack-body {
  display: grid;
  gap: 3px;
  text-align: center;
}

.shared-pack-body strong {
  font-size: 20px;
  font-weight: 950;
}

.shared-pack-body span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.shared-pack-add {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 950;
}

#backBtn, #chatActions .action-btn {
  width: 64px;
  min-width: 64px;
  height: 64px;
  min-height: 64px;
  border-radius: 999px;
  background: var(--scp-chat-pill);
  color: var(--scp-chat-icon);
  box-shadow: var(--scp-chat-shadow);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

#backBtn:hover, #chatActions .action-btn:hover {
  background: color-mix(in srgb, var(--scp-chat-pill) 72%, var(--accent) 28%);
  transform: translateY(-1px);
}

#chatActions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

#backBtn, #chatManageBtn, #stickerToggleBtn, #fileAttachBtn, #voiceRecordBtn, #sendBtn {
  position: relative;
  overflow: hidden;
}

#backBtn {
  --scp-icon-url: url("icons/angle-left.svg");
}

#chatManageBtn {
  --scp-icon-url: url("icons/menu-burger.svg");
}

#backBtn > img, #chatManageBtn > img, #stickerToggleBtn > img, #fileAttachBtn > img, #voiceRecordBtn > img, #sendBtn > img {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#backBtn::before, #chatManageBtn::before, #stickerToggleBtn::before, #fileAttachBtn::before, #voiceRecordBtn::before, #sendBtn::before {
  content: "";
  width: 28px;
  height: 28px;
  display: block;
  background: currentColor;
  -webkit-mask: var(--scp-icon-url) center / contain no-repeat;
  mask: var(--scp-icon-url) center / contain no-repeat;
}

#chatManageBtn::before {
  width: 34px;
  height: 28px;
}

#textInput:focus {
  border: 0;
  background: transparent;
}

#textInput::placeholder {
  color: var(--muted);
  opacity: 1;
}

#messageInput .composer-media-btn, #sendBtn {
  width: 52px;
  min-width: 52px;
  height: 52px;
  min-height: 52px;
  border-radius: 999px;
  color: var(--scp-chat-icon);
  background: transparent;
  transition: opacity 0.16s ease, background 0.18s ease, transform 0.18s ease;
}

#fileAttachInput {
  order: 3;
  display: none !important;
}

#messageInput #stickerToggleBtn.composer-media-btn, #messageInput #fileAttachBtn.composer-media-btn {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--scp-chat-muted-icon) !important;
}

#messageInput #stickerToggleBtn.composer-media-btn:hover, #messageInput #fileAttachBtn.composer-media-btn:hover {
  background: transparent !important;
  color: var(--scp-chat-icon) !important;
  transform: none;
}

#voiceRecordBtn, #sendBtn {
  background: var(--scp-chat-action);
  color: var(--scp-chat-action-text);
}

#messageInput:not(.composer-has-text) #sendBtn {
  display: none !important;
}

#messageInput.composer-has-text #fileAttachBtn, #messageInput.composer-has-text #voiceRecordBtn {
  display: none !important;
}

#messageInput.composer-has-text #sendBtn {
  display: inline-flex !important;
}

.message.group-message-with-avatar {
  position: relative;
  margin-left: 44px;
  overflow: visible;
}

.message.group-message-with-avatar .message-author-avatar {
  position: absolute;
  left: -44px;
  bottom: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background-color: var(--avatar-bg);
  color: var(--avatar-text);
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.message.group-message-with-avatar.show-author-avatar .message-author-avatar {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  body.mobile-chat-open #chat {
    height: 100dvh !important;
    max-height: 100dvh !important;
    background: var(--scp-chat-soft-bg) !important;
  }

  body.mobile-chat-open #chatHeader {
    min-height: 92px !important;
    height: 92px !important;
    display: grid !important;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 8px !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  body.mobile-chat-open #backBtn, body.mobile-chat-open #chatActions .action-btn {
    position: relative !important;
    inset: auto !important;
    width: 52px !important;
    min-width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
    border: 0 !important;
    background: var(--scp-chat-pill) !important;
    color: var(--scp-chat-icon) !important;
  }

  body.mobile-chat-open #chatActions {
    display: flex !important;
    gap: 6px;
  }

  body.mobile-chat-open #chatActions .action-btn:not(#chatManageBtn) {
    display: none !important;
  }

  body.mobile-chat-open .chat-user {
    min-height: 52px;
    padding: 8px 12px;
    gap: 8px;
  }

  body.mobile-chat-open .chat-user .avatar {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
  }

  body.mobile-chat-open .chat-user .name {
    max-width: 100%;
    font-size: 22px !important;
  }

  body.mobile-chat-open .chat-user .status {
    max-width: 100%;
    font-size: 10px !important;
  }

  body.mobile-chat-open #messages {
    flex: 1 1 auto !important;
    height: auto !important;
    padding: 14px 12px calc(96px + env(safe-area-inset-bottom, 0px) + var(--scp-keyboard-offset, 0px)) !important;
    background: transparent !important;
  }

  body.mobile-chat-open #messageInput {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px) + var(--scp-keyboard-offset, 0px)) !important;
    min-height: 58px !important;
    margin: 0 !important;
    padding: 6px 7px !important;
    border: 1px solid var(--scp-composer-border) !important;
    border-radius: 999px !important;
    background: var(--scp-composer-bg) !important;
    transition: bottom 0.18s ease;
  }

  body.mobile-chat-open #messageInput .input-wrapper {
    min-height: 46px !important;
    border: 1px solid var(--scp-composer-border) !important;
    border-radius: 999px !important;
    background: var(--scp-composer-input-bg) !important;
  }

  body.mobile-chat-open #textInput {
    height: 46px !important;
    min-height: 46px !important;
    font-size: 18px !important;
  }

  body.mobile-chat-open #messageInput .composer-media-btn, body.mobile-chat-open #sendBtn {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    border: 0 !important;
  }

  body.mobile-chat-open #sendBtn {
    border-radius: 100px !important;
  }

  body.mobile-chat-open #messageInput #stickerToggleBtn.composer-media-btn, body.mobile-chat-open #messageInput #fileAttachBtn.composer-media-btn {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--scp-chat-muted-icon) !important;
  }

  body.mobile-chat-open #messageInput:not(.composer-has-text) #sendBtn {
    display: none !important;
  }

  body.mobile-chat-open #messageInput.composer-has-text #fileAttachBtn.composer-media-btn, body.mobile-chat-open #messageInput.composer-has-text #voiceRecordBtn.composer-media-btn {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  body.mobile-chat-open #messageInput.composer-has-text #sendBtn {
    display: inline-flex !important;
    border-radius: 100px !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  body.mobile-chat-open .message.group-message-with-avatar {
    margin-left: 40px;
  }

  body.mobile-chat-open .message.group-message-with-avatar .message-author-avatar {
    left: -40px;
    width: 30px;
    height: 30px;
    font-size: 11px;
  }
}

#profileHome.scp-profile-v3 .scp-profile-v3-identity.has-wallpaper {
  isolation: isolate !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-wallpaper {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: inherit !important;
  object-fit: cover !important;
  pointer-events: none !important;
  z-index: 0 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-identity.has-wallpaper::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  border-radius: inherit !important;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.22) 48%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(90deg, color-mix(in srgb, var(--profile-v3-card) 82%, transparent), transparent 64%) !important;
  pointer-events: none !important;
  z-index: 0 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-identity.has-wallpaper > :not(.scp-profile-v3-wallpaper) {
  position: relative !important;
  z-index: 1 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-identity.has-wallpaper .scp-profile-v3-title h1, #profileHome.scp-profile-v3 .scp-profile-v3-identity.has-wallpaper .scp-profile-v3-title #profileHomeTag, #profileHome.scp-profile-v3 .scp-profile-v3-identity.has-wallpaper .scp-profile-v3-title .scp-profile-v3-id {
  text-shadow: 0 1px 3px color-mix(in srgb, #000 68%, transparent) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-qr img {
  grid-column: 1 / -1 !important;
  grid-row: 1 / -1 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block !important;
  object-fit: contain !important;
  border-radius: 2px !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-qr span {
  min-width: 0 !important;
  min-height: 0 !important;
  border-radius: 1px !important;
  background: transparent !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-qr span.filled {
  background: #111 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-badges.hidden {
  display: none !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-qr, #profileHome.scp-profile-v3 .scp-profile-v3-clickable {
  cursor: pointer !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-qr.copied {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
}

#profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-card {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--profile-v3-line)) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-inline-input {
  width: 100% !important;
  min-width: 0 !important;
  border: 0.5px solid color-mix(in srgb, var(--accent) 55%, var(--profile-v3-line)) !important;
  border-radius: 10px !important;
  background: var(--input-bg, var(--profile-v3-card-soft)) !important;
  color: var(--text) !important;
  font: inherit !important;
  font-weight: 750 !important;
  outline: none !important;
  padding: 9px 10px !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-inline-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-name-input {
  font-size: 28px !important;
  line-height: 1.05 !important;
  font-weight: 850 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-tag-input, #profileHome.scp-profile-v3 .scp-profile-v3-status-input {
  font-size: 15px !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-bio-input {
  min-height: 86px !important;
  resize: vertical !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-label {
  text-transform: uppercase !important;
  letter-spacing: 0 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-birth-icon {
  border: 0 !important;
  border-radius: 8px !important;
}

@media (max-width: 768px) {
  #profileHome.scp-profile-v3 {
    padding: 8px 8px calc(86px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-shell {
    width: 100% !important;
    gap: 10px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-identity {
    min-height: 174px !important;
    padding: 10px !important;
    grid-template-columns: 62px minmax(0, 1fr) 72px !important;
    grid-template-rows: auto auto auto !important;
    grid-template-areas:
        "avatar title qr"
        "badges badges badges"
        "actions actions actions" !important;
    gap: 8px !important;
    align-content: start !important;
    overflow: hidden !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-back {
    display: none !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-avatar {
    width: 62px !important;
    height: 62px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-title h1 {
    font-size: 24px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-name-input {
    font-size: 22px !important;
    padding: 7px 8px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-tag-input, #profileHome.scp-profile-v3 .scp-profile-v3-status-input {
    font-size: 14px !important;
    padding: 7px 8px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-title #profileHomeTag, #profileHome.scp-profile-v3 .scp-profile-v3-title .scp-profile-v3-id {
    font-size: 16px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-qr {
    width: 72px !important;
    min-width: 72px !important;
    height: 72px !important;
    min-height: 72px !important;
    padding: 3px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-badges {
    justify-content: flex-start !important;
    min-height: 22px !important;
    overflow: hidden !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-actions {
    width: 100% !important;
    min-height: 42px !important;
    justify-content: flex-end !important;
    flex-wrap: wrap !important;
    align-self: center !important;
    overflow: hidden !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-action, #profileHome.scp-profile-v3 .scp-profile-v3-photo-pick {
    min-height: 36px !important;
    padding: 0 13px !important;
    font-size: 14px !important;
    max-width: 100% !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-stat {
    min-height: 88px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-channel-row, #profileHome.scp-profile-v3 .scp-profile-v3-birth-row {
    grid-template-columns: 66px minmax(0, 1fr) !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-channel-avatar, #profileHome.scp-profile-v3 .scp-profile-v3-birth-icon {
    width: 66px !important;
    height: 66px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-channel-row strong {
    font-size: 24px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-empty-posts {
    min-height: 220px !important;
  }
}

@media (max-width: 430px) {
  #profileHome.scp-profile-v3 .scp-profile-v3-identity {
    min-height: 168px !important;
    grid-template-columns: 56px minmax(0, 1fr) 64px !important;
    gap: 7px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-avatar {
    width: 56px !important;
    height: 56px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-title h1 {
    font-size: 21px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-name-input {
    font-size: 19px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-title #profileHomeTag, #profileHome.scp-profile-v3 .scp-profile-v3-title .scp-profile-v3-id {
    font-size: 14px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-qr {
    width: 64px !important;
    min-width: 64px !important;
    height: 64px !important;
    min-height: 64px !important;
  }
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-picker {
  width: auto !important;
  min-width: 0 !important;
  display: inline-flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0 !important;
  position: relative !important;
  overflow: visible !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-option {
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center !important;
  border: 0.5px solid var(--profile-v3-line) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--profile-v3-card-soft, var(--panel2)) 86%, transparent) !important;
  color: var(--text) !important;
  font-size: 17px !important;
  line-height: 1 !important;
  font-weight: 800 !important;
  cursor: pointer !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-option.active {
  border-color: transparent !important;
  background: var(--accent) !important;
  color: var(--profile-v3-on-accent) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-clear {
  color: var(--profile-v3-muted) !important;
  font-size: 14px !important;
  text-transform: uppercase !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-option.is-custom-image img {
  width: 22px !important;
  height: 22px !important;
  border-radius: 7px !important;
  object-fit: cover !important;
  display: block !important;
}

@media (min-width: 769px) {
  #profileHome.scp-profile-v3 .scp-profile-v3-identity .scp-profile-v3-back, #profileHome.scp-profile-v3 .scp-profile-v3-identity.has-wallpaper > .scp-profile-v3-back {
    position: absolute !important;
    left: -66px !important;
    top: 0 !important;
    z-index: 4 !important;
    transform: none !important;
  }
}

@media (max-width: 768px) {
  #profileHome.scp-profile-v3 .scp-profile-v3-status-picker {
    gap: 5px !important;
    max-height: 66px !important;
    overflow: auto !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-status-option {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    font-size: 16px !important;
  }
}

#chatList.scp-main-menu, body.settings-home-mode #settingsHome, .music-platform-view {
  --scp-mock-bg: var(--bg) !important;
  --scp-mock-card: var(--panel) !important;
  --scp-mock-muted: var(--muted) !important;
  --scp-mock-icon-1: color-mix(in srgb, var(--accent) 32%, var(--panel2) 68%) !important;
  --scp-mock-icon-2: color-mix(in srgb, var(--accent) 26%, var(--panel2) 74%) !important;
  --scp-mock-icon-3: color-mix(in srgb, var(--accent) 38%, var(--panel2) 62%) !important;
  --scp-mock-icon-4: color-mix(in srgb, var(--accent) 22%, var(--panel2) 78%) !important;
  --scp-mock-icon-5: color-mix(in srgb, var(--accent) 44%, var(--panel2) 56%) !important;
  --scp-mock-icon-6: color-mix(in srgb, var(--accent) 30%, var(--panel2) 70%) !important;
  --scp-mock-icon-7: color-mix(in srgb, var(--accent) 24%, var(--panel2) 76%) !important;
  --scp-mock-icon-8: color-mix(in srgb, var(--accent) 48%, var(--panel2) 52%) !important;
  --scp-mock-card-soft: var(--panel2) !important;
  --scp-mock-line: var(--border) !important;
}

#chatList.scp-main-menu .chat-list-header {
  order: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 48px !important;
  padding: 24px 24px 24px !important;
  border: 0 !important;
  border-radius: 0 0 14px 14px !important;
  background: var(--scp-mock-card) !important;
  box-shadow: none !important;
}

#chatList.scp-main-menu .chat-list-header h2 {
  margin: 0 !important;
  color: var(--text) !important;
  font-size: 30px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  text-transform: none !important;
}

#chatList.scp-main-menu .chat-list-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

#chatList.scp-main-menu .chat-list-actions .profile-mobile-btn, #chatList.scp-main-menu .chat-list-actions .settings-mobile-btn {
  display: none !important;
}

#chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus {
  color: var(--text) !important;
}

#chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus .scp-create-icon-edit {
  display: block !important;
}

#chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus .scp-create-icon-plus {
  display: none !important;
}

#chatList.scp-main-menu .list-tabs, #chatList.scp-main-menu .scp-main-menu-top-island .list-tabs {
  display: none !important;
}

#chatList.scp-main-menu .list-search, #chatList.scp-main-menu .scp-main-menu-top-island .list-search {
  position: relative !important;
  display: block !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

#chatList.scp-main-menu .list-search::before {
  content: "" !important;
  position: absolute !important;
  left: 22px !important;
  top: 50% !important;
  width: 34px !important;
  height: 34px !important;
  color: var(--text) !important;
  background: currentColor !important;
  -webkit-mask: url("icons/search-login.svg") center / contain no-repeat;
  mask: url("icons/search-login.svg") center / contain no-repeat;
  transform: translateY(-50%) !important;
  pointer-events: none !important;
  z-index: 1 !important;
}

#chatList.scp-main-menu .chatItem .avatar, #chatList.scp-main-menu .scp-menu-feed-item .avatar {
  grid-column: 1 !important;
  width: 76px !important;
  height: 76px !important;
  min-width: 76px !important;
  min-height: 76px !important;
  border: 0 !important;
  border-radius: 20px !important;
  background: var(--avatar-bg, var(--scp-mock-card-soft)) !important;
  color: var(--avatar-text, var(--text)) !important;
  box-shadow: none !important;
}

#chatList.scp-main-menu .chatItem .info, #chatList.scp-main-menu .scp-menu-feed-item .info {
  grid-column: 2 !important;
  min-width: 0 !important;
  padding: 0 !important;
}

#chatList.scp-main-menu .chatItem .name, #chatList.scp-main-menu .scp-menu-feed-item .name {
  color: var(--text) !important;
  font-size: 25px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
}

#chatList.scp-main-menu .chatItem .last-message, #chatList.scp-main-menu .scp-menu-feed-item .last-message {
  margin-top: 4px !important;
  color: var(--scp-mock-muted) !important;
  font-size: 20px !important;
  line-height: 1.1 !important;
  font-weight: 850 !important;
}

#chatList.scp-main-menu .scp-chat-item-meta {
  grid-column: 3 !important;
  display: grid !important;
  justify-items: center !important;
  align-content: center !important;
  gap: 7px !important;
  min-width: 0 !important;
}

#chatList.scp-main-menu .scp-chat-item-time {
  max-width: 100% !important;
  color: var(--scp-mock-muted) !important;
  font-size: 20px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

#chatList.scp-main-menu .chatItem .avatar .chat-presence-dot, #chatList.scp-main-menu .scp-menu-feed-item .avatar .chat-presence-dot {
  right: -1px !important;
  bottom: -1px !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  border: 3px solid var(--scp-mock-card) !important;
  background: color-mix(in srgb, var(--text) 32%, transparent) !important;
}

body.settings-home-mode #settingsHome #settingsModal, body.settings-home-mode #settingsHome #settingsModal .modal-content, body.settings-home-mode #settingsHome #settingsModal .modal-body, body.settings-home-mode #settingsHome .tg-settings-shell {
  background: transparent !important;
}

body.settings-home-mode #settingsHome #settingsModal .modal-header {
  min-height: 104px !important;
  padding: 20px 22px 18px !important;
  border: 0 !important;
  border-radius: 0 0 14px 14px !important;
  background: var(--scp-mock-card) !important;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: flex-start !important;
}

body.settings-home-mode #settingsHome:not(.scp-settings-section-open) #settingsModal .modal-close {
  display: none !important;
}

body.settings-home-mode #settingsHome #settingsModal .modal-header h2 {
  color: var(--text) !important;
  font-size: 38px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  text-align: left !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav, body.settings-home-mode #settingsHome .tg-settings-nav.settings-scroll-nav {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  padding: 26px 14px calc(104px + env(safe-area-inset-bottom, 0px)) !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome .scp-settings-nav-section {
  margin: 20px 0 2px !important;
  color: var(--scp-mock-muted) !important;
  font-size: 18px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
}

body.settings-home-mode #settingsHome .scp-settings-nav-section:first-child {
  margin-top: 0 !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav button {
  min-height: 82px !important;
  display: grid !important;
  grid-template-columns: 64px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px !important;
  border: 0.5px solid color-mix(in srgb, var(--scp-mock-line) 48%, transparent) !important;
  border-radius: 8px !important;
  background: var(--scp-mock-card) !important;
  color: var(--text) !important;
  box-shadow: none !important;
  justify-items: start !important;
  justify-content: start !important;
  text-align: left !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav button.active, body.settings-home-mode #settingsHome .tg-settings-nav button:hover, body.settings-home-mode #settingsHome .tg-settings-nav button:focus-visible {
  background: var(--scp-mock-card) !important;
  color: var(--text) !important;
  outline: none !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav button.hidden {
  display: none !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon {
  display: grid !important;
  width: 64px !important;
  height: 64px !important;
  min-width: 64px !important;
  min-height: 64px !important;
  border-radius: 20px !important;
  background: var(--scp-mock-icon-1) !important;
  position: relative !important;
  place-items: center !important;
  color: color-mix(in srgb, var(--text) 86%, #000 14%) !important;
  overflow: hidden !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon::before, body.settings-home-mode #settingsHome .tg-settings-nav-icon::after {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  box-sizing: border-box !important;
  pointer-events: none !important;
}

body.settings-home-mode #settingsHome [data-settings-panel="privacy"] .tg-settings-nav-icon {
  background: var(--scp-mock-icon-2) !important;
}

body.settings-home-mode #settingsHome [data-settings-panel="chats"] .tg-settings-nav-icon {
  background: var(--scp-mock-icon-3) !important;
}

body.settings-home-mode #settingsHome [data-settings-panel="folders"] .tg-settings-nav-icon {
  background: var(--scp-mock-icon-4) !important;
}

body.settings-home-mode #settingsHome [data-settings-panel="media"] .tg-settings-nav-icon {
  background: var(--scp-mock-icon-5) !important;
}

body.settings-home-mode #settingsHome [data-settings-panel="advanced"] .tg-settings-nav-icon {
  background: var(--scp-mock-icon-6) !important;
}

body.settings-home-mode #settingsHome [data-settings-panel="language"] .tg-settings-nav-icon {
  background: var(--scp-mock-icon-7) !important;
}

body.settings-home-mode #settingsHome [data-settings-panel="encryptedTemple"] .tg-settings-nav-icon {
  background: var(--scp-mock-icon-8) !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav button span:not(.tg-settings-nav-icon) {
  color: var(--text) !important;
  font-size: 20px !important;
  line-height: 1.1 !important;
  font-weight: 900 !important;
  white-space: normal !important;
  justify-self: start !important;
  text-align: left !important;
}

.music-platform-header .music-platform-back {
  display: none !important;
}

.music-platform-heading p, .music-platform-subtitle, .music-platform-social-actions, .music-platform-search, .music-platform-source-row, .music-platform-status, .music-platform-playlist, .music-platform-profile-btn {
  display: none !important;
}

.music-platform-controls button:first-child, .music-platform-controls button:last-child {
  display: grid !important;
}

.music-platform-controls .music-platform-icon {
  width: 28px !important;
  height: 28px !important;
  stroke-width: 3.4 !important;
}

.music-platform-controls .music-platform-main-play .music-platform-icon {
  width: 38px !important;
  height: 38px !important;
}

@media (min-width: 769px) {
  #sidebar .create-chat-btn.scp-main-menu-plus .scp-create-icon-plus {
    display: block !important;
  }

  #sidebar .create-chat-btn.scp-main-menu-plus .scp-create-icon-edit {
    display: none !important;
  }
}

@media (max-width: 768px) {
  #chatList.scp-main-menu {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus {
    position: static !important;
    inset: auto !important;
    display: grid !important;
    place-items: center !important;
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    min-height: 58px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
  }

  #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus img {
    width: 58px !important;
    height: 58px !important;
    object-fit: contain !important;
    color: var(--text) !important;
  }
}

#chatList.scp-main-menu .chat-list-header h2, body.settings-home-mode #settingsHome #settingsModal .modal-header h2, .music-platform-heading h2 {
  font-size: 38px !important;
}

#chatList.scp-main-menu .chatItem .last-message, #chatList.scp-main-menu .scp-menu-feed-item .last-message, #chatList.scp-main-menu .scp-chat-item-time {
  font-size: 15px !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav {
  padding-inline: 10px !important;
}

@media (min-width: 769px) {
  #sidebar .sidebar-footer {
    position: relative !important;
    z-index: 1 !important;
  }

  #sidebar .create-chat-btn.scp-main-menu-plus.scp-sidebar-plus {
    position: relative !important;
    inset: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    top: auto !important;
    z-index: 2 !important;
    display: grid !important;
    place-items: center !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 0 4px !important;
    padding: 0 !important;
    border: 0.5px solid color-mix(in srgb, var(--accent) 34%, var(--border)) !important;
    border-radius: 50% !important;
    background: var(--accent) !important;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 24%, transparent) !important;
    transform: none !important;
  }

  #sidebar .create-chat-btn.scp-main-menu-plus.scp-sidebar-plus img {
    display: block !important;
    width: 30px !important;
    height: 30px !important;
    object-fit: contain !important;
    pointer-events: none !important;
  }
}

body.settings-home-mode #chatHeader, body.settings-home-mode #messages, body.settings-home-mode #messageInput, body.settings-home-mode #typingBar, body.settings-home-mode #replyBar, body.settings-home-mode #editBar, body.settings-home-mode #pinnedBar, body.settings-home-mode #chatSearchBar, body.settings-home-mode #appStatusBar {
  display: none !important;
}

body.settings-home-mode #settingsHome #settingsModal .modal-content {
  display: block !important;
  width: 100% !important;
  min-height: 100dvh !important;
  border: 0 !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome:not(.scp-settings-section-open) #settingsModal .modal-header h2 {
  font-size: 46px !important;
}

body.settings-home-mode #settingsHome #settingsModal .modal-body, body.settings-home-mode #settingsHome .tg-settings-shell {
  display: block !important;
  padding: 0 !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome:not(.scp-settings-section-open) #settingsModal .tg-settings-panels {
  display: none !important;
}

body.settings-home-mode #settingsHome:not(.scp-settings-section-open) .tg-settings-nav, body.settings-home-mode #settingsHome:not(.scp-settings-section-open) .tg-settings-nav.settings-scroll-nav {
  display: flex !important;
}

#chatList.scp-main-menu .chat-list-header, #chatList.scp-main-menu .list-search input, #chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item, body.settings-home-mode #settingsHome #settingsModal .modal-header, body.settings-home-mode #settingsHome .tg-settings-nav button, .music-platform-header, .music-platform-cover {
  border: 0.5px solid color-mix(in srgb, var(--scp-mock-line) 40%, transparent) !important;
  background: var(--scp-mock-card) !important;
}

@media (max-width: 768px) {
  body {
    --scp-mobile-bg: var(--bg) !important;
    --scp-mobile-panel: var(--panel) !important;
    --scp-mobile-line: var(--border) !important;
    --scp-mobile-cream: var(--text) !important;
    --scp-mobile-accent: var(--accent) !important;
  }

  html, body, #layout, #chat, #chatList, body.settings-home-mode #settingsHome, .music-platform-view {
    background: var(--bg) !important;
    color: var(--text) !important;
  }

  .scp-mobile-tab-bar {
    left: 50% !important;
    right: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 2400 !important;
    display: grid !important;
    grid-template-columns: repeat(4, 44px) !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    width: min(246px, calc(100vw - 42px)) !important;
    height: 64px !important;
    min-height: 64px !important;
    padding: 6px 12px !important;
    border: 0.5px solid color-mix(in srgb, var(--border) 56%, var(--accent) 20%) !important;
    border-radius: 18px !important;
    background: var(--panel) !important;
    box-shadow: 0 14px 30px color-mix(in srgb, #000 22%, transparent) !important;
    transform: translateX(-50%) !important;
    overflow: hidden !important;
  }

  .scp-mobile-tab-bar.hidden, body.mobile-chat-open:not(.settings-home-mode):not(.profile-home-mode) .scp-mobile-tab-bar, body.profile-home-mode #profileHome.scp-profile-peer ~ .scp-mobile-tab-bar {
    display: none !important;
  }

  .scp-mobile-tab-button {
    display: grid !important;
    place-items: center !important;
    justify-self: center !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 52px !important;
    min-height: 52px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--text) !important;
  }

  .scp-mobile-tab-button.active {
    color: var(--accent) !important;
  }

  .scp-mobile-tab-icon {
    position: relative !important;
    display: block !important;
    width: 42px !important;
    height: 42px !important;
    color: inherit !important;
  }

  .scp-mobile-tab-icon img {
    display: none !important;
  }

  .scp-mobile-tab-icon::before {
    content: "" !important;
    position: absolute !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: currentColor !important;
    clip-path: none !important;
    transform: none !important;
    -webkit-mask: var(--scp-tab-icon-url) center / contain no-repeat !important;
    mask: var(--scp-tab-icon-url) center / contain no-repeat !important;
  }

  .scp-mobile-tab-icon::after {
    content: none !important;
    display: none !important;
  }

  .scp-mobile-tab-icon-chats {
    --scp-tab-icon-url: url("icons/tab-chats.svg");
  }

  .scp-mobile-tab-icon-settings {
    --scp-tab-icon-url: url("icons/tab-settings.svg");
  }

  .scp-mobile-tab-icon-music {
    --scp-tab-icon-url: url("icons/tab-music.svg");
  }

  .scp-mobile-tab-icon-profile {
    --scp-tab-icon-url: url("icons/tab-profile.svg");
  }

  #chatList.scp-main-menu, body.settings-home-mode #settingsHome, .music-platform-shell {
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #chatList.scp-main-menu .list-search input {
    height: 86px !important;
    min-height: 86px !important;
    border: 0 !important;
    border-radius: 44px !important;
    background: var(--panel) !important;
    color: var(--text) !important;
    font-size: clamp(25px, 7vw, 38px) !important;
    font-weight: 950 !important;
  }

  #chatList.scp-main-menu .chatItem, #chatList.scp-main-menu .scp-menu-feed-item {
    min-height: 100px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: var(--panel) !important;
    color: var(--text) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button {
    justify-items: start !important;
    justify-content: start !important;
    min-height: 100px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: var(--panel) !important;
    text-align: left !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button span:not(.tg-settings-nav-icon) {
    justify-self: start !important;
    width: 100% !important;
    color: var(--text) !important;
    text-align: left !important;
  }
}

@media (max-width: 430px) {
  #chatList.scp-main-menu .chat-list-header, body.settings-home-mode #settingsHome #settingsModal .modal-header, .music-platform-header {
    min-height: 48px !important;
    padding: 22px 22px 22px !important;
  }

  #chatList.scp-main-menu .list-search input {
    height: 48px !important;
    min-height: 76px !important;
    padding-left: 82px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button {
    grid-template-columns: 64px minmax(0, 1fr) !important;
    min-height: 82px !important;
    gap: 12px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon {
    width: 64px !important;
    min-width: 64px !important;
    height: 64px !important;
    min-height: 64px !important;
    border-radius: 20px !important;
  }
}

#profileHome.scp-profile-v3.scp-profile-own .scp-profile-v3-back {
  display: none !important;
}

#profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-back {
  display: grid !important;
  place-items: center !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent !important;
}

#profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-back img {
  display: block !important;
  width: 22px !important;
  height: 22px !important;
  pointer-events: none !important;
}

@media (min-width: 769px) {
  #profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-identity .scp-profile-v3-back {
    position: absolute !important;
    left: -66px !important;
    top: 0 !important;
    z-index: 8 !important;
    width: 52px !important;
    min-width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
    border: 0.5px solid var(--profile-v3-line, var(--border)) !important;
    border-radius: 50% !important;
    background: var(--profile-v3-card, var(--panel)) !important;
    color: var(--text) !important;
  }
}

@media (max-width: 768px) {
  body.profile-home-mode #profileHome.scp-profile-v3.scp-profile-peer {
    padding-top: calc(72px + env(safe-area-inset-top, 0px)) !important;
  }

  #profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-identity .scp-profile-v3-back {
    position: fixed !important;
    left: max(14px, env(safe-area-inset-left, 0px)) !important;
    top: calc(14px + env(safe-area-inset-top, 0px)) !important;
    z-index: 2600 !important;
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    border: 0.5px solid color-mix(in srgb, var(--border) 58%, var(--accent) 18%) !important;
    border-radius: 50% !important;
    background: color-mix(in srgb, var(--panel) 90%, transparent) !important;
    color: var(--text) !important;
    box-shadow: 0 10px 24px color-mix(in srgb, #000 22%, transparent) !important;
    transform: none !important;
  }

  #profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-identity.has-wallpaper .scp-profile-v3-back {
    background: color-mix(in srgb, #000 42%, var(--panel) 58%) !important;
    color: #fff !important;
  }

  #profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-identity.has-wallpaper .scp-profile-v3-back img {
    filter: brightness(0) invert(1) !important;
  }
}

body.settings-home-mode #settingsHome .tg-settings-panels {
  display: none !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav button[aria-expanded="true"] {
  border-radius: 8px 8px 0 0 !important;
  background: var(--panel) !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav .scp-settings-inline-panel {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: -10px 0 10px !important;
  padding: 0 12px 12px !important;
  border: 0 !important;
  border-radius: 0 0 8px 8px !important;
  background: var(--panel) !important;
  color: var(--text) !important;
  overflow: hidden !important;
}

body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-panel {
  display: grid !important;
  gap: 10px !important;
  padding: 2px 0 0 !important;
}

body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-panel-head {
  display: none !important;
}

body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-group {
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--panel2) 78%, transparent) !important;
}

body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-setting-control.form-group {
  grid-template-columns: minmax(0, 1fr) minmax(160px, 240px) !important;
}

@media (min-width: 769px) {
  #sidebar .create-chat-btn.scp-main-menu-plus.scp-sidebar-plus .scp-create-icon-plus, #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus .scp-create-icon-plus {
    display: none !important;
  }

  #sidebar .create-chat-btn.scp-main-menu-plus.scp-sidebar-plus .scp-create-icon-edit, #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus .scp-create-icon-edit {
    display: block !important;
  }
}

@media (max-width: 768px) {
  #chatList.scp-main-menu .create-chat-btn.scp-main-menu-plus .scp-create-icon-plus, body > .create-chat-btn.scp-main-menu-plus .scp-create-icon-plus {
    display: none !important;
  }

  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus .scp-create-icon-edit {
    display: block !important;
  }

  #chatList.scp-main-menu > .create-chat-btn.scp-main-menu-plus, body > .create-chat-btn.scp-main-menu-plus {
    display: none !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-setting-control.form-group {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-setting-control input, body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-setting-control select {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }
}

@media (max-width: 768px) {
  .scp-mobile-tab-icon::before, .scp-mobile-tab-icon::after {
    content: none !important;
    display: none !important;
    -webkit-mask: none !important;
    mask: none !important;
  }

  .scp-mobile-tab-icon img {
    display: block !important;
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    object-fit: contain !important;
    opacity: 1 !important;
    visibility: visible !important;
    filter: brightness(0) saturate(100%) invert(92%) sepia(13%) saturate(357%) hue-rotate(333deg) brightness(105%) contrast(96%) !important;
  }

  .scp-mobile-tab-button.active .scp-mobile-tab-icon img {
    filter: brightness(0) saturate(100%) invert(64%) sepia(89%) saturate(795%) hue-rotate(337deg) brightness(102%) contrast(101%) !important;
  }
}

@media (max-width: 768px) {
  body.settings-home-mode #settingsHome .tg-settings-nav .scp-settings-inline-panel {
    margin: -8px 0 10px !important;
    padding: 10px 10px 12px !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-panel {
    gap: 8px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-group {
    overflow: hidden !important;
    border: 0.5px solid color-mix(in srgb, var(--border) 62%, transparent) !important;
    border-radius: 10px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-group-title {
    padding: 12px 12px 10px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-group-title strong {
    font-size: 16px !important;
    line-height: 1.12 !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-group-title span {
    font-size: 12px !important;
    line-height: 1.35 !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-row, body.settings-home-mode #settingsHome .scp-settings-inline-panel .privacy-choice-row, body.settings-home-mode #settingsHome .scp-settings-inline-panel .language-choice-row {
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr) !important;
    grid-template-areas:
        "icon text"
        "icon value" !important;
    align-items: center !important;
    min-height: 0 !important;
    height: auto !important;
    gap: 6px 10px !important;
    padding: 12px !important;
    transform: none !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-row-icon {
    grid-area: icon !important;
    align-self: start !important;
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    margin-top: 1px !important;
    border-radius: 50% !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .privacy-choice-row .tg-settings-row-icon::after {
    inset: 8px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-row-text {
    grid-area: text !important;
    display: grid !important;
    min-width: 0 !important;
    gap: 2px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-row-text strong {
    max-width: 100% !important;
    font-size: 15px !important;
    line-height: 1.14 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-row-text small {
    display: block !important;
    max-width: 100% !important;
    font-size: 11.5px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-row-value, body.settings-home-mode #settingsHome .scp-settings-inline-panel .privacy-choice-row .tg-settings-row-value {
    grid-area: value !important;
    justify-self: start !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 7px 12px !important;
    border-radius: 999px !important;
    font-size: 15px !important;
    line-height: 1 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-setting-control.form-group {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 7px !important;
    padding: 12px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-setting-control label {
    font-size: 15px !important;
    line-height: 1.15 !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-setting-hint {
    font-size: 11.5px !important;
    line-height: 1.3 !important;
  }
}

#profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-identity {
  overflow: visible !important;
  z-index: 30 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-picker > input {
  display: none !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-trigger {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  min-height: 32px !important;
  max-width: 150px !important;
  padding: 0 12px !important;
  border: 0.5px solid color-mix(in srgb, var(--accent) 46%, var(--profile-v3-line)) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--profile-v3-card-soft, var(--panel2)) 86%, transparent) !important;
  color: var(--text) !important;
  font-size: 14px !important;
  line-height: 1 !important;
  font-weight: 850 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-trigger.empty {
  color: var(--profile-v3-muted) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-trigger-glyph {
  display: inline-grid !important;
  place-items: center !important;
  min-width: 18px !important;
  font-size: 17px !important;
  line-height: 1 !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-trigger img {
  width: 20px !important;
  height: 20px !important;
  border-radius: 7px !important;
  object-fit: cover !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-cloud {
  position: absolute !important;
  left: 0 !important;
  top: calc(100% + 8px) !important;
  z-index: 120 !important;
  display: none !important;
  grid-template-columns: repeat(8, 32px) !important;
  gap: 7px !important;
  width: max-content !important;
  max-width: min(330px, calc(100vw - 36px)) !important;
  max-height: 238px !important;
  padding: 10px !important;
  overflow: auto !important;
  border: 0.5px solid color-mix(in srgb, var(--accent) 34%, var(--profile-v3-line)) !important;
  border-radius: 18px !important;
  background: color-mix(in srgb, var(--profile-v3-card, var(--panel)) 96%, transparent) !important;
  box-shadow: 0 18px 44px color-mix(in srgb, #000 34%, transparent) !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-picker.open .scp-profile-v3-status-cloud {
  display: grid !important;
}

#profileHome.scp-profile-v3 .scp-profile-v3-status-cloud .scp-profile-v3-status-option {
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
}

@media (max-width: 768px) {
  #profileHome.scp-profile-v3 .scp-profile-v3-status-trigger {
    min-height: 34px !important;
    max-width: 132px !important;
    padding-inline: 11px !important;
    font-size: 13px !important;
  }

  #profileHome.scp-profile-v3 .scp-profile-v3-status-cloud {
    grid-template-columns: repeat(6, 32px) !important;
    max-width: min(266px, calc(100vw - 28px)) !important;
    max-height: 228px !important;
    border-radius: 16px !important;
  }
}

.theme-presets button[data-theme-preset="graphite"] {
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.26), transparent 18%),
    linear-gradient(145deg, #f0b35f 0%, #24211d 42%, #0f0e0c 100%);
}

.theme-presets button[data-theme-preset="amoled"] {
  background:
    radial-gradient(circle at 78% 18%, rgba(67, 215, 255, 0.55), transparent 18%),
    linear-gradient(145deg, #111 0%, #000 72%, #43d7ff 160%);
}

.theme-presets button[data-theme-preset="midnight"] {
  background:
    radial-gradient(circle at 22% 16%, rgba(138, 180, 255, 0.48), transparent 20%),
    linear-gradient(145deg, #8ab4ff 0%, #151b2e 48%, #080c18 100%);
}

.theme-presets button[data-theme-preset="obsidian"] {
  background:
    radial-gradient(circle at 25% 18%, rgba(184, 240, 122, 0.42), transparent 18%),
    linear-gradient(145deg, #b8f07a 0%, #121812 46%, #050806 100%);
}

.theme-presets button[data-theme-preset="nordNight"] {
  background:
    radial-gradient(circle at 78% 20%, rgba(236, 239, 244, 0.36), transparent 19%),
    linear-gradient(145deg, #88c0d0 0%, #253041 48%, #121922 100%);
}

.theme-presets button[data-theme-preset="violetNight"] {
  background:
    radial-gradient(circle at 78% 20%, rgba(192, 132, 252, 0.55), transparent 18%),
    linear-gradient(145deg, #c084fc 0%, #20142f 50%, #0b0712 100%);
}

.theme-presets button[data-theme-preset="emeraldNight"] {
  background:
    radial-gradient(circle at 22% 18%, rgba(52, 211, 153, 0.5), transparent 18%),
    linear-gradient(145deg, #34d399 0%, #10231d 46%, #040c09 100%);
}

.theme-presets button[data-theme-preset^="white"] {
  color: #111827 !important;
  border-color: rgba(17, 24, 39, 0.12) !important;
}

.theme-presets button[data-theme-preset="whiteSnow"] {
  background:
    radial-gradient(circle at 24% 18%, rgba(17, 24, 39, 0.2), transparent 18%),
    linear-gradient(145deg, #ffffff 0%, #edf2f7 54%, #f8fafc 100%);
}

.theme-presets button[data-theme-preset="whitePaper"] {
  background:
    radial-gradient(circle at 78% 18%, rgba(217, 119, 6, 0.28), transparent 18%),
    linear-gradient(145deg, #ffffff 0%, #f2eee7 56%, #fbfaf7 100%);
}

.theme-presets button[data-theme-preset="whiteMint"] {
  background:
    radial-gradient(circle at 22% 18%, rgba(15, 118, 110, 0.24), transparent 18%),
    linear-gradient(145deg, #ffffff 0%, #ccfbf1 54%, #f0fdfa 100%);
}

.theme-presets button[data-theme-preset="whiteSky"] {
  background:
    radial-gradient(circle at 78% 18%, rgba(37, 99, 235, 0.28), transparent 18%),
    linear-gradient(145deg, #ffffff 0%, #dbeafe 54%, #eff6ff 100%);
}

.theme-presets button[data-theme-preset="whiteMono"] {
  background:
    radial-gradient(circle at 24% 18%, rgba(39, 39, 42, 0.22), transparent 18%),
    linear-gradient(145deg, #ffffff 0%, #e4e4e7 54%, #f4f4f5 100%);
}

.theme-presets button[data-theme-preset="whiteRose"] {
  background:
    radial-gradient(circle at 78% 18%, rgba(225, 29, 72, 0.26), transparent 18%),
    linear-gradient(145deg, #ffffff 0%, #ffe4e6 54%, #fff1f2 100%);
}

.theme-presets button[data-theme-preset="whiteAmber"] {
  background:
    radial-gradient(circle at 22% 18%, rgba(245, 158, 11, 0.3), transparent 18%),
    linear-gradient(145deg, #ffffff 0%, #fef3c7 54%, #fffdf4 100%);
}

@media (max-width: 768px) {
  body.settings-home-mode #settingsHome {
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header {
    min-height: 96px !important;
    padding: 18px 18px 16px !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header h2, body.settings-home-mode #settingsHome:not(.scp-settings-section-open) #settingsModal .modal-header h2 {
    font-size: clamp(34px, 10vw, 42px) !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav, body.settings-home-mode #settingsHome .tg-settings-nav.settings-scroll-nav {
    gap: 12px !important;
    padding: 18px 12px calc(118px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-nav-section {
    margin: 16px 0 -2px !important;
    padding-left: 2px !important;
    font-size: 19px !important;
    line-height: 1.05 !important;
    letter-spacing: 0 !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button {
    grid-template-columns: 60px minmax(0, 1fr) !important;
    min-height: 82px !important;
    height: auto !important;
    gap: 14px !important;
    padding: 11px 12px !important;
    align-items: center !important;
    justify-items: start !important;
    text-align: left !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon {
    width: 60px !important;
    min-width: 60px !important;
    height: 60px !important;
    min-height: 60px !important;
    border-radius: 20px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button span:not(.tg-settings-nav-icon) {
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 19px !important;
    line-height: 1.12 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button[aria-expanded="true"] {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav .scp-settings-inline-panel {
    margin: -12px 0 2px !important;
    padding: 12px !important;
    border: 0.5px solid color-mix(in srgb, var(--scp-mock-line, var(--border)) 44%, transparent) !important;
    border-top: 0 !important;
    border-radius: 0 0 12px 12px !important;
    background: color-mix(in srgb, var(--scp-mock-card, var(--panel)) 94%, var(--bg)) !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-panel {
    display: grid !important;
    gap: 12px !important;
    min-width: 0 !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-panel-head {
    display: none !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-group {
    min-width: 0 !important;
    overflow: visible !important;
    border-radius: 12px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-group-title {
    padding: 13px 13px 11px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-row, body.settings-home-mode #settingsHome .scp-settings-inline-panel .privacy-choice-row, body.settings-home-mode #settingsHome .scp-settings-inline-panel .language-choice-row {
    grid-template-columns: 36px minmax(0, 1fr) !important;
    gap: 7px 11px !important;
    padding: 13px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-row-text strong {
    font-size: 15px !important;
    line-height: 1.15 !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .tg-settings-row-text small {
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .theme-presets {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 12px !important;
  }

  body.settings-home-mode #settingsHome .scp-settings-inline-panel .theme-presets button {
    min-height: 66px !important;
    padding: 10px !important;
    border-radius: 14px !important;
    font-size: 13px !important;
    line-height: 1.08 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }
}

@media (max-width: 380px) {
  body.settings-home-mode #settingsHome .tg-settings-nav button {
    grid-template-columns: 54px minmax(0, 1fr) !important;
    min-height: 76px !important;
    gap: 12px !important;
    padding: 10px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon {
    width: 54px !important;
    min-width: 54px !important;
    height: 54px !important;
    min-height: 54px !important;
    border-radius: 18px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button span:not(.tg-settings-nav-icon) {
    font-size: 17px !important;
  }
}

@media (max-width: 768px) {
  #chatList.scp-main-menu .chat-list-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    min-width: 62px !important;
  }

  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    place-items: center !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    padding: 0 !important;
    border: 2px solid color-mix(in srgb, var(--accent) 72%, #fff 28%) !important;
    border-radius: 18px !important;
    background:
        radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.42), transparent 28%),
        linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 78%, #000 22%)) !important;
    box-shadow:
        0 12px 24px color-mix(in srgb, var(--accent) 34%, transparent),
        0 4px 0 color-mix(in srgb, var(--accent) 56%, #000 44%),
        inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
    transform: translateY(-1px) !important;
    cursor: pointer !important;
    z-index: 3 !important;
  }

  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus:active {
    transform: translateY(1px) scale(0.98) !important;
    box-shadow:
        0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent),
        0 2px 0 color-mix(in srgb, var(--accent) 52%, #000 48%),
        inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
  }

  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus img {
    display: block !important;
    width: 31px !important;
    height: 31px !important;
    max-width: 31px !important;
    max-height: 31px !important;
    object-fit: contain !important;
    filter: brightness(0) invert(1) !important;
    opacity: 1 !important;
  }

  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus .scp-create-icon-edit {
    display: block !important;
  }

  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus .scp-create-icon-plus {
    display: none !important;
  }
}

@media (max-width: 430px) {
  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    border-radius: 16px !important;
  }

  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus img {
    width: 29px !important;
    height: 29px !important;
    max-width: 29px !important;
    max-height: 29px !important;
  }
}

@media (max-width: 768px) {
  #profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-identity, #profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-badges {
    overflow: visible !important;
  }

  #profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-badges {
    min-height: 42px !important;
    z-index: 80 !important;
  }

  #profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-status-picker {
    position: relative !important;
    z-index: 180 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-status-trigger {
    min-height: 40px !important;
    max-width: none !important;
    padding: 0 14px !important;
    border-width: 1px !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  #profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-status-cloud {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    top: calc(clamp(196px, 24dvh, 232px) + env(safe-area-inset-top, 0px)) !important;
    z-index: 2147483000 !important;
    display: none !important;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)) !important;
    gap: 9px !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(36dvh, 320px) !important;
    padding: 12px !important;
    overflow: auto !important;
    overscroll-behavior: contain !important;
    border-radius: 18px !important;
    background: color-mix(in srgb, var(--profile-v3-card, var(--panel)) 97%, #000 3%) !important;
    box-shadow:
        0 22px 64px color-mix(in srgb, #000 44%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  }

  #profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-status-picker.open .scp-profile-v3-status-cloud {
    display: grid !important;
  }

  #profileHome.scp-profile-v3.profile-v3-editing .scp-profile-v3-status-cloud .scp-profile-v3-status-option {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    font-size: 19px !important;
  }
}

@media (max-width: 768px) {
  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #ff9f2f !important;
    box-shadow:
        0 12px 26px rgba(255, 159, 47, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.34) !important;
  }

  #chatList.scp-main-menu .chat-list-actions .create-chat-btn.scp-main-menu-plus img {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    filter: brightness(0) invert(1) !important;
  }
}

body.settings-home-mode #settingsHome #settingsModal .modal-header .scp-settings-user-subtitle {
  display: block !important;
  margin: 3px 0 0 !important;
  max-width: 100% !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  line-height: 1.15 !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

@media (max-width: 768px) {
  body.settings-home-mode #settingsHome #settingsModal .modal-header {
    min-height: 70px !important;
    padding: 13px 18px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 0 !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header h2, body.settings-home-mode #settingsHome:not(.scp-settings-section-open) #settingsModal .modal-header h2 {
    color: var(--text) !important;
    font-size: 22px !important;
    line-height: 1.02 !important;
    font-weight: 950 !important;
    letter-spacing: 0 !important;
    text-align: left !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav, body.settings-home-mode #settingsHome .tg-settings-nav.settings-scroll-nav {
    padding-top: 12px !important;
  }
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.bell::before {
  width: 25px !important;
  height: 24px !important;
  left: 50% !important;
  top: 17px !important;
  transform: translateX(-50%) !important;
  border: 4px solid currentColor !important;
  border-bottom: 0 !important;
  border-radius: 15px 15px 7px 7px !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.bell::after {
  width: 26px !important;
  height: 4px !important;
  left: 50% !important;
  top: 42px !important;
  transform: translateX(-50%) !important;
  border-radius: 999px !important;
  background: currentColor !important;
  box-shadow: 0 8px 0 -1px currentColor !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.lock::before {
  width: 24px !important;
  height: 18px !important;
  left: 50% !important;
  top: 16px !important;
  transform: translateX(-50%) !important;
  border: 4px solid currentColor !important;
  border-bottom: 0 !important;
  border-radius: 14px 14px 0 0 !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.lock::after {
  width: 32px !important;
  height: 24px !important;
  left: 50% !important;
  top: 31px !important;
  transform: translateX(-50%) !important;
  border-radius: 8px !important;
  background: currentColor !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.chat::before {
  width: 35px !important;
  height: 29px !important;
  left: 50% !important;
  top: 18px !important;
  transform: translateX(-50%) !important;
  border: 4px solid currentColor !important;
  border-radius: 12px !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.chat::after {
  width: 13px !important;
  height: 13px !important;
  right: 16px !important;
  bottom: 17px !important;
  border-right: 4px solid currentColor !important;
  border-bottom: 4px solid currentColor !important;
  border-radius: 0 0 8px 0 !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.folder::before {
  width: 38px !important;
  height: 27px !important;
  left: 50% !important;
  top: 26px !important;
  transform: translateX(-50%) !important;
  border: 4px solid currentColor !important;
  border-radius: 8px !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.folder::after {
  width: 20px !important;
  height: 9px !important;
  left: 17px !important;
  top: 20px !important;
  border-radius: 7px 7px 0 0 !important;
  background: currentColor !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.sliders::before, body.settings-home-mode #settingsHome .tg-settings-nav-icon.speaker::before {
  width: 36px !important;
  height: 4px !important;
  left: 50% !important;
  top: 20px !important;
  transform: translateX(-50%) !important;
  border-radius: 999px !important;
  background: currentColor !important;
  box-shadow: 0 12px 0 currentColor, 0 24px 0 currentColor !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.sliders::after {
  width: 9px !important;
  height: 9px !important;
  left: 20px !important;
  top: 17px !important;
  border-radius: 999px !important;
  background: currentColor !important;
  box-shadow: 17px 12px 0 currentColor, 6px 24px 0 currentColor !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.speaker::after {
  width: 24px !important;
  height: 24px !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) rotate(-45deg) !important;
  border-right: 4px solid currentColor !important;
  border-top: 4px solid currentColor !important;
  border-radius: 0 14px 0 0 !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.battery::before {
  width: 36px !important;
  height: 22px !important;
  left: 14px !important;
  top: 26px !important;
  border: 4px solid currentColor !important;
  border-radius: 8px !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.battery::after {
  width: 12px !important;
  height: 10px !important;
  right: 9px !important;
  top: 32px !important;
  border-radius: 0 5px 5px 0 !important;
  background: currentColor !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.language::before {
  width: 36px !important;
  height: 36px !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  border: 4px solid currentColor !important;
  border-radius: 999px !important;
  background: transparent !important;
}

body.settings-home-mode #settingsHome .tg-settings-nav-icon.language::after {
  content: "A" !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  color: currentColor !important;
  font-size: 25px !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  background: transparent !important;
}

.music-platform-mini-queue {
  order: 4 !important;
  width: 100% !important;
  margin: 0 0 18px !important;
  padding: 14px !important;
  border-radius: 18px !important;
  background: color-mix(in srgb, var(--scp-mock-card, var(--panel)) 88%, var(--bg)) !important;
  color: var(--text) !important;
}

.music-platform-mini-queue h3 {
  margin: 0 0 10px !important;
  color: var(--text) !important;
  font-size: 18px !important;
  line-height: 1.1 !important;
  font-weight: 950 !important;
}

.music-platform-mini-queue-list {
  display: grid !important;
  gap: 8px !important;
}

.music-platform-mini-queue-item {
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  min-height: 52px !important;
  padding: 6px 8px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: color-mix(in srgb, var(--bg) 78%, var(--scp-mock-card, var(--panel))) !important;
  color: var(--text) !important;
  text-align: left !important;
}

.music-platform-mini-queue-cover {
  width: 42px !important;
  height: 42px !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: color-mix(in srgb, var(--text) 10%, transparent) !important;
}

.music-platform-mini-queue-cover img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.music-platform-mini-queue-main {
  min-width: 0 !important;
  display: grid !important;
  gap: 2px !important;
}

.music-platform-mini-queue-main strong, .music-platform-mini-queue-main small {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.music-platform-mini-queue-main strong {
  font-size: 15px !important;
  line-height: 1.05 !important;
  font-weight: 950 !important;
}

.music-platform-mini-queue-main small, .music-platform-mini-queue-time, .music-platform-mini-queue-empty {
  color: var(--muted) !important;
  font-size: 12px !important;
  line-height: 1.15 !important;
  font-weight: 800 !important;
}

@media (max-width: 430px) {
  .music-platform-mini-queue {
    padding: 12px !important;
    margin-bottom: 15px !important;
    border-radius: 16px !important;
  }

  .music-platform-controls {
    grid-template-columns: 42px 42px 56px 42px 42px !important;
    gap: 9px !important;
    margin-bottom: 18px !important;
  }

  .music-platform-controls button {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
  }

  .music-platform-controls .music-platform-main-play {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
  }

  .music-platform-controls .music-platform-icon {
    width: 24px !important;
    height: 24px !important;
  }

  .music-platform-controls .music-platform-main-play .music-platform-icon {
    width: 34px !important;
    height: 34px !important;
  }
}


/* ============================================================
   ScpGram desktop v3
   Clean three-column layout + resizable sections
   ============================================================ */

@media (min-width: 769px) {
  :root {
    --scp-sidebar-width: 278px;
    --scp-chat-list-width: 378px;
    --scp-resizer-width: 8px;
    --scp-surface: #171918;
    --scp-surface-soft: #1b1d1c;
    --scp-surface-hover: #202422;
    --scp-line: rgba(255, 255, 255, 0.08);
  }

  #layout {
    grid-template-columns:
      var(--scp-sidebar-width)
      var(--scp-resizer-width)
      minmax(300px, var(--scp-chat-list-width))
      var(--scp-resizer-width)
      minmax(0, 1fr);
    gap: 0;
    background: #151616;
  }

  #sidebar {
    grid-column: 1;
    grid-row: 1;
    align-items: stretch;
    padding: 18px 12px 14px;
    background:
      radial-gradient(circle at 30% 0%, rgba(92, 211, 114, 0.045), transparent 34%),
      linear-gradient(180deg, #171918 0%, #141515 100%);
    border-right: 0;
    overflow: hidden;
  }

  .sidebar-brand {
    padding: 8px 10px 22px;
  }

  .sidebar-brand-row {
    display: flex;
    align-items: center;
    gap: 11px;
  }

  .sidebar-brand .logo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
  }

  .sidebar-brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .sidebar-brand-copy strong {
    color: var(--text);
    font-size: 18px;
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -0.02em;
  }

  .sidebar-brand-copy span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .sidebar-brand-copy i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #45d56b;
    box-shadow: 0 0 12px rgba(69, 213, 107, 0.35);
  }

  .sidebar-compose {
    margin-left: auto;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
  }

  .sidebar-compose:hover {
    background: rgba(255,255,255,.07);
    transform: translateY(-1px);
  }

  .sidebar-compose img,
  .sidebar-nav-item img {
    display: block;
    opacity: .88;
    filter: var(--icon-filter, none);
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 4px;
  }

  .sidebar-nav-item {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 15px;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 15px;
    font-weight: 750;
    text-align: left;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
  }

  .sidebar-nav-item:hover {
    background: rgba(255,255,255,.045);
    color: var(--text);
  }

  .sidebar-nav-item.active {
    background: linear-gradient(90deg, rgba(92,211,114,.13), rgba(92,211,114,.045));
    color: var(--text);
  }

  .sidebar-nav-item.active img {
    filter: none;
  }

  .sidebar-account {
    margin-top: auto;
    padding: 12px 4px 0;
  }

  .sidebar-account-button {
    width: 100%;
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border: 1px solid var(--scp-line);
    border-radius: 18px;
    background: rgba(255,255,255,.018);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: background .18s ease, border-color .18s ease;
  }

  .sidebar-account-button:hover {
    background: rgba(255,255,255,.045);
    border-color: rgba(255,255,255,.13);
  }

  .sidebar-account-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #c8c6bd;
    color: #333;
    font-size: 16px;
    font-weight: 900;
  }

  .sidebar-account-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .sidebar-account-copy strong {
    font-size: 14px;
    line-height: 1;
  }

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

  .sidebar-account-more {
    margin-left: auto;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
  }

  #sidebar .sidebar-footer {
    display: none;
  }

  /* Resizers */
  .layout-resizer {
    position: relative;
    z-index: 100;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
  }

  .layout-resizer::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 64px;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    background: transparent;
    transition: background .18s ease, box-shadow .18s ease;
  }

  .layout-resizer:hover::after,
  body.is-resizing-layout .layout-resizer::after {
    background: var(--accent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 40%, transparent);
  }

  .layout-resizer-sidebar {
    grid-column: 2;
    grid-row: 1;
  }

  .layout-resizer-chat-list {
    grid-column: 4;
    grid-row: 1;
  }

  #chatList {
    grid-column: 3;
    grid-row: 1;
    border-right: 0;
    background:
      linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0)),
      #181a19;
  }

  #chat {
    grid-column: 5;
    grid-row: 1;
    border-left: 0;
    background:
      radial-gradient(circle at 24% 25%, rgba(92,211,114,.055), transparent 32%),
      #171918;
  }

  #chatList .list-tabs {
    display: none;
  }

  #chatList .chat-list-header {
    height: 78px;
    min-height: 78px;
    padding: 0 20px;
    border-bottom: 1px solid var(--scp-line);
    background: transparent;
  }

  #chatList .chat-list-header h2 {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -.03em;
  }

  #chatList .chat-list-actions .profile-mobile-btn,
  #chatList .chat-list-actions .settings-mobile-btn {
    display: none;
  }

  #chatList .create-chat-btn {
    width: 38px;
    height: 38px;
    font-size: 22px;
    background: transparent;
    color: var(--text);
  }

  #chatList .create-chat-btn:hover {
    background: rgba(255,255,255,.06);
  }

  #chatList .list-search {
    padding: 10px 16px 14px;
    border-bottom: 0;
    background: transparent;
  }

  #chatList .list-search input {
    height: 52px;
    border-radius: 26px;
    padding: 0 18px 0 48px;
    background: rgba(255,255,255,.025);
    border: 1px solid rgba(255,255,255,.07);
    font-size: 15px;
    font-weight: 650;
  }

  #chatList #chatListContent {
    padding: 0 8px 14px;
  }

  #chatList .chatItem,
  #chatList .scp-menu-feed-item {
    margin: 4px 0;
    width: 100%;
    min-height: 92px;
    padding: 13px 14px;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 16px;
    background: rgba(255,255,255,.018);
    border-bottom: 1px solid rgba(255,255,255,.065);
  }

  #chatList .chatItem:hover,
  #chatList .scp-menu-feed-item:hover,
  #chatList .chatItem.active {
    background: rgba(255,255,255,.045);
    border-color: rgba(255,255,255,.11);
  }

  #chatHeader {
    margin: 14px 14px 0;
    min-height: 64px;
    height: 64px;
    padding: 0 14px;
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 30px;
    background: rgba(255,255,255,.025);
  }

  #messages {
    padding: 22px;
  }

  #messageInput {
    margin: 0 14px 12px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 26px;
    background: rgba(255,255,255,.025);
  }

  body.is-resizing-layout,
  body.is-resizing-layout * {
    cursor: col-resize !important;
    user-select: none !important;
  }
}

@media (max-width: 768px) {
  .layout-resizer {
    display: none;
  }

  .sidebar-nav,
  .sidebar-account,
  .sidebar-brand {
    display: none;
  }

  #sidebar {
    width: auto;
  }
}


/* ============================================================
   ScpGram desktop v4 — final layout corrections
   ============================================================ */

@media (min-width: 769px) {
  #layout {
    grid-template-columns:
      var(--scp-sidebar-width)
      var(--scp-resizer-width)
      minmax(300px, var(--scp-chat-list-width))
      var(--scp-resizer-width)
      minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    overflow: hidden;
  }

  #sidebar {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .layout-resizer-sidebar {
    grid-column: 2;
    grid-row: 1;
  }

  #chatList {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
  }

  .layout-resizer-chat-list {
    grid-column: 4;
    grid-row: 1;
  }

  #chat {
    grid-column: 5;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
  }

  /* Header/search/list stay at the top; only the list itself scrolls. */
  #chatList .chat-list-header {
    flex: 0 0 78px;
  }

  #chatList .list-search {
    order: 1;
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 16px 14px;
  }

  #chatList #chatListContent {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 8px 14px;
  }

  /* White desktop navigation icons. */
  .sidebar-nav-item img,
  .sidebar-compose,
  .sidebar-account-button img,
  .sidebar-nav-item.active img {
    filter: brightness(0) invert(1);
  }

  .sidebar-nav-item img {
    opacity: .92;
  }

  /* Remove the old edit icon and make the create action a simple +. */
  .sidebar-compose {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    border-radius: 12px;
    font-size: 32px;
    font-weight: 300;
    line-height: 1;
  }

  .sidebar-brand-copy span,
  .sidebar-brand-copy i {
    display: none;
  }

  /* The profile nav item is intentionally absent. */
  #sidebarProfileBtn {
    display: none !important;
  }

  /* Profile takes only the chat-list + opened-chat area. */
  body.profile-home-mode #chatList {
    display: none;
  }

  body.profile-home-mode .layout-resizer-chat-list {
    display: none;
  }

  body.profile-home-mode #chat {
    grid-column: 3 / 6;
    grid-row: 1;
    overflow: auto;
    background:
      radial-gradient(circle at 28% 14%, rgba(92,211,114,.055), transparent 32%),
      #171918;
  }

  body.profile-home-mode #chat > :not(#profileHome) {
    display: none !important;
  }

  body.profile-home-mode #profileHome {
    display: block !important;
    position: relative;
    min-height: 100%;
    width: min(720px, calc(100% - 48px));
    margin: 0 auto;
    padding: 18px 0 30px;
    overflow: visible;
  }

  /* Archive mode keeps the same list UI, only switches its dataset. */
  body.sidebar-archive-mode #chatListTitle {
    font-size: 30px;
  }

  /* Clean resizers: visible only on hover/drag. */
  .layout-resizer {
    width: var(--scp-resizer-width);
    background: transparent;
  }

  .layout-resizer::after {
    width: 3px;
    height: 64px;
  }
}


/* ============================================================
   ScpGram desktop v5 — navigation surfaces
   ============================================================ */
@media (min-width: 769px) {
  /* All desktop modes retain the same 3-column geometry. */
  body.profile-home-mode #layout,
  body.settings-home-mode #layout,
  body.news-home-mode #layout,
  body.calls-home-mode #layout {
    grid-template-columns:
      var(--scp-sidebar-width)
      var(--scp-resizer-width)
      minmax(300px, var(--scp-chat-list-width))
      var(--scp-resizer-width)
      minmax(0, 1fr);
  }

  body.profile-home-mode #chat,
  body.settings-home-mode #chat,
  body.news-home-mode #chat,
  body.calls-home-mode #chat {
    grid-column: 3 / 6 !important;
    grid-row: 1 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: hidden !important;
  }

  body.profile-home-mode #chatList,
  body.settings-home-mode #chatList,
  body.news-home-mode #chatList,
  body.calls-home-mode #chatList {
    display: none !important;
  }

  body.profile-home-mode .layout-resizer-chat-list,
  body.settings-home-mode .layout-resizer-chat-list,
  body.news-home-mode .layout-resizer-chat-list,
  body.calls-home-mode .layout-resizer-chat-list {
    display: none !important;
  }

  /* Profile page: centered, roomy, never stuck in the far-right pane. */
  body.profile-home-mode #profileHome {
    display: block !important;
    position: relative !important;
    width: min(900px, calc(100% - 56px)) !important;
    max-width: 900px !important;
    min-height: calc(100vh - 32px) !important;
    height: auto !important;
    margin: 16px auto 24px !important;
    padding: 0 0 30px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: transparent !important;
  }

  body.profile-home-mode #profileHome .profile-home-card,
  body.profile-home-mode #profileHome .scp-profile-card {
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
  }

  /* News page: actual news surface, not the account/session page. */
  body.news-home-mode #newsHome {
    display: flex !important;
    flex-direction: column !important;
    width: min(1000px, calc(100% - 56px)) !important;
    max-width: 1000px !important;
    height: calc(100vh - 32px) !important;
    margin: 16px auto !important;
    padding: 0 0 22px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: transparent !important;
  }

  body.news-home-mode #newsHome .news-title-row {
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
    min-height: 72px !important;
    padding: 14px 6px !important;
    margin-bottom: 12px !important;
    border-radius: 20px !important;
    background: color-mix(in srgb, var(--panel) 88%, transparent) !important;
    border: 1px solid var(--border) !important;
    backdrop-filter: blur(18px) !important;
  }

  body.news-home-mode #newsHome .news-content {
    display: grid !important;
    gap: 12px !important;
    min-height: 0 !important;
  }

  body.news-home-mode #newsHome .news-card {
    border-radius: 18px !important;
    border: 1px solid var(--border) !important;
    background: color-mix(in srgb, var(--panel) 88%, transparent) !important;
    padding: 16px !important;
  }

  /* Calls keep the same clean content surface. */
  body.calls-home-mode #callsHome {
    display: flex !important;
    flex-direction: column !important;
    width: min(900px, calc(100% - 56px)) !important;
    height: calc(100vh - 32px) !important;
    margin: 16px auto !important;
    padding: 0 0 22px !important;
    overflow: auto !important;
    background: transparent !important;
  }

  /* Settings: compact centered settings workspace instead of full-width rows. */
  body.settings-home-mode #settingsHome {
    display: block !important;
    position: relative !important;
    width: min(920px, calc(100% - 56px)) !important;
    max-width: 920px !important;
    height: calc(100vh - 32px) !important;
    margin: 16px auto !important;
    padding: 0 0 24px !important;
    overflow: auto !important;
    background: transparent !important;
  }

  body.settings-home-mode #settingsHome #settingsModal {
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-content {
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    border-radius: 22px !important;
    border: 1px solid var(--border) !important;
    background: color-mix(in srgb, var(--panel) 92%, transparent) !important;
    box-shadow: 0 28px 90px rgba(0,0,0,.35) !important;
    overflow: hidden !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header {
    display: flex !important;
    align-items: center !important;
    min-height: 82px !important;
    padding: 0 20px !important;
    background: transparent !important;
    border-bottom: 1px solid var(--border) !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header h2 {
    font-size: 30px !important;
    line-height: 1 !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-body {
    display: block !important;
    padding: 16px !important;
    max-height: none !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-shell {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button {
    min-height: 74px !important;
    height: 74px !important;
    padding: 12px 14px !important;
    border-radius: 16px !important;
    border: 1px solid var(--border) !important;
    background: color-mix(in srgb, var(--panel2) 86%, transparent) !important;
    color: var(--text) !important;
    font-size: 16px !important;
    text-align: left !important;
    justify-content: flex-start !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button.active {
    background: color-mix(in srgb, var(--accent) 14%, var(--panel2) 86%) !important;
    border-color: color-mix(in srgb, var(--accent) 38%, var(--border) 62%) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panels {
    margin-top: 14px !important;
    padding: 0 !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panel.active {
    border-radius: 18px !important;
    border: 1px solid var(--border) !important;
    background: color-mix(in srgb, var(--panel2) 55%, transparent) !important;
    padding: 16px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon {
    filter: brightness(0) invert(1) !important;
  }

  /* Avoid the old giant mobile-only header styles on desktop. */
  body.settings-home-mode #settingsHome .settings-scroll-nav {
    max-height: none !important;
  }
}


/* ============================================================
   Final theme propagation + surface isolation
   ============================================================ */
@media (min-width: 769px) {
  #layout,
  #chat,
  #chatList,
  #sidebar,
  body.profile-home-mode #chat,
  body.settings-home-mode #chat,
  body.calls-home-mode #chat {
    background-color: var(--bg) !important;
    color: var(--text) !important;
  }

  #sidebar {
    background:
      radial-gradient(circle at 30% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 34%),
      color-mix(in srgb, var(--panel) 94%, var(--bg) 6%) !important;
    border-color: var(--border) !important;
  }

  #chatList {
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--panel) 98%, #fff 2%), var(--panel)) !important;
    border-color: var(--border) !important;
  }

  #chat {
    background:
      radial-gradient(circle at 25% 23%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 34%),
      var(--bg) !important;
  }

  .sidebar-brand,
  .sidebar-account-button,
  .sidebar-nav-item,
  #chatList .chat-list-header,
  #chatList .list-search input,
  #chatList .chatItem,
  #chatHeader,
  #messageInput {
    color: var(--text) !important;
  }

  .sidebar-account-button,
  #chatList .list-search input,
  #chatList .chatItem,
  #chatHeader,
  #messageInput {
    background: color-mix(in srgb, var(--panel) 82%, transparent) !important;
    border-color: var(--border) !important;
  }

  .sidebar-nav-item {
    color: var(--muted) !important;
  }

  .sidebar-nav-item:hover,
  .sidebar-nav-item.active {
    color: var(--text) !important;
    background: color-mix(in srgb, var(--accent) 12%, var(--panel) 88%) !important;
  }

  .sidebar-nav-item img,
  .sidebar-compose {
    filter: brightness(0) invert(1) !important;
  }

  .sidebar-account-avatar {
    background: color-mix(in srgb, var(--panel) 35%, var(--text) 65%) !important;
    color: var(--avatar-text) !important;
  }

  .layout-resizer::after {
    background: transparent;
  }

  .layout-resizer:hover::after,
  body.is-resizing-layout .layout-resizer::after {
    background: var(--accent) !important;
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent);
  }

  /* Profile */
  body.profile-home-mode #profileHome,
  body.profile-home-mode #profileHome .scp-profile-v3-card {
    color: var(--text) !important;
  }

  body.profile-home-mode #profileHome .scp-profile-v3-card {
    background: color-mix(in srgb, var(--panel) 92%, transparent) !important;
    border-color: var(--border) !important;
  }

  body.profile-home-mode #profileHome .scp-profile-empty {
    display: none !important;
  }

  body.profile-home-mode #profileHome .scp-profile-v3-post,
  body.profile-home-mode #profileHome .scp-profile-v3-empty-posts {
    background: var(--panel2) !important;
  }

  /* Settings */
  body.settings-home-mode #settingsHome {
    color: var(--text) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-modal,
  body.settings-home-mode #settingsHome #settingsModal,
  body.settings-home-mode #settingsHome #settingsModal .modal-content {
    background: color-mix(in srgb, var(--panel) 96%, var(--bg) 4%) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button,
  body.settings-home-mode #settingsHome .tg-settings-panel,
  body.settings-home-mode #settingsHome .tg-settings-group,
  body.settings-home-mode #settingsHome .settings-group {
    color: var(--text) !important;
    background: color-mix(in srgb, var(--panel2) 88%, var(--panel) 12%) !important;
    border-color: var(--border) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button.active {
    background: color-mix(in srgb, var(--accent) 14%, var(--panel2) 86%) !important;
    border-color: color-mix(in srgb, var(--accent) 36%, var(--border) 64%) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon {
    position: relative !important;
    display: inline-grid !important;
    place-items: center !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    border-radius: 13px !important;
    background: color-mix(in srgb, var(--accent) 20%, var(--panel2) 80%) !important;
    color: var(--text) !important;
    opacity: 1 !important;
    filter: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon::after {
    color: #fff !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon.bell::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon.lock::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon.chat::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon.folder::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon.sliders::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon.speaker::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon.battery::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon.language::before {
    opacity: 1 !important;
  }

  /* News has been removed from the UI. */
  #newsHome,
  #sidebarNewsBtn,
  #tabNewsBtn {
    display: none !important;
  }
}


/* ============================================================
   ScpGram v7 — account menu, settings icons, profile cleanup
   ============================================================ */

@media (min-width: 769px) {
  .sidebar-account {
    position: relative;
  }

  .sidebar-account-more {
    width: 28px;
    height: 42px;
    display: grid;
    place-items: center;
    margin-left: auto;
    border-radius: 10px;
    color: var(--muted);
    font-size: 22px;
    cursor: pointer;
    user-select: none;
  }

  .sidebar-account-more:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--panel) 72%, transparent);
  }

  .sidebar-account-menu {
    position: absolute;
    right: 4px;
    bottom: calc(100% + 8px);
    z-index: 6000;
    width: 218px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: color-mix(in srgb, var(--panel) 96%, #000 4%);
    box-shadow: 0 18px 55px rgba(0,0,0,.42);
    backdrop-filter: blur(20px);
  }

  .sidebar-account-menu button {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    text-align: left;
    cursor: pointer;
  }

  .sidebar-account-menu button:hover {
    background: color-mix(in srgb, var(--accent) 12%, var(--panel2) 88%);
  }

  .sidebar-account-menu button:last-child:hover {
    background: color-mix(in srgb, #e53935 14%, var(--panel2) 86%);
    color: #ffb5b2;
  }

  /* Settings navigation icons: explicit glyphs and visible themed tile. */
  body.settings-home-mode #settingsHome .tg-settings-nav-icon {
    display: block !important;
    position: relative !important;
    width: 52px !important;
    min-width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
    border-radius: 15px !important;
    background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%) !important;
    color: #fff !important;
    opacity: 1 !important;
    filter: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon::after {
    opacity: 1 !important;
    color: #fff !important;
  }

  /* Profile becomes a single clean scrollable desktop surface. */
  body.profile-home-mode #profileHome {
    width: min(1040px, calc(100% - 72px)) !important;
    max-width: 1040px !important;
    height: calc(100vh - 36px) !important;
    min-height: 0 !important;
    margin: 18px auto !important;
    padding: 0 0 32px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  body.profile-home-mode #profileHome .scp-profile-v3-shell {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: none !important;
  }

  body.profile-home-mode #profileHome .scp-profile-v3-identity {
    width: 100% !important;
    min-height: 174px !important;
    border-radius: 22px !important;
  }

  body.profile-home-mode #profileHome .scp-profile-v3-stats {
    width: 100% !important;
  }

  body.profile-home-mode #profileHome .scp-profile-v3-panel,
  body.profile-home-mode #profileHome .scp-profile-v3-channel,
  body.profile-home-mode #profileHome .scp-profile-v3-birth {
    width: 100% !important;
  }

  body.profile-home-mode #profileHome .scp-profile-v3-posts-card:has(.scp-profile-v3-post-grid:empty) {
    display: none !important;
  }
}

/* ============================================================
   ScpGram v10 — clean settings icons
   ============================================================ */
@media (min-width: 769px) {
  body.settings-home-mode #settingsHome .tg-settings-nav-icon {
    display: grid !important;
    place-items: center !important;
    width: 54px !important;
    min-width: 54px !important;
    height: 54px !important;
    min-height: 54px !important;
    padding: 0 !important;
    border-radius: 16px !important;
    background: color-mix(in srgb, var(--accent) 20%, var(--panel2) 80%) !important;
    color: #fff !important;
    overflow: hidden !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon::after {
    content: none !important;
    display: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon img {
    width: 28px !important;
    height: 28px !important;
    display: block !important;
    object-fit: contain !important;
    filter: none !important;
    opacity: 1 !important;
    color: #fff !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button {
    grid-template-columns: 54px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 14px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button span:not(.tg-settings-nav-icon) {
    line-height: 1.15 !important;
  }
}

/* Settings icon visibility fix */
@media (min-width: 769px) {
  body.settings-home-mode #settingsHome .tg-settings-nav-icon {
    display: grid !important;
    place-items: center !important;
    width: 54px !important;
    height: 54px !important;
    min-width: 54px !important;
    min-height: 54px !important;
    overflow: hidden !important;
    border-radius: 16px !important;
    background: color-mix(in srgb, var(--accent) 20%, var(--panel2) 80%) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon::after {
    content: none !important;
    display: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon img {
    display: block !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    object-fit: contain !important;
    opacity: 1 !important;
    filter: none !important;
    visibility: visible !important;
  }
}

/* Definitive settings icon renderer */
@media (min-width: 769px) {
  body.settings-home-mode #settingsHome .tg-settings-nav-icon {
    position: relative !important;
    display: grid !important;
    place-items: center !important;
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 14px !important;
    background: color-mix(in srgb, var(--accent) 18%, var(--panel2) 82%) !important;
    overflow: hidden !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon::before,
  body.settings-home-mode #settingsHome .tg-settings-nav-icon::after {
    content: none !important;
    display: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav-icon img {
    display: block !important;
    width: 25px !important;
    height: 25px !important;
    min-width: 25px !important;
    min-height: 25px !important;
    opacity: 1 !important;
    visibility: visible !important;
    object-fit: contain !important;
    object-position: center !important;
    filter: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav button {
    grid-template-columns: 48px minmax(0, 1fr) !important;
    gap: 14px !important;
  }
}

@media (min-width: 769px) {
  .sidebar-account-copy {
    min-width: 0;
    max-width: calc(100% - 82px);
    overflow: hidden;
  }

  .sidebar-account-copy strong,
  .sidebar-account-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-account-avatar {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
  }
}

/* ============================================================
   ScpGram v14 — calls readability + video recording
   ============================================================ */
@media (min-width: 769px) {
  #chatList.scp-main-menu .scp-call-history-item {
    position: relative !important;
    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 12px !important;
    min-height: 100px !important;
    padding: 14px 16px !important;
    color: var(--text) !important;
    background: color-mix(in srgb, var(--panel) 90%, transparent) !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .name,
  #chatList.scp-main-menu .scp-call-history-item .name span {
    color: var(--text) !important;
    opacity: 1 !important;
    font-size: 17px !important;
    font-weight: 850 !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .last-message,
  #chatList.scp-main-menu .scp-call-history-item .scp-call-history-participants,
  #chatList.scp-main-menu .scp-call-history-item .scp-menu-feed-meta {
    color: var(--muted) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .last-message {
    margin-top: 4px !important;
    font-size: 13px !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .scp-call-history-participants {
    margin-top: 6px !important;
    font-size: 12px !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .scp-menu-feed-meta {
    grid-column: 3 !important;
    align-self: start !important;
    font-size: 12px !important;
  }

  #chatList.scp-main-menu .scp-call-record-slot {
    grid-column: 2 / 4 !important;
    width: 100% !important;
    margin-top: 4px !important;
  }

  .scp-call-record-actions {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .scp-call-record-action {
    min-height: 32px !important;
    padding: 0 11px !important;
    border: 1px solid var(--border) !important;
    border-radius: 9px !important;
    background: var(--panel2) !important;
    color: var(--text) !important;
    font: inherit !important;
    font-size: 12px !important;
    font-weight: 750 !important;
    cursor: pointer !important;
  }

  .scp-call-record-action:hover {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border)) !important;
    background: color-mix(in srgb, var(--accent) 10%, var(--panel2)) !important;
  }

  .scp-call-record-video {
    display: block !important;
    width: min(560px, 100%) !important;
    max-height: 320px !important;
    margin-top: 8px !important;
    border-radius: 14px !important;
    border: 1px solid var(--border) !important;
    background: #000 !important;
  }

  .call-record-btn {
    min-width: 72px !important;
    gap: 6px !important;
    color: var(--text) !important;
  }

  .call-record-btn .call-record-dot {
    width: 9px !important;
    height: 9px !important;
    border-radius: 50% !important;
    background: #ef5350 !important;
  }

  .call-record-btn.recording {
    border-color: #ef5350 !important;
    color: #ffb3b0 !important;
  }

  .call-record-btn.recording .call-record-dot {
    animation: scpCallRecordPulse 1s ease-in-out infinite !important;
  }

  @keyframes scpCallRecordPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(.65); opacity: .55; }
  }
}

/* ============================================================
   ScpGram v15 — force visible call history typography
   ============================================================ */
@media (min-width: 769px) {
  #chatList.scp-main-menu .scp-call-history-item,
  #chatList.scp-main-menu .scp-call-history-item * {
    color: #f4f0e8 !important;
    -webkit-text-fill-color: #f4f0e8 !important;
    text-shadow: none !important;
  }

  #chatList.scp-main-menu .scp-call-history-item {
    display: grid !important;
    grid-template-columns: 54px minmax(0, 1fr) auto !important;
    grid-template-areas:
      "avatar info meta"
      "avatar record record" !important;
    align-items: start !important;
    gap: 10px 12px !important;
    min-height: 104px !important;
    padding: 15px 17px !important;
    background: #171411 !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    border-radius: 14px !important;
    isolation: isolate !important;
  }

  #chatList.scp-main-menu .scp-call-history-item > .avatar {
    grid-area: avatar !important;
    width: 54px !important;
    height: 54px !important;
    display: grid !important;
    place-items: center !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    background: #8a6a38 !important;
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 900 !important;
  }

  #chatList.scp-main-menu .scp-call-history-item > .info {
    grid-area: info !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .name,
  #chatList.scp-main-menu .scp-call-history-item .name span {
    color: #f4f0e8 !important;
    -webkit-text-fill-color: #f4f0e8 !important;
    font-size: 17px !important;
    line-height: 1.15 !important;
    font-weight: 850 !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .last-message {
    color: #c7beae !important;
    -webkit-text-fill-color: #c7beae !important;
    margin-top: 5px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .scp-call-history-participants {
    color: #a99f8f !important;
    -webkit-text-fill-color: #a99f8f !important;
    margin-top: 5px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    font-weight: 650 !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  #chatList.scp-main-menu .scp-call-history-item > .scp-menu-feed-meta {
    grid-area: meta !important;
    color: #a99f8f !important;
    -webkit-text-fill-color: #a99f8f !important;
    align-self: start !important;
    justify-self: end !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    font-weight: 650 !important;
    opacity: 1 !important;
    visibility: visible !important;
    white-space: nowrap !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .scp-call-record-slot {
    grid-area: record !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-top: 2px !important;
  }

  #chatList.scp-main-menu .scp-call-history-item .scp-call-record-actions,
  #chatList.scp-main-menu .scp-call-history-item .scp-call-record-action {
    color: #f4f0e8 !important;
    -webkit-text-fill-color: #f4f0e8 !important;
  }

  /* Call modal recording control */
  #callModal .call-record-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    min-width: 72px !important;
    min-height: 38px !important;
    color: #f4f0e8 !important;
    -webkit-text-fill-color: #f4f0e8 !important;
    background: rgba(255,255,255,.06) !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    border-radius: 11px !important;
  }

  #callModal .call-record-btn .call-record-dot {
    width: 9px !important;
    height: 9px !important;
    border-radius: 50% !important;
    background: #ef5350 !important;
    flex: 0 0 9px !important;
  }

  #callModal .call-record-btn.recording {
    background: rgba(239,83,80,.12) !important;
    border-color: rgba(239,83,80,.65) !important;
  }
}

/* ============================================================
   ScpGram v16 — desktop chat header cleanup
   ============================================================ */
@media (min-width: 769px) {
  #chatHeader {
    position: relative !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 12px !important;
    width: calc(100% - 24px) !important;
    min-width: 0 !important;
    height: 72px !important;
    min-height: 72px !important;
    margin: 10px 12px 0 !important;
    padding: 8px 8px 8px 12px !important;
    border: 1px solid var(--border) !important;
    border-radius: 20px !important;
    background: color-mix(in srgb, var(--panel) 92%, transparent) !important;
    box-shadow: 0 8px 28px rgba(0,0,0,.14) !important;
    overflow: hidden !important;
  }

  #chatHeader .back-btn {
    display: none !important;
  }

  #chatHeader .chat-user {
    min-width: 0 !important;
    min-height: 54px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 4px 8px !important;
    overflow: hidden !important;
  }

  #chatHeader .chat-user .avatar {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    flex: 0 0 48px !important;
    border-radius: 15px !important;
  }

  #chatHeader .chat-user .info {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  #chatHeader .chat-user .name,
  #chatHeader .chat-user .status {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #chatHeader .chat-user .name {
    color: var(--text) !important;
    font-size: 18px !important;
    line-height: 1.05 !important;
    font-weight: 900 !important;
    letter-spacing: -.02em !important;
  }

  #chatHeader .chat-user .status {
    margin-top: 3px !important;
    color: var(--muted) !important;
    font-size: 12px !important;
    line-height: 1.05 !important;
    font-weight: 650 !important;
  }

  #chatHeader .chat-actions {
    display: flex !important;
    align-items: center !important;
    gap: 7px !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    padding: 0 !important;
  }

  #chatHeader .chat-actions .action-btn {
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
    border: 1px solid var(--border) !important;
    border-radius: 14px !important;
    background: var(--panel2) !important;
    color: var(--text) !important;
  }

  #chatHeader .chat-actions .action-btn:hover {
    background: color-mix(in srgb, var(--accent) 10%, var(--panel2) 90%) !important;
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border) 72%) !important;
  }

  #chatHeader .chat-actions .action-btn img {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    filter: brightness(0) invert(1) !important;
    opacity: .92 !important;
  }

  #chatHeader .chat-actions .hidden {
    display: none !important;
  }

  /* Keep only the action area visually attached to the header instead of
     making the whole header a giant pill. */
  #chatHeader::after {
    display: none !important;
  }
}

/* ============================================================
   ScpGram v18 — account avatar + banner + account manager
   ============================================================ */
@media (min-width: 769px) {
  .sidebar-account {
    position: relative !important;
  }

  .sidebar-account-button {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    min-height: 92px !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 18px !important;
    text-align: left !important;
  }

  .sidebar-account-banner {
    position: absolute !important;
    inset: 0 0 auto 0 !important;
    height: 58px !important;
    display: block !important;
    background:
      linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,0)),
      linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, var(--panel)), var(--panel)) !important;
    background-size: cover !important;
    background-position: center !important;
    filter: saturate(.92) !important;
  }

  .sidebar-account-banner::after {
    content: "" !important;
    position: absolute !important;
    inset: 0 !important;
    background: linear-gradient(180deg, rgba(0,0,0,.04), rgba(0,0,0,.58)) !important;
  }

  .sidebar-account-banner.has-image {
    filter: saturate(.95) !important;
  }

  .sidebar-account-row {
    position: relative !important;
    z-index: 2 !important;
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) 24px !important;
    align-items: end !important;
    gap: 10px !important;
    width: 100% !important;
    min-height: 92px !important;
    padding: 12px 10px 10px !important;
  }

  .sidebar-account-avatar {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    border: 2px solid color-mix(in srgb, #fff 76%, var(--border) 24%) !important;
    box-shadow: 0 6px 18px rgba(0,0,0,.25) !important;
    background-color: #c9c4b8 !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
  }

  .sidebar-account-copy {
    min-width: 0 !important;
    max-width: none !important;
    padding-bottom: 2px !important;
    text-shadow: 0 1px 8px rgba(0,0,0,.35) !important;
  }

  .sidebar-account-copy strong {
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 900 !important;
  }

  .sidebar-account-copy small {
    color: rgba(255,255,255,.72) !important;
    font-size: 11px !important;
    font-weight: 650 !important;
  }

  .sidebar-account-more {
    width: 24px !important;
    height: 34px !important;
    align-self: center !important;
    margin: 0 !important;
    color: rgba(255,255,255,.82) !important;
    background: rgba(0,0,0,.12) !important;
    border-radius: 9px !important;
  }

  .sidebar-account-menu {
    width: 250px !important;
    padding: 7px !important;
    border-radius: 16px !important;
    background: color-mix(in srgb, var(--panel) 97%, #000 3%) !important;
    border: 1px solid var(--border) !important;
  }

  .sidebar-accounts-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    max-height: 230px !important;
    overflow: auto !important;
    margin-bottom: 5px !important;
  }

  .sidebar-saved-account {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 9px !important;
    width: 100% !important;
    min-height: 52px !important;
    padding: 7px 8px !important;
    border: 0 !important;
    border-radius: 11px !important;
    background: transparent !important;
    color: var(--text) !important;
    cursor: pointer !important;
    text-align: left !important;
  }

  .sidebar-saved-account:hover {
    background: color-mix(in srgb, var(--accent) 11%, var(--panel2)) !important;
  }

  .sidebar-saved-account-avatar {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    border-radius: 10px !important;
    display: grid !important;
    place-items: center !important;
    background: var(--panel2) !important;
    color: var(--text) !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    background-size: cover !important;
    background-position: center !important;
  }

  .sidebar-saved-account-copy {
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
  }

  .sidebar-saved-account-copy strong,
  .sidebar-saved-account-copy small {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .sidebar-saved-account-copy strong {
    font-size: 13px !important;
  }

  .sidebar-saved-account-copy small {
    color: var(--muted) !important;
    font-size: 11px !important;
  }

  .sidebar-saved-account-empty {
    padding: 8px 10px 10px !important;
    color: var(--muted) !important;
    font-size: 12px !important;
  }

  .sidebar-account-menu-add {
    border-top: 1px solid var(--border) !important;
    margin-top: 4px !important;
    padding-top: 7px !important;
  }
}

@media (min-width: 769px) {
  .sidebar-account-banner-image {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
  }
  .sidebar-account-banner-image.visible { display: block !important; }

  .sidebar-account-avatar {
    position: relative !important;
    overflow: hidden !important;
  }
  .sidebar-account-avatar-image {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
  }
  .sidebar-account-avatar-image.visible { display: block !important; }
  .sidebar-account-avatar-fallback { position: relative !important; z-index: 1 !important; }
  .sidebar-account-avatar-image.visible + .sidebar-account-avatar-fallback { display: none !important; }

  .sidebar-saved-account-avatar { position: relative !important; overflow: hidden !important; }
  .sidebar-saved-account-avatar img {
    position: absolute !important;
    inset: 0 !important;
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  .sidebar-saved-account-avatar img.visible { display: block !important; }
  .sidebar-saved-account-fallback { position: relative !important; z-index: 1 !important; }
}

/* ============================================================
   ScpGram v21 — authenticated avatar/banner loading
   ============================================================ */
@media (min-width: 769px) {
  .sidebar-account-banner,
  .sidebar-account-avatar,
  .sidebar-saved-account-avatar {
    position: relative !important;
    overflow: hidden !important;
  }

  .sidebar-account-banner-image,
  .sidebar-account-avatar-image,
  .sidebar-saved-account-avatar img {
    display: none !important;
    object-fit: cover !important;
    object-position: center !important;
  }

  .sidebar-account-banner-image.visible,
  .sidebar-account-avatar-image.visible,
  .sidebar-saved-account-avatar img.visible {
    display: block !important;
  }
}

/* ============================================================
   ScpGram v22 — video avatar/banner + media priority
   ============================================================ */
@media (min-width: 769px) {
  .sidebar-account-banner,
  .sidebar-account-avatar {
    position: relative !important;
    overflow: hidden !important;
  }

  .sidebar-account-banner-image,
  .sidebar-account-banner-video,
  .sidebar-account-avatar-image,
  .sidebar-account-avatar-video {
    position: absolute !important;
    inset: 0 !important;
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    pointer-events: none !important;
  }

  .sidebar-account-banner-image.visible,
  .sidebar-account-banner-video.visible,
  .sidebar-account-avatar-image.visible,
  .sidebar-account-avatar-video.visible {
    display: block !important;
  }

  .sidebar-account-banner-video.visible,
  .sidebar-account-avatar-video.visible {
    opacity: 1 !important;
  }

  .sidebar-account-avatar-fallback {
    position: relative !important;
    z-index: 1 !important;
  }

  .sidebar-account-avatar-image.visible + .sidebar-account-avatar-video + .sidebar-account-avatar-fallback,
  .sidebar-account-avatar-video.visible + .sidebar-account-avatar-fallback {
    display: none !important;
  }

  .sidebar-account-avatar {
    background: #c9c4b8 !important;
  }
}

/* ============================================================
   ScpGram v23 — sidebar uses the same direct media as profile
   ============================================================ */
@media (min-width: 769px) {
  .sidebar-account-banner,
  .sidebar-account-avatar {
    position: relative !important;
    overflow: hidden !important;
  }

  .sidebar-account-banner-image,
  .sidebar-account-banner-video,
  .sidebar-account-avatar-image,
  .sidebar-account-avatar-video {
    position: absolute !important;
    inset: 0 !important;
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    object-fit: cover !important;
    object-position: center !important;
  }

  .sidebar-account-banner-image.visible,
  .sidebar-account-banner-video.visible,
  .sidebar-account-avatar-image.visible,
  .sidebar-account-avatar-video.visible {
    display: block !important;
  }

  .sidebar-account-avatar-fallback {
    position: relative !important;
    z-index: 3 !important;
  }

  .sidebar-account-avatar-image.visible ~ .sidebar-account-avatar-fallback,
  .sidebar-account-avatar-video.visible ~ .sidebar-account-avatar-fallback {
    display: none !important;
  }

  .sidebar-account-banner::after {
    z-index: 2 !important;
    pointer-events: none !important;
  }

  .sidebar-account-row {
    position: relative !important;
    z-index: 4 !important;
  }
}

/* ============================================================
   ScpGram v24 — account popup anchoring + real profile media
   ============================================================ */
@media (min-width: 769px) {
  .sidebar-account {
    position: relative !important;
    overflow: visible !important;
    z-index: 50 !important;
  }

  .sidebar-account-menu {
    position: absolute !important;
    left: auto !important;
    right: 0 !important;
    bottom: calc(100% + 10px) !important;
    width: min(260px, calc(100vw - 24px)) !important;
    max-height: min(420px, calc(100vh - 40px)) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 7000 !important;
  }

  .sidebar-accounts-list {
    max-height: 210px !important;
  }

  .sidebar-account-banner {
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-position: center !important;
  }

  .sidebar-account-banner-image {
    display: none !important;
  }

  .sidebar-account-banner-image.visible {
    display: none !important;
  }

  .sidebar-account-avatar {
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-position: center !important;
  }

  .sidebar-account-avatar-image {
    display: none !important;
  }

  .sidebar-account-avatar-image.visible {
    display: none !important;
  }

  .sidebar-account-avatar-fallback {
    display: none !important;
  }
}

/* ============================================================
   ScpGram v27 — final media visibility
   ============================================================ */
@media (min-width: 769px) {
  #profileBtn .sidebar-account-banner {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    overflow: hidden !important;
    background: transparent !important;
    z-index: 0 !important;
  }

  #profileBtn .sidebar-account-banner-image.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center !important;
    z-index: 3 !important;
  }

  #profileBtn .sidebar-account-banner-video.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    z-index: 3 !important;
  }

  #profileBtn .sidebar-account-row {
    position: relative !important;
    z-index: 10 !important;
  }

  #profileBtn .sidebar-account-avatar {
    position: relative !important;
    overflow: hidden !important;
    isolation: isolate !important;
  }

  #profileBtn .sidebar-account-avatar-image.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center !important;
    z-index: 50 !important;
  }

  #profileBtn .sidebar-account-avatar-video.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    z-index: 50 !important;
  }

  #profileBtn .sidebar-account-avatar-fallback {
    display: none !important;
  }

  /* The old accumulated background rule must not cover the real banner image. */
  #profileBtn .sidebar-account-banner.has-image {
    background: transparent !important;
    background-image: none !important;
  }
}

/* ============================================================
   ScpGram v28 — profile-resolved sidebar media
   ============================================================ */
@media (min-width: 769px) {
  #profileBtn .sidebar-account-banner {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    overflow: hidden !important;
    background: transparent !important;
    z-index: 0 !important;
  }

  #profileBtn .sidebar-account-banner-image.visible,
  #profileBtn .sidebar-account-banner-video.visible {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: cover !important;
    object-position: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 3 !important;
  }

  #profileBtn .sidebar-account-row {
    position: relative !important;
    z-index: 10 !important;
  }

  #profileBtn .sidebar-account-avatar {
    position: relative !important;
    overflow: hidden !important;
    isolation: isolate !important;
  }

  #profileBtn .sidebar-account-avatar-image.visible,
  #profileBtn .sidebar-account-avatar-video.visible {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 50 !important;
  }

  #profileBtn .sidebar-account-avatar-fallback {
    display: none !important;
  }
}

/* ============================================================
   ScpGram v29 — data URLs rendered through Blob URLs
   ============================================================ */
@media (min-width: 769px) {
  #profileBtn .sidebar-account-banner-image.visible,
  #profileBtn .sidebar-account-banner-video.visible,
  #profileBtn .sidebar-account-avatar-image.visible,
  #profileBtn .sidebar-account-avatar-video.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    filter: none !important;
    clip: auto !important;
    clip-path: none !important;
    mix-blend-mode: normal !important;
  }

  #profileBtn .sidebar-account-banner-image.visible,
  #profileBtn .sidebar-account-banner-video.visible {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    z-index: 3 !important;
  }

  #profileBtn .sidebar-account-avatar-image.visible,
  #profileBtn .sidebar-account-avatar-video.visible {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    z-index: 50 !important;
  }

  #profileBtn .sidebar-account-avatar {
    background: transparent !important;
  }
}

/* ============================================================
   ScpGram v30 — fresh profile media for sidebar
   ============================================================ */
@media (min-width: 769px) {
  #profileBtn .sidebar-account-banner {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    background: transparent !important;
    z-index: 0 !important;
  }

  #profileBtn .sidebar-account-banner-image.visible,
  #profileBtn .sidebar-account-banner-video.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    border: 0 !important;
    margin: 0 !important;
    z-index: 3 !important;
  }

  #profileBtn .sidebar-account-row {
    position: relative !important;
    z-index: 10 !important;
  }

  #profileBtn .sidebar-account-avatar {
    position: relative !important;
    overflow: hidden !important;
    isolation: isolate !important;
    background: transparent !important;
  }

  #profileBtn .sidebar-account-avatar-image.visible,
  #profileBtn .sidebar-account-avatar-video.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    border: 0 !important;
    margin: 0 !important;
    z-index: 50 !important;
  }

  #profileBtn .sidebar-account-avatar-fallback {
    display: none !important;
  }
}

/* ============================================================
   ScpGram v32 — sidebar account banner darkening
   ============================================================ */
@media (min-width: 769px) {
  #profileBtn .sidebar-account-banner::after {
    content: "" !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 4 !important;
    pointer-events: none !important;
    background: rgba(0, 0, 0, 0.48) !important;
  }

  #profileBtn .sidebar-account-row {
    position: relative !important;
    z-index: 10 !important;
  }
}

/* ============================================================
   ScpGram mobile layout v1
   Target: phones + narrow tablet previews (<= 900px)
   ============================================================ */
@media (max-width: 900px) {
  :root {
    --mobile-bottom-nav-height: 68px;
    --mobile-horizontal-pad: 14px;
  }

  html,
  body {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 100dvh !important;
    overflow: hidden !important;
  }

  body {
    -webkit-text-size-adjust: 100% !important;
    overscroll-behavior: none !important;
  }

  #layout {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Desktop navigation is replaced by the mobile bottom bar. */
  #sidebar,
  .layout-resizer-sidebar,
  .layout-resizer-chat-list {
    display: none !important;
  }

  /* ----------------------------------------------------------
     Main chats screen
     ---------------------------------------------------------- */
  #chatList {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 0 calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 10px) !important;
    border: 0 !important;
    background: var(--bg) !important;
    overflow: hidden !important;
  }

  #chatList.scp-main-menu {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  /* Header */
  #chatList .chat-list-header {
    position: relative !important;
    flex: 0 0 auto !important;
    min-height: 58px !important;
    height: 58px !important;
    padding: calc(8px + env(safe-area-inset-top, 0px)) var(--mobile-horizontal-pad) 8px !important;
    margin: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent) !important;
    border-radius: 0 0 16px 16px !important;
    background: color-mix(in srgb, var(--panel) 94%, transparent) !important;
    box-shadow: 0 8px 22px color-mix(in srgb, #000 16%, transparent) !important;
    box-sizing: content-box !important;
  }

  #chatList .chat-list-header h2 {
    margin: 0 !important;
    font-size: 31px !important;
    line-height: 1 !important;
    font-weight: 950 !important;
    letter-spacing: -.035em !important;
  }

  #chatList .chat-list-actions {
    gap: 7px !important;
  }

  #chatList .chat-list-actions .profile-mobile-btn,
  #chatList .chat-list-actions .settings-mobile-btn {
    display: none !important;
  }

  #chatList .create-chat-btn.scp-main-menu-plus,
  #chatList #createChatBtn {
    display: grid !important;
    place-items: center !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 16px !important;
    background: var(--accent) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent) !important;
  }

  #chatList .create-chat-btn.scp-main-menu-plus img {
    width: 29px !important;
    height: 29px !important;
    object-fit: contain !important;
    filter: brightness(0) invert(1) !important;
  }

  /* Search */
  #chatList .list-search,
  #chatList .scp-main-menu-top-island .list-search {
    flex: 0 0 auto !important;
    width: 100% !important;
    margin: 12px 0 8px !important;
    padding: 0 var(--mobile-horizontal-pad) !important;
    box-sizing: border-box !important;
    background: transparent !important;
  }

  #chatList .list-search input {
    width: 100% !important;
    height: 54px !important;
    min-height: 54px !important;
    padding: 0 16px 0 54px !important;
    border: 0 !important;
    border-radius: 16px !important;
    background: var(--panel2) !important;
    color: var(--text) !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 72%, transparent) !important;
  }

  #chatList .list-search input::placeholder {
    color: var(--muted) !important;
    opacity: 1 !important;
  }

  #chatList .list-search::before {
    left: calc(var(--mobile-horizontal-pad) + 16px) !important;
    top: 50% !important;
    width: 27px !important;
    height: 27px !important;
    transform: translateY(-50%) !important;
    color: var(--text) !important;
    opacity: .94 !important;
  }

  /* Hide the legacy tab switcher on the phone. Bottom navigation handles it. */
  #chatList .list-tabs {
    display: none !important;
  }

  /* Chat cards */
  #chatList #chatListContent {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 4px var(--mobile-horizontal-pad) 16px !important;
    scrollbar-width: none !important;
  }

  #chatList #chatListContent::-webkit-scrollbar {
    display: none !important;
  }

  #chatList .chatItem,
  #chatList.scp-main-menu .chatItem,
  #chatList.scp-main-menu .scp-menu-feed-item {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 88px !important;
    margin: 0 0 10px !important;
    padding: 11px !important;
    display: grid !important;
    grid-template-columns: 60px minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 11px !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: var(--panel) !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 48%, transparent) !important;
  }

  #chatList .chatItem:hover,
  #chatList .chatItem.active,
  #chatList.scp-main-menu .chatItem.active,
  #chatList.scp-main-menu .scp-menu-feed-item:hover {
    background: color-mix(in srgb, var(--accent) 8%, var(--panel) 92%) !important;
  }

  #chatList .chatItem .avatar,
  #chatList.scp-main-menu .chatItem .avatar {
    width: 60px !important;
    min-width: 60px !important;
    height: 60px !important;
    min-height: 60px !important;
    border-radius: 16px !important;
  }

  #chatList .chatItem .info,
  #chatList.scp-main-menu .chatItem .info {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  #chatList .chatItem .name,
  #chatList .scp-menu-feed-item .name {
    font-size: 18px !important;
    line-height: 1.08 !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #chatList .chatItem .last-message,
  #chatList .scp-menu-feed-item .last-message {
    margin-top: 4px !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
    font-weight: 750 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    opacity: .72 !important;
  }

  #chatList .chatItem .time,
  #chatList .scp-chat-item-time,
  #chatList.scp-main-menu .scp-menu-feed-meta {
    font-size: 11px !important;
    font-weight: 850 !important;
    white-space: nowrap !important;
    align-self: center !important;
  }

  /* ----------------------------------------------------------
     Mobile bottom navigation
     ---------------------------------------------------------- */
  .scp-mobile-tab-bar {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: max(10px, env(safe-area-inset-bottom, 0px)) !important;
    transform: translateX(-50%) !important;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    align-items: center !important;
    width: min(246px, calc(100vw - 28px)) !important;
    height: 62px !important;
    min-height: 62px !important;
    padding: 4px 8px !important;
    border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border) 62%) !important;
    border-radius: 18px !important;
    background: color-mix(in srgb, var(--panel) 94%, transparent) !important;
    box-shadow: 0 12px 30px color-mix(in srgb, #000 24%, transparent) !important;
    backdrop-filter: blur(18px) saturate(1.2) !important;
    z-index: 2600 !important;
  }

  .scp-mobile-tab-button {
    display: grid !important;
    place-items: center !important;
    width: 52px !important;
    min-width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 15px !important;
    background: transparent !important;
    color: var(--muted) !important;
  }

  .scp-mobile-tab-button.active {
    background: color-mix(in srgb, var(--accent) 18%, transparent) !important;
    color: var(--accent) !important;
  }

  .scp-mobile-tab-icon {
    width: 27px !important;
    height: 27px !important;
  }

  .scp-mobile-tab-icon img {
    display: block !important;
    width: 27px !important;
    height: 27px !important;
    max-width: 27px !important;
    max-height: 27px !important;
    object-fit: contain !important;
    filter: brightness(0) saturate(100%) invert(93%) sepia(7%) saturate(379%) hue-rotate(351deg) brightness(101%) contrast(92%) !important;
  }

  .scp-mobile-tab-button.active .scp-mobile-tab-icon img {
    filter: brightness(0) saturate(100%) invert(68%) sepia(77%) saturate(1405%) hue-rotate(336deg) brightness(101%) contrast(103%) !important;
  }

  /* ----------------------------------------------------------
     Open chat on phone
     ---------------------------------------------------------- */
  body.mobile-chat-open #chatList {
    display: none !important;
  }

  body.mobile-chat-open #chat {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.mobile-chat-open #chatHeader {
    flex: 0 0 auto !important;
    width: 100% !important;
    height: 64px !important;
    min-height: 64px !important;
    margin: 0 !important;
    padding: calc(7px + env(safe-area-inset-top, 0px)) 9px 7px !important;
    border-radius: 0 !important;
    border-inline: 0 !important;
    border-top: 0 !important;
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  body.mobile-chat-open #chatHeader .back-btn {
    display: grid !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    place-items: center !important;
    border-radius: 12px !important;
  }

  body.mobile-chat-open #chatHeader .chat-user {
    min-width: 0 !important;
    gap: 9px !important;
    overflow: hidden !important;
  }

  body.mobile-chat-open #chatHeader .chat-user .avatar {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 13px !important;
  }

  body.mobile-chat-open #chatHeader .chat-user .name {
    font-size: 16px !important;
    font-weight: 900 !important;
  }

  body.mobile-chat-open #chatHeader .chat-user .status {
    font-size: 11px !important;
  }

  body.mobile-chat-open #chatHeader .chat-actions {
    gap: 4px !important;
  }

  body.mobile-chat-open #chatHeader .chat-actions .action-btn {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 12px !important;
  }

  body.mobile-chat-open #messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 10px 10px 8px !important;
    overflow-y: auto !important;
  }

  body.mobile-chat-open #messageInput {
    flex: 0 0 auto !important;
    width: 100% !important;
    min-height: 60px !important;
    margin: 0 !important;
    padding: 7px !important;
    border-radius: 0 !important;
    border-inline: 0 !important;
    border-bottom: 0 !important;
  }

  body.mobile-chat-open #textInput {
    font-size: 15px !important;
  }

  body.mobile-chat-open .scp-mobile-tab-bar {
    display: none !important;
  }

  /* ----------------------------------------------------------
     Profile/settings surfaces on phone
     ---------------------------------------------------------- */
  body.profile-home-mode #chatList,
  body.settings-home-mode #chatList,
  body.news-home-mode #chatList,
  body.calls-home-mode #chatList {
    display: none !important;
  }

  body.profile-home-mode #profileHome,
  body.settings-home-mode #settingsHome {
    display: block !important;
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: env(safe-area-inset-top, 0px) 0 calc(var(--mobile-bottom-nav-height) + 10px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.profile-home-mode .scp-mobile-tab-bar,
  body.settings-home-mode .scp-mobile-tab-bar {
    display: grid !important;
  }

  /* The profile/settings page should not retain desktop max-widths. */
  body.profile-home-mode #profileHome *,
  body.settings-home-mode #settingsHome * {
    max-width: 100% !important;
  }

  body.profile-home-mode #profileHome .scp-profile-v3,
  body.settings-home-mode #settingsHome .tg-settings-shell,
  body.settings-home-mode #settingsHome #settingsModal .modal-content {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header h2 {
    font-size: 34px !important;
  }

  /* Hide the mobile tab bar on peer profile pages with their own back button. */
  body.profile-home-mode #profileHome.scp-profile-peer ~ .scp-mobile-tab-bar {
    display: none !important;
  }
}

/* ============================================================
   ScpGram mobile v2 — desktop-style burger drawer
   ============================================================ */
@media (max-width: 900px) {
  /* The bottom "island" navigation is replaced by the burger drawer. */
  .scp-mobile-tab-bar {
    display: none !important;
  }

  /* The desktop menu wrapper stops being a visual island on mobile. */
  #chatList .scp-main-menu-top-island {
    display: contents !important;
  }

  #chatList .list-search {
    margin-top: 10px !important;
  }

  /* Burger button in the Chats header. */
  #mobileBurgerBtn {
    display: grid !important;
    place-items: center !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid color-mix(in srgb, var(--border) 82%, var(--accent) 18%) !important;
    border-radius: 14px !important;
    background: var(--panel2) !important;
    color: var(--text) !important;
    box-shadow: 0 6px 18px color-mix(in srgb, #000 18%, transparent) !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  #mobileBurgerBtn:active {
    transform: scale(.96) !important;
  }

  .mobile-burger-lines {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 5px !important;
    width: 22px !important;
    height: 22px !important;
  }

  .mobile-burger-lines i {
    display: block !important;
    width: 22px !important;
    height: 2.5px !important;
    border-radius: 999px !important;
    background: currentColor !important;
    transition: transform .18s ease, opacity .18s ease !important;
  }

  body.mobile-menu-open #mobileBurgerBtn .mobile-burger-lines i:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg) !important;
  }

  body.mobile-menu-open #mobileBurgerBtn .mobile-burger-lines i:nth-child(2) {
    opacity: 0 !important;
  }

  body.mobile-menu-open #mobileBurgerBtn .mobile-burger-lines i:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg) !important;
  }

  /* Overlay */
  #mobileMenuOverlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 4990 !important;
    display: block !important;
    padding: 0 !important;
    border: 0 !important;
    background: rgba(0, 0, 0, .48) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity .18s ease, visibility .18s ease !important;
    cursor: pointer !important;
  }

  #mobileMenuOverlay.visible {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  /* Reuse the exact desktop sidebar on mobile as a drawer. */
  #sidebar {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: min(290px, 84vw) !important;
    min-width: 0 !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding:
      max(10px, env(safe-area-inset-top, 0px))
      8px
      max(10px, env(safe-area-inset-bottom, 0px)) !important;
    margin: 0 !important;
    flex-direction: column !important;
    border: 0 !important;
    border-right: 1px solid var(--border) !important;
    border-radius: 0 22px 22px 0 !important;
    background: var(--panel) !important;
    box-shadow: 18px 0 45px rgba(0,0,0,.28) !important;
    z-index: 5000 !important;
    overflow: hidden auto !important;
    transform: translateX(-105%) !important;
    transition: transform .22s cubic-bezier(.2,.8,.2,1) !important;
    visibility: visible !important;
  }

  body.mobile-menu-open #sidebar {
    transform: translateX(0) !important;
  }

  #sidebar .sidebar-brand {
    flex: 0 0 auto !important;
    padding: 8px 6px 14px !important;
  }

  #sidebar .sidebar-brand-row {
    min-height: 56px !important;
    display: grid !important;
    grid-template-columns: 42px minmax(0,1fr) 42px !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 0 4px !important;
  }

  #sidebar .sidebar-brand .logo {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    border-radius: 13px !important;
  }

  #sidebar .sidebar-brand-copy strong {
    font-size: 16px !important;
  }

  #sidebar .sidebar-compose {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    border-radius: 13px !important;
  }

  #sidebar .sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding: 4px 0 !important;
  }

  #sidebar .sidebar-nav-item {
    width: 100% !important;
    min-height: 50px !important;
    padding: 0 14px !important;
    border-radius: 13px !important;
    display: grid !important;
    grid-template-columns: 28px minmax(0,1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    text-align: left !important;
  }

  #sidebar .sidebar-nav-item img {
    width: 22px !important;
    height: 22px !important;
    object-fit: contain !important;
    filter: brightness(0) invert(1) !important;
    opacity: .92 !important;
  }

  #sidebar .sidebar-nav-item span {
    font-size: 15px !important;
    font-weight: 850 !important;
  }

  #sidebar .sidebar-account {
    margin-top: auto !important;
    padding: 10px 0 4px !important;
  }

  #sidebar .sidebar-account-menu {
    max-width: calc(100vw - 24px) !important;
  }

  #sidebar .sidebar-footer {
    display: none !important;
  }

  /* Menu is allowed to stay above the drawer, same as desktop. */
  body.mobile-menu-open .sidebar-account-menu {
    z-index: 6000 !important;
  }

  /* When the drawer is open, don't allow content to scroll underneath. */
  body.mobile-menu-open {
    overflow: hidden !important;
  }

  /* Don't show desktop/mobile profile/settings action buttons in the chat header. */
  #chatList .chat-list-actions .profile-mobile-btn,
  #chatList .chat-list-actions .settings-mobile-btn {
    display: none !important;
  }
}

/* ============================================================
   ScpGram mobile v3 — final drawer design from reference
   ============================================================ */
@media (max-width: 900px) {
  /* Main screen: compact header, burger on the LEFT. */
  #chatList .chat-list-header {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 70px !important;
    min-height: 70px !important;
    padding: max(8px, env(safe-area-inset-top, 0px)) 14px 8px !important;
    border: 1px solid color-mix(in srgb, var(--border) 75%, transparent) !important;
    border-radius: 0 0 14px 14px !important;
    background: var(--panel) !important;
  }

  #chatList .chat-list-header h2 {
    margin: 0 !important;
    font-size: 34px !important;
    line-height: 1 !important;
    text-align: center !important;
  }

  #chatList .chat-list-actions {
    position: absolute !important;
    inset: 0 !important;
    pointer-events: none !important;
    display: block !important;
  }

  #chatList .chat-list-actions #createChatBtn {
    position: absolute !important;
    right: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    pointer-events: auto !important;
    width: 47px !important;
    height: 47px !important;
    min-width: 47px !important;
    min-height: 47px !important;
    padding: 0 !important;
    border-radius: 15px !important;
    background: var(--accent) !important;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 27%, transparent) !important;
  }

  #chatList .chat-list-actions #createChatBtn .scp-create-icon-plus {
    display: none !important;
  }

  #chatList .chat-list-actions #createChatBtn .scp-create-icon-edit {
    display: block !important;
    width: 29px !important;
    height: 29px !important;
    filter: brightness(0) invert(1) !important;
  }

  #mobileBurgerBtn {
    position: absolute !important;
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    pointer-events: auto !important;
    width: 47px !important;
    min-width: 47px !important;
    height: 47px !important;
    min-height: 47px !important;
    border-radius: 15px !important;
    background: var(--panel2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    z-index: 5 !important;
  }

  /* The drawer uses the same sidebar data/functionality as desktop. */
  #sidebar {
    width: min(330px, 88vw) !important;
    padding: max(10px, env(safe-area-inset-top, 0px)) 10px max(12px, env(safe-area-inset-bottom, 0px)) !important;
    border-right: 1px solid color-mix(in srgb, var(--border) 75%, transparent) !important;
    border-radius: 0 22px 22px 0 !important;
    background:
      linear-gradient(180deg,
        color-mix(in srgb, var(--panel) 97%, transparent),
        color-mix(in srgb, var(--bg) 94%, transparent)
      ) !important;
    box-shadow: 20px 0 50px rgba(0,0,0,.34) !important;
  }

  .mobile-drawer-head {
    display: flex !important;
    align-items: center !important;
    height: 52px !important;
    min-height: 52px !important;
    padding: 0 4px !important;
  }

  .mobile-drawer-close {
    display: grid !important;
    place-items: center !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--text) !important;
    border-radius: 12px !important;
  }

  .mobile-drawer-close .mobile-burger-lines {
    gap: 5px !important;
  }

  .mobile-drawer-close .mobile-burger-lines i {
    width: 24px !important;
    height: 2px !important;
  }

  #sidebar .sidebar-brand {
    display: none !important;
  }

  #sidebar .sidebar-account.mobile-drawer-profile {
    display: block !important;
    width: 100% !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-button {
    width: 100% !important;
    min-height: 74px !important;
    padding: 7px 8px !important;
    border-radius: 18px !important;
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent) !important;
    background: color-mix(in srgb, var(--panel2) 88%, transparent) !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-banner {
    display: none !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-row {
    min-height: 58px !important;
    padding: 0 !important;
    display: grid !important;
    grid-template-columns: 50px minmax(0, 1fr) 28px !important;
    align-items: center !important;
    gap: 11px !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-avatar {
    width: 50px !important;
    min-width: 50px !important;
    height: 50px !important;
    min-height: 50px !important;
    border-radius: 15px !important;
    border: 1px solid var(--border) !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-copy strong {
    font-size: 16px !important;
    color: var(--text) !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-copy small {
    font-size: 12px !important;
    color: var(--muted) !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-more {
    width: 28px !important;
    height: 28px !important;
    font-size: 0 !important;
    background: transparent !important;
    color: var(--muted) !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-more::before {
    content: "⌄" !important;
    font-size: 22px !important;
    line-height: 1 !important;
  }

  #sidebar .sidebar-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    padding: 0 4px !important;
    order: 2 !important;
  }

  #sidebar .sidebar-nav-item,
  #sidebar .mobile-drawer-create {
    min-height: 49px !important;
    width: 100% !important;
    padding: 0 12px !important;
    display: grid !important;
    grid-template-columns: 30px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 12px !important;
    border-radius: 13px !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--text) !important;
    text-align: left !important;
  }

  #sidebar .sidebar-nav-item.active {
    background: color-mix(in srgb, var(--accent) 15%, var(--panel2) 85%) !important;
  }

  #sidebar .sidebar-nav-item img {
    width: 23px !important;
    height: 23px !important;
    filter: brightness(0) invert(1) !important;
  }

  #sidebar .sidebar-nav-item span,
  #sidebar .mobile-drawer-create {
    font-size: 15px !important;
    font-weight: 850 !important;
  }

  #sidebar .mobile-drawer-create {
    background: transparent !important;
  }

  #sidebar .mobile-drawer-create::before {
    content: "+" !important;
    display: grid !important;
    place-items: center !important;
    width: 30px !important;
    height: 30px !important;
    font-size: 30px !important;
    line-height: 1 !important;
    font-weight: 300 !important;
    color: var(--text) !important;
  }

  #sidebar .mobile-drawer-create {
    color: var(--text) !important;
  }

  #sidebar .mobile-drawer-create {
    font-size: 0 !important;
  }

  #sidebar .mobile-drawer-create::after {
    content: "Создать чат" !important;
    font-size: 15px !important;
    font-weight: 850 !important;
    justify-self: start !important;
  }

  #sidebar .mobile-drawer-account-menu {
    position: static !important;
    display: block !important;
    width: 100% !important;
    margin: 17px 0 0 !important;
    padding: 15px 4px 4px !important;
    border: 0 !important;
    border-top: 1px solid var(--border) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  #sidebar .mobile-drawer-accounts-title {
    display: block !important;
    padding: 0 8px 9px !important;
    color: var(--muted) !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: .02em !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-accounts-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    max-height: 280px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account {
    min-height: 58px !important;
    padding: 7px 8px !important;
    border-radius: 12px !important;
    display: grid !important;
    grid-template-columns: 43px minmax(0,1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    background: transparent !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account:hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent) !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-avatar {
    width: 43px !important;
    height: 43px !important;
    min-width: 43px !important;
    min-height: 43px !important;
    border-radius: 13px !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-copy strong {
    font-size: 15px !important;
    font-weight: 900 !important;
    color: var(--text) !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-copy small {
    margin-top: 2px !important;
    font-size: 11px !important;
    font-weight: 650 !important;
    color: var(--muted) !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-account-menu-add,
  #sidebar .mobile-drawer-account-menu #sidebarLogoutBtn {
    width: 100% !important;
    min-height: 51px !important;
    margin-top: 3px !important;
    padding: 0 8px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: var(--text) !important;
    text-align: left !important;
    font-size: 15px !important;
    font-weight: 850 !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-account-menu-add {
    margin-top: 8px !important;
    border-top: 1px solid var(--border) !important;
    border-radius: 0 !important;
    padding-top: 8px !important;
  }

  #sidebar .mobile-drawer-account-menu #sidebarLogoutBtn {
    color: #ff6d67 !important;
    margin-top: 5px !important;
  }

  /* Main content dims only when the drawer is open. */
  #mobileMenuOverlay {
    background: rgba(0,0,0,.56) !important;
  }
}

@media (min-width: 901px) {
  .mobile-drawer-head,
  .mobile-drawer-account-menu {
    display: none !important;
  }
}

/* ============================================================
   ScpGram mobile v4 — hard avatar/media limits
   ============================================================ */
@media (max-width: 900px) {
  /* Never allow profile wallpaper to leak into the drawer layout. */
  #sidebar .mobile-drawer-profile .sidebar-account-banner,
  #sidebar .mobile-drawer-profile .sidebar-account-banner-image,
  #sidebar .mobile-drawer-profile .sidebar-account-banner-video {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    background: none !important;
    background-image: none !important;
  }

  /* Current account avatar: always exactly 50x50. */
  #sidebar .mobile-drawer-profile .sidebar-account-avatar {
    position: relative !important;
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
    flex: 0 0 50px !important;
    overflow: hidden !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 15px !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-avatar-image,
  #sidebar .mobile-drawer-profile .sidebar-account-avatar-video {
    position: absolute !important;
    inset: 0 !important;
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
    object-fit: cover !important;
    object-position: center !important;
    aspect-ratio: 1 / 1 !important;
  }

  /* Saved accounts: never larger than the 43px slot. */
  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-avatar {
    position: relative !important;
    width: 43px !important;
    min-width: 43px !important;
    max-width: 43px !important;
    height: 43px !important;
    min-height: 43px !important;
    max-height: 43px !important;
    flex: 0 0 43px !important;
    overflow: hidden !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 13px !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-avatar img,
  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-avatar video {
    position: absolute !important;
    inset: 0 !important;
    width: 43px !important;
    min-width: 43px !important;
    max-width: 43px !important;
    height: 43px !important;
    min-height: 43px !important;
    max-height: 43px !important;
    object-fit: cover !important;
    object-position: center !important;
    aspect-ratio: 1 / 1 !important;
  }

  /* Stop any profile media from sizing its parent via intrinsic dimensions. */
  #sidebar .sidebar-account img,
  #sidebar .sidebar-account video {
    max-width: 100% !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-button,
  #sidebar .mobile-drawer-account-menu .sidebar-saved-account {
    overflow: hidden !important;
  }
}

/* ============================================================
   ScpGram mobile v5 — mockup layout/order
   ============================================================ */
@media (max-width: 900px) {
  /* Drawer is a real vertical navigation, not a floating account popup. */
  #sidebar {
    display: flex !important;
    flex-direction: column !important;
    width: min(302px, 78vw) !important;
    min-width: 0 !important;
    max-width: min(302px, 78vw) !important;
    height: 100dvh !important;
    padding: max(9px, env(safe-area-inset-top, 0px)) 12px max(10px, env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border-right: 1px solid color-mix(in srgb, var(--border) 72%, transparent) !important;
    border-radius: 0 18px 18px 0 !important;
    background:
      linear-gradient(
        180deg,
        color-mix(in srgb, var(--panel) 96%, transparent),
        color-mix(in srgb, var(--bg) 96%, transparent)
      ) !important;
  }

  /* Exact visual order from the mockup:
     burger -> profile -> chats/calls/create/settings -> accounts. */
  #sidebar .mobile-drawer-head {
    order: 1 !important;
    flex: 0 0 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    justify-content: center !important;
  }

  #sidebar .mobile-drawer-profile {
    order: 2 !important;
    flex: 0 0 auto !important;
    margin: 0 0 14px !important;
  }

  #sidebar .sidebar-nav {
    order: 3 !important;
    flex: 0 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #sidebar .mobile-drawer-account-menu {
    order: 4 !important;
    flex: 0 0 auto !important;
    position: static !important;
    margin: 17px 0 0 !important;
    padding: 15px 0 6px !important;
    border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent) !important;
  }

  #sidebar .sidebar-footer {
    display: none !important;
  }

  /* Profile row: compact card directly below burger. */
  #sidebar .mobile-drawer-profile .sidebar-account-button {
    min-height: 72px !important;
    height: 72px !important;
    padding: 7px 8px !important;
    border-radius: 17px !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-row {
    min-height: 56px !important;
    height: 56px !important;
    padding: 0 !important;
    grid-template-columns: 48px minmax(0, 1fr) 24px !important;
    gap: 10px !important;
    align-items: center !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-avatar {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    flex: 0 0 48px !important;
    border-radius: 14px !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-copy {
    min-width: 0 !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-copy strong {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 15px !important;
    line-height: 1.05 !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-copy small {
    display: block !important;
    margin-top: 3px !important;
    font-size: 11px !important;
    line-height: 1 !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-more {
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
  }

  /* Navigation matches the mockup: compact, no extra cards. */
  #sidebar .sidebar-nav-item,
  #sidebar .mobile-drawer-create {
    width: 100% !important;
    min-height: 48px !important;
    height: 48px !important;
    padding: 0 11px !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    gap: 10px !important;
    border-radius: 12px !important;
  }

  #sidebar .sidebar-nav-item span,
  #sidebar .mobile-drawer-create::after {
    font-size: 15px !important;
    line-height: 1 !important;
  }

  #sidebar .sidebar-nav-item img {
    width: 21px !important;
    height: 21px !important;
  }

  #sidebar .mobile-drawer-create::before {
    width: 28px !important;
    height: 28px !important;
    font-size: 28px !important;
  }

  /* Accounts are now UNDER the navigation, never above it. */
  #sidebar .mobile-drawer-accounts-title {
    padding: 0 8px 8px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    color: var(--muted) !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-accounts-list {
    gap: 2px !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account {
    width: 100% !important;
    min-height: 54px !important;
    height: 54px !important;
    padding: 5px 7px !important;
    grid-template-columns: 40px minmax(0, 1fr) !important;
    gap: 9px !important;
    border-radius: 11px !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-avatar {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    flex: 0 0 40px !important;
    border-radius: 12px !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-avatar img,
  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-avatar video {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-copy strong {
    font-size: 14px !important;
    line-height: 1.05 !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-saved-account-copy small {
    margin-top: 2px !important;
    font-size: 10px !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-account-menu-add,
  #sidebar .mobile-drawer-account-menu #sidebarLogoutBtn {
    min-height: 45px !important;
    height: 45px !important;
    padding: 0 7px !important;
    margin: 4px 0 0 !important;
    border-radius: 10px !important;
    font-size: 14px !important;
  }

  #sidebar .mobile-drawer-account-menu .sidebar-account-menu-add {
    border-top: 0 !important;
    margin-top: 8px !important;
    padding-top: 0 !important;
  }

  #sidebar .mobile-drawer-account-menu #sidebarLogoutBtn {
    margin-top: 2px !important;
  }

  /* Main list: exactly the visual hierarchy from the reference. */
  #chatList .chat-list-header {
    height: 72px !important;
    min-height: 72px !important;
    padding: max(8px, env(safe-area-inset-top, 0px)) 13px 8px !important;
  }

  #chatList .chat-list-header h2 {
    font-size: 32px !important;
  }

  #chatList #createChatBtn {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    border-radius: 15px !important;
  }

  #chatList .list-search {
    margin: 12px 0 8px !important;
    padding: 0 11px !important;
  }

  #chatList .list-search input {
    height: 54px !important;
    min-height: 54px !important;
    border-radius: 27px !important;
    font-size: 15px !important;
  }

  #chatList #chatListContent {
    padding: 5px 11px 18px !important;
  }

  #chatList .chatItem,
  #chatList.scp-main-menu .scp-menu-feed-item {
    min-height: 88px !important;
    padding: 10px !important;
    margin-bottom: 9px !important;
    border-radius: 14px !important;
  }

  #chatList .chatItem .avatar,
  #chatList.scp-main-menu .chatItem .avatar {
    width: 60px !important;
    min-width: 60px !important;
    height: 60px !important;
    min-height: 60px !important;
    border-radius: 16px !important;
  }

  #chatList .chatItem .name,
  #chatList .scp-menu-feed-item .name {
    font-size: 17px !important;
  }

  #chatList .chatItem .last-message,
  #chatList .scp-menu-feed-item .last-message {
    font-size: 12px !important;
  }
}

/* ============================================================
   ScpGram mobile v6 — drawer tab navigation
   ============================================================ */
@media (max-width: 900px) {
  #sidebar .sidebar-nav {
    width: 100% !important;
    margin: 0 !important;
    padding: 2px 0 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
  }

  #sidebar .sidebar-nav-item,
  #sidebar .mobile-drawer-create {
    position: relative !important;
    width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 11px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: transparent !important;
    color: var(--text) !important;
    text-align: left !important;
    -webkit-tap-highlight-color: transparent !important;
    transition:
      background .16s ease,
      color .16s ease,
      transform .12s ease !important;
  }

  #sidebar .sidebar-nav-item:active,
  #sidebar .mobile-drawer-create:active {
    transform: scale(.985) !important;
  }

  #sidebar .sidebar-nav-item:hover,
  #sidebar .mobile-drawer-create:hover {
    background: color-mix(in srgb, var(--text) 5%, transparent) !important;
  }

  #sidebar .sidebar-nav-item.active,
  #sidebar .sidebar-nav-item[aria-current="page"] {
    background:
      linear-gradient(
        90deg,
        color-mix(in srgb, var(--accent) 19%, var(--panel2) 81%),
        color-mix(in srgb, var(--accent) 12%, var(--panel2) 88%)
      ) !important;
    color: #fff !important;
    box-shadow:
      inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
      0 4px 14px rgba(0,0,0,.10) !important;
  }

  #sidebar .sidebar-nav-item.active::before,
  #sidebar .sidebar-nav-item[aria-current="page"]::before {
    content: "" !important;
    position: absolute !important;
    left: 0 !important;
    top: 10px !important;
    bottom: 10px !important;
    width: 3px !important;
    border-radius: 0 4px 4px 0 !important;
    background: var(--accent) !important;
  }

  #sidebar .sidebar-nav-item img {
    width: 23px !important;
    height: 23px !important;
    min-width: 23px !important;
    min-height: 23px !important;
    max-width: 23px !important;
    max-height: 23px !important;
    display: block !important;
    object-fit: contain !important;
    filter: brightness(0) invert(1) !important;
    opacity: .88 !important;
  }

  #sidebar .sidebar-nav-item.active img,
  #sidebar .sidebar-nav-item[aria-current="page"] img {
    opacity: 1 !important;
  }

  #sidebar .sidebar-nav-item span,
  #sidebar .mobile-drawer-create::after {
    min-width: 0 !important;
    display: block !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 15px !important;
    line-height: 1 !important;
    font-weight: 850 !important;
    letter-spacing: -.01em !important;
  }

  /* Create chat is the same size as a regular tab,
     with a clean plus icon in the first column. */
  #sidebar .mobile-drawer-create {
    font-size: 0 !important;
  }

  #sidebar .mobile-drawer-create::before {
    content: "+" !important;
    width: 34px !important;
    height: 34px !important;
    display: grid !important;
    place-items: center !important;
    font-size: 28px !important;
    line-height: 1 !important;
    font-weight: 400 !important;
    color: var(--text) !important;
  }

  #sidebar .mobile-drawer-create::after {
    content: "Создать чат" !important;
    grid-column: 2 !important;
    color: var(--text) !important;
  }

  /* Settings gets the same visual weight and spacing as Calls/Chats. */
  #sidebar #sidebarSettingsBtn {
    margin-top: 0 !important;
  }

  /* Separate actions from account section with a quiet divider. */
  #sidebar .mobile-drawer-account-menu {
    margin-top: 12px !important;
    padding-top: 14px !important;
    border-top: 1px solid color-mix(in srgb, var(--border) 76%, transparent) !important;
  }

  /* Keep the drawer header centered and clean. */
  #sidebar .mobile-drawer-head {
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  #sidebar .mobile-drawer-close {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 12px !important;
  }
}

/* ============================================================
   ScpGram mobile v7 — drawer alignment + stable burger
   ============================================================ */
@media (max-width: 900px) {
  /* Header burger: fixed, left, touch-friendly, no transform jump. */
  #mobileBurgerBtn {
    left: 12px !important;
    top: 50% !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
    margin: 0 !important;
    transform: translateY(-50%) !important;
    transform-origin: center !important;
    touch-action: manipulation !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    z-index: 100 !important;
  }

  #mobileBurgerBtn:active {
    transform: translateY(-50%) !important;
  }

  /* Drawer navigation is strictly left-aligned. */
  #sidebar .sidebar-nav,
  #sidebar .sidebar-nav-item,
  #sidebar .mobile-drawer-create {
    align-items: center !important;
    justify-items: start !important;
    justify-content: start !important;
    text-align: left !important;
  }

  #sidebar .sidebar-nav-item,
  #sidebar .mobile-drawer-create {
    grid-template-columns: 34px minmax(0, 1fr) !important;
  }

  #sidebar .sidebar-nav-item img {
    justify-self: start !important;
  }

  #sidebar .sidebar-nav-item span,
  #sidebar .mobile-drawer-create::after {
    justify-self: start !important;
    text-align: left !important;
  }

  /* Profile card: no dropdown arrow. */
  #sidebar .mobile-drawer-profile .sidebar-account-more {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-more::before {
    display: none !important;
    content: none !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-row {
    grid-template-columns: 48px minmax(0, 1fr) !important;
  }

  /* Create Chat exists ONLY in the drawer on mobile. */
  #chatList .chat-list-actions #createChatBtn {
    display: none !important;
  }

  #sidebar .mobile-drawer-create {
    display: grid !important;
    font-size: 0 !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    align-items: center !important;
    justify-items: start !important;
    overflow: hidden !important;
  }

  #sidebar .mobile-drawer-create > * {
    display: none !important;
    visibility: hidden !important;
  }

  #sidebar .mobile-drawer-create::before {
    display: grid !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    align-self: center !important;
    width: 30px !important;
    height: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    content: "+" !important;
    font-size: 28px !important;
    line-height: 30px !important;
    font-weight: 350 !important;
    text-align: center !important;
  }

  #sidebar .mobile-drawer-create::after {
    display: block !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    align-self: center !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    content: "Создать чат" !important;
    font-size: 15px !important;
    line-height: 1 !important;
    font-weight: 850 !important;
    white-space: nowrap !important;
    text-align: left !important;
  }

  /* Keep menu spacing compact like the mockup. */
  #sidebar .sidebar-nav {
    gap: 2px !important;
  }

  #sidebar .mobile-drawer-account-menu {
    align-self: stretch !important;
  }
}

/* ============================================================
   ScpGram mobile v8 — remove duplicate create buttons
   ============================================================ */
@media (max-width: 900px) {
  #sidebar #createChatBtn,
  #sidebar .create-chat-btn,
  #chatList .chat-list-actions #createChatBtn,
  body > #createChatBtn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }

  #sidebar #sidebarCreateChatBtn {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    font-size: 0 !important;
  }

  #sidebar #sidebarCreateChatBtn::before {
    content: "+" !important;
    display: grid !important;
    place-items: center !important;
    grid-column: 1 !important;
    width: 34px !important;
    height: 34px !important;
    font-size: 28px !important;
    line-height: 1 !important;
  }

  #sidebar #sidebarCreateChatBtn::after {
    content: "Создать чат" !important;
    display: block !important;
    grid-column: 2 !important;
    font-size: 15px !important;
    line-height: 1 !important;
    font-weight: 850 !important;
    white-space: nowrap !important;
    text-align: left !important;
  }

  #sidebar #sidebarCreateChatBtn > * {
    display: none !important;
  }
}

/* ============================================================
   ScpGram mobile v9 — drawer back button + profile left align
   ============================================================ */
@media (max-width: 900px) {
  /* Drawer header uses a back arrow instead of hamburger. */
  #sidebar .mobile-drawer-head {
    justify-content: flex-start !important;
    align-items: center !important;
    padding-left: 1px !important;
  }

  #sidebar .mobile-drawer-close {
    display: grid !important;
    place-items: center !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--text) !important;
    border-radius: 12px !important;
  }

  #sidebar .mobile-drawer-back-icon {
    display: block !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    object-fit: contain !important;
    filter: brightness(0) invert(1) !important;
  }

  /* Profile card: all content starts from the same left grid edge. */
  #sidebar .mobile-drawer-profile,
  #sidebar .mobile-drawer-profile .sidebar-account-button,
  #sidebar .mobile-drawer-profile .sidebar-account-row {
    justify-content: flex-start !important;
    justify-items: start !important;
    text-align: left !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-button {
    display: block !important;
    text-align: left !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-row {
    display: grid !important;
    grid-template-columns: 48px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-avatar {
    justify-self: start !important;
    align-self: center !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-copy {
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    justify-self: start !important;
    text-align: left !important;
  }

  #sidebar .mobile-drawer-profile .sidebar-account-copy strong,
  #sidebar .mobile-drawer-profile .sidebar-account-copy small {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
  }

  /* If any legacy center alignment is applied to the profile button,
     override it explicitly. */
  #sidebar .mobile-drawer-profile .sidebar-account-button > .sidebar-account-row {
    justify-items: start !important;
  }
}


/* ============================================================
   ScpGram mobile v10 — final mobile layout correction
   ============================================================ */
@media (max-width: 900px) {
  /* The drawer back button is anchored to the actual left edge. */
  #sidebar .mobile-drawer-head {
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #sidebar .mobile-drawer-close {
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
  }

  #sidebar .mobile-drawer-close:active {
    transform: translateY(-50%) !important;
  }

  /* Keep the Chats title clear of the burger button. */
  #chatList .chat-list-header {
    position: relative !important;
  }

  #chatList .chat-list-header h2 {
    margin: 0 !important;
    padding-left: 58px !important;
    padding-right: 8px !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #mobileBurgerBtn {
    left: 12px !important;
    z-index: 20 !important;
  }

  /* Settings is a full mobile surface, not a chat header underneath it. */
  body.settings-home-mode #chatHeader,
  body.settings-home-mode #pinnedBar,
  body.settings-home-mode #chatSearchBar,
  body.settings-home-mode #messages,
  body.settings-home-mode #typingBar,
  body.settings-home-mode #messageInput,
  body.settings-home-mode #appStatusBar {
    display: none !important;
  }

  body.settings-home-mode #chat {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: var(--bg) !important;
  }

  body.settings-home-mode #settingsHome {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    box-sizing: border-box !important;
    padding: env(safe-area-inset-top, 0px) 0 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: var(--bg) !important;
  }

  body.settings-home-mode #settingsHome #settingsModal {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-content {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 100% !important;
    height: auto !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  /* Clean settings header: back button left, title centered. */
  body.settings-home-mode #settingsHome #settingsModal .modal-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    height: 52px !important;
    min-height: 52px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 16px !important;
    border: 0 !important;
    background: color-mix(in srgb, var(--bg) 94%, transparent) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header h2 {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 48px !important;
    box-sizing: border-box !important;
    text-align: center !important;
    font-size: 24px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-close {
    position: absolute !important;
    left: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 2 !important;
    display: grid !important;
    place-items: center !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    font-size: 0 !important;
    color: var(--text) !important;
    background: color-mix(in srgb, var(--panel2) 88%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--border) 75%, transparent) !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-close::before {
    content: "‹" !important;
    display: block !important;
    font-size: 31px !important;
    line-height: 34px !important;
    font-weight: 400 !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-body {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 8px 20px !important;
    overflow: visible !important;
    background: transparent !important;
  }

  /* The navigation cards must stay inside the phone width. */
  body.settings-home-mode #settingsHome .tg-settings-shell {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 8px 8px 12px !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button {
    position: relative !important;
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 62px !important;
    height: 62px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 14px 0 8px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    text-align: left !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button .tg-settings-nav-icon {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    display: grid !important;
    place-items: center !important;
    border-radius: 13px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button .tg-settings-nav-icon img {
    width: 22px !important;
    height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    object-fit: contain !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button > span:not(.tg-settings-nav-icon) {
    min-width: 0 !important;
    display: block !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 15px !important;
    line-height: 1.1 !important;
    text-align: left !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button em {
    display: none !important;
  }

  /* Inline setting panels should stack below their selected row. */
  body.settings-home-mode #settingsHome .scp-settings-inline-panel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
    margin: -2px 0 8px !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panels {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
    padding: 0 8px 20px !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panel {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }

  body.settings-home-mode .scp-mobile-tab-bar {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}


/* ============================================================
   ScpGram mobile v11 — prevent tap-through after opening drawer
   ============================================================ */
@media (max-width: 900px) {
  #mobileBurgerBtn {
    touch-action: manipulation !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  #mobileMenuOverlay {
    touch-action: none !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  #sidebar .mobile-drawer-close {
    touch-action: manipulation !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
  }
}


/* ============================================================
   ScpGram mobile v12 — settings layout matches desktop behavior
   ============================================================ */
@media (max-width: 768px) {
  /* Keep the settings header visible on the main settings screen. */
  body.settings-home-mode #settingsHome #settingsModal .modal-header,
  body.settings-home-mode #settingsHome:not(.scp-settings-section-open) #settingsModal .modal-header {
    display: flex !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    width: 100% !important;
    height: 58px !important;
    min-height: 58px !important;
    box-sizing: border-box !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 16px !important;
    margin: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid var(--hairline) !important;
    border-radius: 0 !important;
    background: color-mix(in srgb, var(--bg) 94%, transparent) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header h2,
  body.settings-home-mode #settingsHome:not(.scp-settings-section-open) #settingsModal .modal-header h2 {
    width: auto !important;
    max-width: calc(100% - 80px) !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: center !important;
    font-size: 24px !important;
    line-height: 1 !important;
  }

  body.settings-home-mode #settingsHome:not(.scp-settings-section-open) #settingsModal .modal-close {
    display: none !important;
  }

  /* Desktop-style settings shell: navigation first, content below it. */
  body.settings-home-mode #settingsHome .tg-settings-shell {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 12px !important;
    box-sizing: border-box !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 5px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-height: none !important;
    margin: 0 0 14px !important;
    padding: 8px !important;
    box-sizing: border-box !important;
    border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--hairline) 90%) !important;
    border-radius: 20px !important;
    background: color-mix(in srgb, var(--panel2) 92%, transparent) !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav .scp-settings-nav-section {
    margin: 7px 8px 2px !important;
    padding: 0 !important;
    color: var(--muted) !important;
    font-size: 11px !important;
    font-weight: 950 !important;
    letter-spacing: .08em !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button {
    display: grid !important;
    grid-template-columns: 32px minmax(0, 1fr) auto !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    height: auto !important;
    padding: 8px 10px !important;
    border: 0 !important;
    border-radius: 13px !important;
    background: transparent !important;
    box-sizing: border-box !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button:hover,
  body.settings-home-mode #settingsHome .tg-settings-nav > button:focus-visible,
  body.settings-home-mode #settingsHome .tg-settings-nav > button.active {
    background: color-mix(in srgb, var(--accent) 14%, transparent) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button .tg-settings-nav-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    border-radius: 8px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button .tg-settings-nav-icon img {
    width: 19px !important;
    height: 19px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button > span:not(.tg-settings-nav-icon) {
    min-width: 0 !important;
    font-size: 14px !important;
    font-weight: 850 !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button em {
    display: block !important;
    margin-left: 8px !important;
    color: var(--muted) !important;
    font-size: 11px !important;
    font-style: normal !important;
  }

  /* Never hide the real panel area on the main settings screen. */
  body.settings-home-mode #settingsHome #settingsModal .tg-settings-panels {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panel {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panel-head h3 {
    font-size: 22px !important;
  }

  /* Mobile version does not use inline panels anymore. */
  body.settings-home-mode #settingsHome .scp-settings-inline-panel {
    display: none !important;
  }
}


/* ============================================================
   Mobile settings — desktop-like layout with burger navigation
   ============================================================ */
@media (max-width: 768px) {
  body.settings-home-mode #settingsHome #settingsModal .modal-header {
    position: relative !important;
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) 46px !important;
    align-items: center !important;
    gap: 8px !important;
    min-height: 64px !important;
    height: 64px !important;
    padding: 8px 10px !important;
    border-bottom: 1px solid var(--border) !important;
    background: var(--panel) !important;
    backdrop-filter: none !important;
    box-sizing: border-box !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-header h2 {
    grid-column: 2 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    font-size: 22px !important;
    line-height: 1.1 !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.settings-home-mode #settingsHome #settingsCloseBtn {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    display: grid !important;
    place-items: center !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
    border: 1px solid var(--hairline) !important;
    border-radius: 12px !important;
    background: var(--panel2) !important;
    color: var(--text) !important;
    font-size: 32px !important;
    line-height: 1 !important;
    z-index: 30 !important;
  }

  body.settings-home-mode #settingsHome .scp-mobile-settings-burger {
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    display: grid !important;
    place-content: center !important;
    gap: 4px !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 8px !important;
    border: 1px solid var(--hairline) !important;
    border-radius: 12px !important;
    background: var(--panel2) !important;
    color: var(--text) !important;
    z-index: 31 !important;
  }

  body.settings-home-mode #settingsHome .scp-mobile-settings-burger span {
    display: block !important;
    width: 20px !important;
    height: 2px !important;
    border-radius: 2px !important;
    background: currentColor !important;
  }

  body.settings-home-mode #settingsHome #settingsModal .modal-body {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-height: calc(100dvh - 64px) !important;
    height: calc(100dvh - 64px) !important;
    padding: 12px !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-shell {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Hidden until the burger is opened. */
  body.settings-home-mode #settingsHome .tg-settings-nav,
  body.settings-home-mode #settingsHome .tg-settings-nav.settings-scroll-nav {
    position: fixed !important;
    top: 72px !important;
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
    max-height: calc(100dvh - 92px) !important;
    margin: 0 !important;
    padding: 10px !important;
    display: none !important;
    flex-direction: column !important;
    gap: 4px !important;
    overflow-y: auto !important;
    border: 1px solid var(--border) !important;
    border-radius: 18px !important;
    background: color-mix(in srgb, var(--panel) 97%, transparent) !important;
    box-shadow: 0 18px 45px rgba(0,0,0,.42) !important;
    backdrop-filter: blur(18px) !important;
    z-index: 100 !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav.mobile-open {
    display: flex !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav .scp-settings-nav-section {
    display: block !important;
    margin: 8px 8px 3px !important;
    padding: 0 !important;
    color: var(--muted) !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    letter-spacing: .08em !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) auto !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 52px !important;
    height: 52px !important;
    padding: 6px 9px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: var(--text) !important;
    text-align: left !important;
    box-sizing: border-box !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button.active {
    background: color-mix(in srgb, var(--accent) 16%, var(--panel2) 84%) !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button .tg-settings-nav-icon {
    display: grid !important;
    place-items: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-radius: 9px !important;
    background: color-mix(in srgb, var(--accent) 20%, var(--panel2) 80%) !important;
    overflow: hidden !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button .tg-settings-nav-icon::before,
  body.settings-home-mode #settingsHome .tg-settings-nav > button .tg-settings-nav-icon::after {
    content: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button .tg-settings-nav-icon img {
    display: block !important;
    visibility: visible !important;
    width: 19px !important;
    height: 19px !important;
    max-width: 19px !important;
    max-height: 19px !important;
    object-fit: contain !important;
    opacity: 1 !important;
    filter: none !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button > span:not(.tg-settings-nav-icon) {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 850 !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-nav > button em {
    display: block !important;
    margin-left: 6px !important;
    color: var(--muted) !important;
    font-size: 10px !important;
    font-style: normal !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panels {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panel {
    display: none !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panel.active {
    display: grid !important;
    gap: 12px !important;
    animation: settingsPanelIn .18s ease both !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panel-head {
    padding: 4px 4px 8px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panel-head h3 {
    font-size: 22px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-panel-head p {
    font-size: 12px !important;
  }

  body.settings-home-mode #settingsHome .tg-settings-group {
    width: 100% !important;
    border-radius: 16px !important;
  }
}


/* FINAL MOBILE SETTINGS FIX v14
   The old desktop rules hide the panels whenever section-open is false and
   also force the navigation visible in that state. Mobile settings must keep
   the selected panel open while the navigation is controlled only by burger. */
@media (max-width: 768px) {
  body.settings-home-mode #settingsHome.scp-settings-section-open #settingsModal .tg-settings-panels {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-nav,
  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-nav.settings-scroll-nav {
    position: fixed !important;
    top: 72px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-height: calc(100dvh - 92px) !important;
    display: none !important;
    flex-direction: column !important;
    gap: 4px !important;
    margin: 0 !important;
    padding: 10px !important;
    overflow-y: auto !important;
    border: 1px solid var(--border) !important;
    border-radius: 18px !important;
    background: color-mix(in srgb, var(--panel) 97%, transparent) !important;
    box-shadow: 0 18px 45px rgba(0,0,0,.42) !important;
    backdrop-filter: blur(18px) !important;
    z-index: 1000 !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-nav.mobile-open,
  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-nav.settings-scroll-nav.mobile-open {
    display: flex !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-panel {
    display: none !important;
    width: 100% !important;
    min-width: 0 !important;
    visibility: hidden !important;
  }

  body.settings-home-mode #settingsHome.scp-settings-section-open .tg-settings-panel.active {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    gap: 12px !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.settings-home-mode #settingsHome .scp-mobile-settings-burger {
    position: relative !important;
    z-index: 1100 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }

  body.settings-home-mode #settingsHome #settingsCloseBtn {
    position: relative !important;
    z-index: 1100 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }
}

/* ============================================================
   Mobile profile — remove bottom navigation island
   The profile page has its own profile UI and must not show the
   floating bottom tab bar.
   ============================================================ */
@media (max-width: 900px) {
  body.profile-home-mode .scp-mobile-tab-bar,
  body.profile-home-mode #profileHome ~ .scp-mobile-tab-bar,
  body.profile-home-mode #profileHome.scp-profile-peer ~ .scp-mobile-tab-bar {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  body.profile-home-mode #profileHome {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }
}

/* v16: mobile profile navigation back button for own profile */
@media (max-width: 768px) {
  #profileHome.scp-profile-v3.scp-profile-own .scp-profile-v3-back,
  #profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-back {
    display: inline-flex !important;
    position: fixed !important;
    left: max(14px, env(safe-area-inset-left, 0px)) !important;
    top: calc(14px + env(safe-area-inset-top, 0px)) !important;
    z-index: 2600 !important;
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    border: 0.5px solid color-mix(in srgb, var(--border) 58%, var(--accent) 18%) !important;
    border-radius: 50% !important;
    background: color-mix(in srgb, var(--panel) 90%, transparent) !important;
    color: var(--text) !important;
    box-shadow: 0 10px 24px color-mix(in srgb, #000 22%, transparent) !important;
    transform: none !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  #profileHome.scp-profile-v3.scp-profile-own .scp-profile-v3-back img,
  #profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-back img {
    display: block !important;
    width: 22px !important;
    height: 22px !important;
    pointer-events: none !important;
  }

  #profileHome.scp-profile-v3.scp-profile-own .scp-profile-v3-identity.has-wallpaper .scp-profile-v3-back,
  #profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-identity.has-wallpaper .scp-profile-v3-back {
    background: color-mix(in srgb, #000 42%, var(--panel) 58%) !important;
    color: #fff !important;
  }

  #profileHome.scp-profile-v3.scp-profile-own .scp-profile-v3-identity.has-wallpaper .scp-profile-v3-back img,
  #profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-identity.has-wallpaper .scp-profile-v3-back img {
    filter: brightness(0) invert(1) !important;
  }
}

/* v17: position profile back button neatly inside the mobile profile banner */
@media (max-width: 768px) {
  #profileHome.scp-profile-v3.scp-profile-own .scp-profile-v3-identity .scp-profile-v3-back,
  #profileHome.scp-profile-v3.scp-profile-peer .scp-profile-v3-identity .scp-profile-v3-back {
    position: absolute !important;
    left: 16px !important;
    right: auto !important;
    top: auto !important;
    bottom: 16px !important;
    width: 48px !important;
    min-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 20 !important;
  }
}

/* ============================================================
   ScpGram desktop v18 — profile replaces the old brand header
   ============================================================ */
@media (min-width: 769px) {
  /* Remove the old "ScpGram" logo/header from the top of the sidebar. */
  #sidebar > .sidebar-brand {
    display: none !important;
  }

  /* Put the current profile exactly where the old brand block was. */
  #sidebar > .sidebar-account {
    order: -1;
    width: 100%;
    margin: 0;
    padding: 0 10px 18px;
    box-sizing: border-box;
  }

  #sidebar > .sidebar-account .sidebar-account-button {
    min-height: 64px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    gap: 11px;
  }

  #sidebar > .sidebar-account .sidebar-account-button:hover {
    background: rgba(255,255,255,.055);
  }

  /* The large account banner is no longer needed in the sidebar header. */
  #sidebar > .sidebar-account .sidebar-account-banner {
    display: none !important;
  }

  #sidebar > .sidebar-account .sidebar-account-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
  }

  #sidebar > .sidebar-account .sidebar-account-avatar {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 14px;
    overflow: hidden;
  }

  #sidebar > .sidebar-account .sidebar-account-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  #sidebar > .sidebar-account .sidebar-account-copy strong {
    font-size: 15px;
    font-weight: 900;
    color: var(--text);
  }

  #sidebar > .sidebar-account .sidebar-account-copy small {
    font-size: 12px;
    color: var(--muted);
  }

  /* No old three-dot control in the compact profile header. */
  #sidebar > .sidebar-account .sidebar-account-more {
    display: none !important;
  }

  /* Keep the navigation directly below the profile. */
  #sidebar > .sidebar-nav {
    order: 0;
  }

  /* The old create-chat + belonged to the removed brand block. */
  #sidebarCreateChatBtn {
    display: none !important;
  }
}

/* v19: keep the last chat message above the fixed mobile composer */
@media (max-width: 768px) {
  body.mobile-chat-open #messages {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px) + var(--scp-keyboard-offset, 0px)) !important;
    scroll-padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px) + var(--scp-keyboard-offset, 0px)) !important;
  }
}

/* ============================================================
   ScpGram v20 — restore desktop account switcher + create chat
   ============================================================ */
@media (min-width: 769px) {
  /* The profile remains in the old brand position, but its account
     overflow control must stay visible so account switching is reachable. */
  #sidebar > .sidebar-account .sidebar-account-more {
    display: grid !important;
    width: 30px !important;
    height: 40px !important;
    min-width: 30px !important;
    margin-left: auto !important;
    place-items: center !important;
    color: var(--muted) !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    border-radius: 10px !important;
    pointer-events: auto !important;
    z-index: 20 !important;
  }

  #sidebar > .sidebar-account .sidebar-account-more:hover {
    color: var(--text) !important;
    background: color-mix(in srgb, var(--panel) 72%, transparent) !important;
  }

  /* Create chat is now a normal navigation item, not part of the removed brand header. */
  #sidebar .sidebar-nav #sidebarCreateChatBtn {
    display: grid !important;
    grid-template-columns: 28px minmax(0,1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    min-height: 52px !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 13px !important;
    background: transparent !important;
    color: var(--text) !important;
    font: inherit !important;
    font-size: 15px !important;
    font-weight: 850 !important;
    text-align: left !important;
    cursor: pointer !important;
  }

  #sidebar .sidebar-nav #sidebarCreateChatBtn:hover {
    background: color-mix(in srgb, var(--accent) 12%, transparent) !important;
  }

  #sidebar .sidebar-nav #sidebarCreateChatBtn img {
    width: 22px !important;
    height: 22px !important;
    opacity: .92 !important;
    filter: var(--icon-filter, none) !important;
  }

  #sidebar .sidebar-nav #sidebarCreateChatBtn .sidebar-create-chat-label {
    display: block !important;
  }
}

/* ============================================================
   ScpGram v28 — desktop sidebar profile banner + account menu
   + left-aligned create-chat action
   ============================================================ */
@media (min-width: 769px) {
  /* Restore the profile banner in the desktop sidebar. */
  #sidebar > .sidebar-account .sidebar-account-button {
    position: relative !important;
    min-height: 96px !important;
    height: 96px !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    background: var(--panel2) !important;
  }

  #sidebar > .sidebar-account .sidebar-account-banner {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, var(--panel2), var(--panel)) !important;
    z-index: 0 !important;
  }

  #sidebar > .sidebar-account .sidebar-account-banner-image.visible,
  #sidebar > .sidebar-account .sidebar-account-banner-video.visible {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 1 !important;
  }

  #sidebar > .sidebar-account .sidebar-account-banner::after {
    display: block !important;
    content: "" !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    pointer-events: none !important;
    background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.62)) !important;
  }

  #sidebar > .sidebar-account .sidebar-account-row {
    position: relative !important;
    z-index: 4 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 96px !important;
    padding: 10px !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) 30px !important;
    align-items: end !important;
    gap: 10px !important;
  }

  #sidebar > .sidebar-account .sidebar-account-avatar {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    border-radius: 14px !important;
  }

  #sidebar > .sidebar-account .sidebar-account-copy {
    align-self: end !important;
    padding-bottom: 2px !important;
    text-shadow: 0 1px 7px rgba(0,0,0,.55) !important;
  }

  #sidebar > .sidebar-account .sidebar-account-copy strong {
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 800 !important;
  }

  #sidebar > .sidebar-account .sidebar-account-copy small {
    color: rgba(255,255,255,.76) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
  }

  /* Account popup opens below the top profile instead of above the sidebar. */
  #sidebar > .sidebar-account .sidebar-account-menu {
    top: calc(100% + 8px) !important;
    bottom: auto !important;
    left: 0 !important;
    right: auto !important;
    width: min(260px, calc(100vw - 24px)) !important;
    max-height: min(420px, calc(100vh - 40px)) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 10000 !important;
  }

  /* Create-chat is a normal sidebar item: icon left, text immediately after it. */
  #sidebar .sidebar-nav #sidebarCreateChatBtn {
    display: grid !important;
    grid-template-columns: 23px minmax(0, 1fr) !important;
    align-items: center !important;
    justify-content: start !important;
    justify-items: start !important;
    gap: 14px !important;
    width: 100% !important;
    min-height: 47px !important;
    height: 47px !important;
    padding: 0 12px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: transparent !important;
    color: var(--text) !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 650 !important;
    line-height: 1 !important;
    text-align: left !important;
    box-sizing: border-box !important;
  }

  #sidebar .sidebar-nav #sidebarCreateChatBtn:hover {
    background: color-mix(in srgb, var(--text) 5%, transparent) !important;
  }

  #sidebar .sidebar-nav #sidebarCreateChatBtn img {
    width: 23px !important;
    height: 23px !important;
    min-width: 23px !important;
    min-height: 23px !important;
    display: block !important;
    object-fit: contain !important;
    justify-self: start !important;
    filter: brightness(0) invert(1) !important;
    opacity: .9 !important;
  }

  #sidebar .sidebar-nav #sidebarCreateChatBtn .sidebar-create-chat-label {
    display: block !important;
    min-width: 0 !important;
    justify-self: start !important;
    color: var(--text) !important;
    font: inherit !important;
    font-weight: 650 !important;
    text-align: left !important;
    white-space: nowrap !important;
  }
}


/* v24 — Add chat / create group / create channel */
.create-chat-modal-content {
  width: min(620px, calc(100vw - 24px));
}
.create-chat-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.create-chat-modal-body {
  gap: 16px;
}
.create-chat-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.create-chat-action {
  min-height: 76px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel2);
  color: var(--text);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: .16s ease;
}
.create-chat-action:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel2));
}
.create-chat-action-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel2));
  font-size: 20px;
}
.create-chat-action strong,
.create-chat-action small {
  display: block;
}
.create-chat-action strong { font-size: 14px; font-weight: 650; }
.create-chat-action small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.create-chat-users-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.create-chat-users-heading span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.create-chat-user-list {
  max-height: min(390px, 48dvh);
  gap: 6px;
}
.create-chat-user {
  width: 100%;
  min-height: 64px;
  border: 1px solid transparent;
  background: var(--panel2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 14px;
}
.create-chat-user:hover,
.create-chat-user.selected {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, var(--panel2));
}
.create-chat-user-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
.create-chat-user-avatar,
.create-chat-user-fallback {
  position: absolute;
  inset: 0;
  width: 44px;
  height: 44px;
  border-radius: 13px;
}
.create-chat-user-avatar {
  object-fit: cover;
  display: none;
}
.create-chat-user-avatar.visible { display: block; }
.create-chat-user-fallback {
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 25%, var(--panel2));
  color: var(--text);
  font-weight: 700;
}
.create-chat-user-avatar.visible + .create-chat-user-fallback { display: none; }
.create-chat-status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #5f5a54;
  border: 2px solid var(--panel2);
}
.create-chat-status.online { background: #00ef78; }
.create-chat-select {
  display: grid;
  place-items: center;
}
.create-chat-select input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
.create-chat-footer { justify-content: flex-end; }

@media (max-width: 768px) {
  .create-chat-modal-content { width: min(100%, calc(100vw - 16px)); }
  .create-chat-actions { grid-template-columns: 1fr; }
  .create-chat-user-list { max-height: 42dvh; }
}
