:root {
  --scrollbar-thumb: rgba(95, 99, 104, 0.52);
  --scrollbar-thumb-hover: rgba(60, 64, 68, 0.78);
  --scrollbar-track: transparent;
}

html {
  color-scheme: light;
}

html.dark,
.dark {
  --scrollbar-thumb: rgba(154, 160, 166, 0.48);
  --scrollbar-thumb-hover: rgba(189, 193, 198, 0.68);
  --scrollbar-track: transparent;
  color-scheme: dark;
}

/* Custom scrollbars: pill thumb only, fully transparent track (no box/border). */
.scrollbar-hide,
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

/* Firefox — do not set scrollbar-width on WebKit browsers (overrides ::-webkit-scrollbar). */
@supports (-moz-appearance: none) {
  .scrollbars,
  .message-scrollbar,
  .custom-scrollbar,
  :not(.scrollbar-hide):not(.no-scrollbar) {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
  }
}

/* Chrome, Safari, Edge — literal colors in pseudos (Safari ignores var() here). */
.scrollbars::-webkit-scrollbar,
.message-scrollbar::-webkit-scrollbar,
.custom-scrollbar::-webkit-scrollbar,
:not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: transparent;
  background-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.scrollbars::-webkit-scrollbar-track,
.message-scrollbar::-webkit-scrollbar-track,
.custom-scrollbar::-webkit-scrollbar-track,
:not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-track,
.scrollbars::-webkit-scrollbar-track-piece,
.message-scrollbar::-webkit-scrollbar-track-piece,
.custom-scrollbar::-webkit-scrollbar-track-piece,
:not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-track-piece {
  background: transparent;
  background-color: transparent;
  border: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.scrollbars::-webkit-scrollbar-thumb,
.message-scrollbar::-webkit-scrollbar-thumb,
.custom-scrollbar::-webkit-scrollbar-thumb,
:not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-thumb {
  border-radius: 9999px;
  border: 2px solid transparent;
  background-color: rgba(95, 99, 104, 0.52);
  background-clip: padding-box;
  min-height: 28px;
  min-width: 28px;
  -webkit-appearance: none;
  appearance: none;
}

.scrollbars::-webkit-scrollbar-thumb:hover,
.message-scrollbar::-webkit-scrollbar-thumb:hover,
.custom-scrollbar::-webkit-scrollbar-thumb:hover,
:not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-thumb:hover {
  background-color: rgba(60, 64, 68, 0.78);
}

html.dark .scrollbars::-webkit-scrollbar-thumb,
html.dark .message-scrollbar::-webkit-scrollbar-thumb,
html.dark .custom-scrollbar::-webkit-scrollbar-thumb,
html.dark :not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-thumb,
.dark .scrollbars::-webkit-scrollbar-thumb,
.dark .message-scrollbar::-webkit-scrollbar-thumb,
.dark .custom-scrollbar::-webkit-scrollbar-thumb,
.dark :not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-thumb {
  background-color: rgba(154, 160, 166, 0.48);
}

html.dark .scrollbars::-webkit-scrollbar-thumb:hover,
html.dark .message-scrollbar::-webkit-scrollbar-thumb:hover,
html.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover,
html.dark :not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-thumb:hover,
.dark .scrollbars::-webkit-scrollbar-thumb:hover,
.dark .message-scrollbar::-webkit-scrollbar-thumb:hover,
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover,
.dark :not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-thumb:hover {
  background-color: rgba(189, 193, 198, 0.68);
}

.scrollbars::-webkit-scrollbar-corner,
.message-scrollbar::-webkit-scrollbar-corner,
.custom-scrollbar::-webkit-scrollbar-corner,
:not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-corner {
  background: transparent;
  background-color: transparent;
}

.scrollbars::-webkit-scrollbar-button,
.message-scrollbar::-webkit-scrollbar-button,
.custom-scrollbar::-webkit-scrollbar-button,
:not(.scrollbar-hide):not(.no-scrollbar)::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
  border: none;
  -webkit-appearance: none;
  appearance: none;
}

/* Profile photos: white circle backing in light and dark mode */
.profile-avatar-circle {
  background-color: #ffffff !important;
  overflow: hidden;
}

img.profile-avatar-img {
  background-color: #ffffff !important;
}
