/*
 * https://github.com/morethanwords/tweb
 * Copyright (C) 2019-2021 Eduard Kuzmenko
 * https://github.com/morethanwords/tweb/blob/master/LICENSE
 */

$placeholder-color: #9e9e9e;
$border-radius: 8px;
$border-radius-medium: 10px;
$border-radius-big: 12px;
$border-radius-huge: 16px;

$hover-alpha: .08;

//$small-screen: 720px;
$small-screen: 600px;
//$small-screen: 900px;
$medium-screen: 1275px;
$large-screen: 1680px;
//$large-screen: 16800px;

$floating-left-sidebar: 925px;
$messages-container-width: 728px;

$chat-input-size: 3.375rem;
$chat-input-handhelds-size: 2.875rem;
$chat-padding: .8125rem;
$chat-padding-handhelds: .5rem;
$chat-input-inner-padding: .5rem;
$chat-input-inner-padding-handhelds: .25rem;

@function hover-color($color, $alpha: $hover-alpha) {
  @return rgba($color, $alpha);
}

@function rgba-to-rgb($rgba, $background: #fff) {
  @if $background == true {
    $background: #fff;
  }

  @return mix(rgb(red($rgba), green($rgba), blue($rgba)), $background, alpha($rgba) * 100%);
}

@mixin avatar-color($color, $top, $bottom) {
  --peer-avatar-#{$color}-top: #{$top};
  --peer-avatar-#{$color}-bottom: #{$bottom};
}

/* @mixin safari-overflow() {
  html.is-safari & {
    -webkit-mask-image: -webkit-radial-gradient(circle, white 100%, black 100%);
    @content;
  }
} */

@import "mixins/hover";
@import "mixins/respondTo";
@import "mixins/textOverflow";
@import "mixins/animationLevel";
@import "mixins/premium";

:root {
  --vh: 1vh;
  --z-below: -1;
  --hover-alpha: #{$hover-alpha};

  --transition-standard-easing: cubic-bezier(.4, .0, .2, 1);
  --transition-standard-in-time: .3s;
  --transition-standard-out-time: .25s;
  --transition-standard-in: var(--transition-standard-in-time) var(--transition-standard-easing);
  --transition-standard-out: var(--transition-standard-out-time) var(--transition-standard-easing);
  
  --pm-transition: .2s ease-in-out;
  --layer-transition: .2s cubic-bezier(.4, .0, .2, 1);
  --slide-header-transition: .4s ease-in-out;
  --tabs-transition: .2s ease-in-out;
  --btn-menu-transition: .2s cubic-bezier(.4, 0, .2, 1);
  --esg-transition: var(--btn-menu-transition);
  --input-transition: .2s ease-out;
  --sticker-viewer-open-transition-in: .2s var(--transition-standard-easing);
  --sticker-viewer-open-transition-out: .2s var(--transition-standard-easing);
  // --sticker-viewer-switch-transition: .2s cubic-bezier(.07,1.21,.56,1.2);
  --sticker-viewer-switch-transition: .2s cubic-bezier(.12,1.1,.56,1.2);
  --popup-transition-function: cubic-bezier(.4, 0, .2, 1);
  --popup-transition-time: .15s;
  //--layer-transition: .3s cubic-bezier(.33, 1, .68, 1);
  //--layer-transition: none;
  --btn-corner-transition: .2s cubic-bezier(.34, 1.56, .64, 1);
  --chatlist-badge-transition-in: .25s cubic-bezier(.35,.35,.47,1.34); // 1.34
  --chatlist-badge-transition-out: .25s cubic-bezier(.35,.35,.7,1);
  --message-handhelds-margin: 5.5625rem;
  --message-beside-button-size: 2.375rem;
  --message-beside-button-margin: calc((var(--message-beside-button-size) + .5rem) * -1);
  --message-time-background: rgba(0, 0, 0, .35);
  --message-highlightning-color: hsla(85.5319, 36.9171%, 40.402%, .4);//rgba(77, 142, 80, .4);
  --messages-container-width: #{$messages-container-width};
  --messages-text-size: 16px;
  --messages-line-height: 1.3125;
  --messages-secondary-text-size: calc(var(--messages-text-size) - 2px);
  --messages-secondary-line-height: calc(var(--messages-secondary-text-size) + 4px);
  --messages-time-text-size: calc(var(--messages-text-size) - 4px);
  --messages-service-text-size: calc(var(--messages-text-size) - 1px);
  --messages-custom-emoji-size: calc(var(--messages-text-size) + 4px);
  --bubble-transition-in: transform var(--transition-standard-in), opacity var(--transition-standard-in);
  --bubble-transition-out: transform var(--transition-standard-out), opacity var(--transition-standard-out);
  --line-height-20: 26px;
  --line-height-16: 21px;
  --line-height-14: 18px;
  --line-height-12: 16px;
  --line-height: 1.3125;
  --font-size-20: 20px;
  --font-size-16: 16px;
  --font-size-14: 14px;
  --font-size-12: 12px;
  --font-size: var(--font-size-16);
  --esg-sticker-size: 72px;
  --esg-custom-emoji-size: 36px;
  --popup-sticker-size: 80px;
  --disabled-opacity: .3;
  --round-video-size: 280px;
  --menu-box-shadow: 0px 0px 10px var(--menu-box-shadow-color);
  --menu-backdrop-filter: blur(50px);
  --font-monospace: 'Roboto Mono', monospace;
  --font-weight-bold: 500;
  --font-weight-normal: 400;
  --selection-background-color: rgba(var(--primary-color-rgb), .4);
  --selection-color: inherit;

  --topbar-floating-scaleX: 1;
  --topbar-call-height: 3rem;
  --topbar-floating-call-height: 0px;

  --call-button-size: 3.375rem;
  --call-button-margin: 2rem;

  --custom-emoji-size: 1.25rem;

  --esg-width: 100%;

  // https://github.com/overtake/TelegramSwift/blob/5cc7d2475fe4738a6aa0486c23eaf80a89d33b97/submodules/TGUIKit/TGUIKit/PresentationTheme.swift#L2054
  @include avatar-color("red", #FF845E, #D45246);
  @include avatar-color("orange", #FEBB5B, #F68136);
  @include avatar-color("violet", #B694F9, #6C61DF);
  @include avatar-color("green", #9AD164, #46BA43);
  @include avatar-color("cyan", #53edd6, #28c9b7);
  @include avatar-color("blue", #5BCBE3, #359AD4);
  @include avatar-color("pink", #FF8AAC, #D95574);
  // @include avatar-color("saved", #69BFFA, #3D9DE0);
  @include avatar-color("archive", #B8C2CC, #9EAAB5);

  --peer-avatar-saved-top: var(--light-filled-saved-color);
  --peer-avatar-saved-bottom: var(--saved-color);

  --avatar-color-top: var(--peer-avatar-saved-top);
  --avatar-color-bottom: var(--peer-avatar-saved-bottom);
  --avatar-border-radius-forum: 37%;

  --premium-gradient: linear-gradient(52.62deg, #6B93FF 12.22%, #976FFF 50.25%, #E46ACE 98.83%);

  @include respond-to(handhelds) {
    --right-column-width: 100vw;
    --esg-sticker-size: 68px;
    --popup-sticker-size: 68px;
    --round-video-size: 200px;

    --chat-input-size: #{$chat-input-handhelds-size};
    --chat-input-padding: #{$chat-padding-handhelds};
    --chat-input-inner-padding: #{$chat-input-inner-padding-handhelds};
  }

  @include respond-to(not-handhelds) {
    --right-column-width: calc(#{$large-screen} / 4);

    --chat-input-size: #{$chat-input-size};
    --chat-input-padding: #{$chat-padding};
    --chat-input-inner-padding: #{$chat-input-inner-padding};
  }

  @include respond-to(esg-bottom) {
    --chat-input-size: #{$chat-input-handhelds-size};
    --chat-input-inner-padding: #{$chat-input-inner-padding-handhelds};
  }

  @include respond-to(esg-top) {
    --esg-width: 23.875rem;
  }

  @include respond-to(only-medium-screens) {
    --right-column-width: 25vw;
  }
}

@mixin splitColor($property, $color, $light: true, $dark: true, $light-filled: false, $dark-filled: false, $rgb: false, $alpha: $hover-alpha) {
  --#{$property}: #{$color};

  $lightened: hover-color($color);
  @if $light != false {
    --light-#{$property}: #{$lightened};
  }

  @if $light-filled != false {
    --light-filled-#{$property}: #{rgba-to-rgb($lightened, $light-filled)};
  }

  $darkened: darken($color, $alpha * 100);
  @if $dark != false {
    --dark-#{$property}: #{$darkened};
  }

  @if $dark-filled != false {
    --dark-filled-#{$property}: #{rgba-to-rgb($darkened, $dark-filled)};
  }

  @if $rgb != false {
    --#{$property}-rgb: #{red($color)}, #{green($color)}, #{blue($color)};
  }
}

:root {
  // * Day theme
  --body-background-color: #fff;
  --background-color-true: #f4f4f5;
  // --background-color: #fff;
  --background-color: var(--background-color-true);
  --border-color: #dfe1e5;
  --scrollbar-color: rgba(0, 0, 0, .2);
  --section-box-shadow-color: rgba(0, 0, 0, .06);
  --menu-box-shadow-color: rgba(0, 0, 0, .15);

  --input-search-background-color: #fff;
  --input-search-border-color: #dfe1e5;

  --secondary-color: #c4c9cc;

  // --avatar-online-color: #0ac630;
  --avatar-online-color: var(--primary-color);
  // --avatar-color-top: var(--peer-avatar-saved-top);
  // --avatar-color-bottom: var(--peer-avatar-saved-bottom);
  --chatlist-status-color: var(--avatar-online-color);
  --chatlist-pinned-color: #a2abb2;
  --badge-text-color: #fff;
  --link-color: #00488f;
  --ripple-color: rgba(0, 0, 0, #{$hover-alpha});
  --poll-circle-color: var(--border-color);
  --spoiler-background-color: #e3e5e8;
  --spoiler-draft-background-color: #d9d9d9;
  --monospace-text-color: var(--danger-color);
  --backdrop-opacity: .85;
  --menu-background-color: rgba(var(--surface-color-rgb), var(--backdrop-opacity));

  --message-background-color: var(--surface-color);
  --message-time-color: var(--secondary-text-color);
  --message-checkbox-color: #61c642;
  --message-checkbox-border-color: #fff;
  --message-primary-color: var(--primary-color);
  --light-filled-message-primary-color: var(--light-filled-primary-color);
  --message-secondary-color: var(--secondary-color);
  --message-error-color: var(--danger-color);

  --message-out-link-color: var(--link-color);
  --message-out-status-color: var(--message-out-primary-color);
  --message-out-time-color: var(--message-out-status-color);
  --message-out-audio-play-button-color: #fff;
  --message-out-selection-background-color: var(--selection-background-color);

  --gc-background-color: #212121;
  --gc-button-leave-color: rgba(255, 89, 90, .3);
  --gc-button-unmuted-color: rgba(1, 200, 80, .2);
  --gc-button-muted-color: rgba(60, 135, 247, .2);
  --gc-button-hand-color: rgba(223, 68, 184, .2);
  --gc-button-unmuted-fill-color: #195530;
  --gc-button-muted-fill-color: #3C87F7;
  --gc-green-color: #195530;
  --gc-blue-color: #3C87F7;
  --gc-red-color: #643333;

  --gc-primary-text-color: #fff;
  --gc-secondary-text-color: #aaaaaa;
  --gc-green-text-color: #5CC85E;
  --gc-blue-text-color: #3390ec;
  --gc-red-text-color: #ff595a;

  --gc-right-column-width: 26.25rem;

  // * Day theme end
}

.night {
//:root {
  // * Night theme
  --body-background-color: #181818;
  --background-color-true: #181818;
  // --background-color: #212121;
  --background-color: var(--background-color-true);
  --border-color: #0f0f0f;
  --scrollbar-color: rgba(255, 255, 255, .2);
  --section-box-shadow-color: rgba(0, 0, 0, .12);

  --input-search-background-color: #181818;
  --input-search-border-color: #2f2f2f;

  --secondary-color: #707579;

  // --avatar-online-color: #0ac630;
  --avatar-online-color: var(--primary-color);
  // --avatar-color-top: var(--peer-avatar-violet-top);
  // --avatar-color-bottom: var(--peer-avatar-violet-bottom);
  --chatlist-status-color: var(--primary-color);
  --chatlist-pinned-color: var(--secondary-color);
  --badge-text-color: #fff;
  --link-color: var(--primary-color);
  --ripple-color: rgba(255, 255, 255, #{$hover-alpha});
  --poll-circle-color: #fff;
  --spoiler-background-color: #373e4e;
  --spoiler-draft-background-color: #484848;
  --monospace-text-color: var(--primary-text-color);
  --menu-background-color: rgba(var(--surface-color-rgb), .75);

  --message-background-color: var(--surface-color);
  --message-time-color: var(--secondary-text-color);
  --message-checkbox-color: var(--primary-color);
  --message-checkbox-border-color: #fff;
  --message-secondary-color: var(--secondary-color);
  --message-error-color: #fff;

  --message-out-link-color: #fff;
  --message-out-status-color: #fff;
  --message-out-time-color: rgba(255, 255, 255, .6);
  --message-out-audio-play-button-color: var(--message-out-background-color);
  --message-out-selection-background-color: rgba(var(--surface-color-rgb), .4);
  // * Night theme end
}

@import "tgico";
@import "fonts/roboto";
@import "fonts/robotoMono";
@import "partials/input";
@import "partials/button";
@import "partials/animatedIcon";
@import "partials/autocompleteHelper";
@import "partials/autocompletePeerHelper";
@import "partials/badge";
@import "partials/ckin";
@import "partials/checkbox";
@import "partials/chatlist";
@import "partials/chat";
@import "partials/chatTopbar";
@import "partials/chatBubble";
@import "partials/chatPinned";
@import "partials/chatMarkupTooltip";
@import "partials/chatStickersHelper";
@import "partials/chatEmojiHelper";
@import "partials/chatInlineHelper";
@import "partials/chatSearch";
@import "partials/chatDrop";
@import "partials/chatBotCommands";
@import "partials/crop";
@import "partials/sidebar";
@import "partials/profile";
@import "partials/slider";
@import "partials/leftSidebar";
@import "partials/rightSidebar";
@import "partials/mediaViewer";
@import "partials/emojiDropdown";
@import "partials/scrollable";
@import "partials/selector";
@import "partials/gifsMasonry";
@import "partials/preloader";
@import "partials/ripple";
@import "partials/avatar";
@import "partials/document";
@import "partials/audio";
@import "partials/quizHint";
@import "partials/peerTyping";
@import "partials/poll";
@import "partials/transition";
@import "partials/row";
@import "partials/colorPicker";
@import "partials/replyKeyboard";
@import "partials/peopleNearby";
@import "partials/spoiler";
@import "partials/emojiAnimation";
@import "partials/reactions";
@import "partials/reaction";
@import "partials/stackedAvatars";
@import "partials/stickerViewer";
@import "partials/customEmoji";
@import "partials/usernames";
@import "partials/topics";
@import "partials/themes";

@import "partials/popups/popup";
@import "partials/popups/editAvatar";
@import "partials/popups/mediaAttacher";
@import "partials/popups/peer";
@import "partials/popups/stickers";
@import "partials/popups/datePicker";
@import "partials/popups/createPoll";
@import "partials/popups/forward"; 
@import "partials/popups/instanceDeactivated";
@import "partials/popups/joinChatInvite";
@import "partials/popups/reportMessages";
@import "partials/popups/call";
@import "partials/popups/groupCall";
@import "partials/popups/sponsored";
@import "partials/popups/mute";
@import "partials/popups/reactedList";
@import "partials/popups/payment";
@import "partials/popups/paymentCard";
@import "partials/popups/paymentShippingMethods";
@import "partials/popups/paymentVerification";
@import "partials/popups/paymentCardConfirmation";
@import "partials/popups/limit";
@import "partials/popups/giftPremium";

@import "partials/pages/pages";
@import "partials/pages/authCode";
@import "partials/pages/chats";
@import "partials/pages/password";

html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden; // + disable overscroll behavior on macOS
  
  @include respond-to(handhelds) {
    height: calc(var(--vh, 1vh) * 100);
  }

  /* @include respond-to(handhelds) {
    //overflow-y: auto;
    height: 100%;
    min-height: 100%;
    min-width: 100%;
  }

  @include respond-to(not-handhelds) {
    width: 100%;
    height: 100%;
  } */
}

html.is-ios {
  //&, body {
    position: fixed; // fix iOS fullscreen scroll
  //}

  // disable image longtapping
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html.no-backdrop {
  --menu-background-color: var(--surface-color);
  --menu-backdrop-filter: none;
}

@supports(padding: unquote('max(0px)')) {
  html {
    padding: 0 unquote('min(16px, env(safe-area-inset-right))') 0 unquote('min(16px, env(safe-area-inset-left))');
  }
}

html {
  font-size: 16px;
  //overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  //text-rendering: optimizeSpeed;
}

body {
  //touch-action: pan-x pan-y;
  background-color: var(--body-background-color);
  color: var(--primary-text-color);
}



body.deactivated {
  animation: grayscale-in var(--transition-standard-in) forwards;
}

body.deactivated-backwards {
  animation: grayscale-out var(--transition-standard-out) forwards;
}

@keyframes grayscale-in {
  0% {
    filter: grayscale(0);
  }

  100% {
    filter: grayscale(1);
  }
}

@keyframes grayscale-out {
  0% {
    filter: grayscale(1);
  }

  100% {
    filter: grayscale(0);
  }
}

/* body {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 0!important;
} */

a {
  color: var(--link-color);
}

button, input, optgroup, select, textarea, html {
  font-family: "Roboto", -apple-system, apple color emoji, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

input, textarea, button, select, a, div {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

pre, code, kbd, samp {
  font-family: var(--font-monospace);
}

.whole {
  min-height: 100%;
  width: 100%;
  //min-width: 100%;
  margin: 0 auto;
  max-width: $large-screen;

  //@include respond-to(not-handhelds) {
    height: 100%;
  //}
}

@include respond-to(not-handhelds) {
  .only-handhelds {
    display: none !important;
  }
}

.container {
  margin: 0 auto;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
}

h4 {
  font-size: 2rem;
  //margin: 1.5rem 0 1rem 0;
  margin: 22px 0 14px;
  line-height: 110%;

  @include respond-to(handhelds) {
    font-size: 20px;
    margin: 2px 0 8px;
  }
}

input, [contenteditable=true] {
  caret-color: var(--primary-color);
  color: var(--primary-text-color);
  background-color: transparent;
}

// [contenteditable] [style*="bold"] {
//   font-weight: var(--font-weight-bold) !important;
// }

input, textarea {
	-webkit-appearance: none;
}

// Possible fix Safari's password autocomplete
input::-webkit-contacts-auto-fill-button, 
input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  position: absolute;
  right: 0;
}

input:-webkit-autofill::first-line {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Ubuntu, Arial, sans-serif;
  font-size: 16px
}

/* input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  transition: background-color 5000s ease-in-out 0s;
} */

.subtitle {
  /* font-weight: 500; */
  color: var(--secondary-text-color);
  line-height: 1.35;
}

.danger {
  color: var(--danger-color) !important;

  .c-ripple__circle {
    background-color: var(--light-danger-color);
  }
}

.blue,
.primary {
  color: var(--primary-color) !important;

  .c-ripple__circle {
    background-color: var(--light-primary-color);
  }
}

.primary-text {
  color: var(--primary-text-color) !important;
}

.color-premium {
  background: var(--premium-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.blue:before,
.primary:before,
.danger:before {
  color: inherit !important;
}

.bg-warning {
  background: #fed85a !important;
}

.contextmenu {
	position: fixed !important;
	right: auto !important;
  bottom: auto !important;
  width: auto !important;
  z-index: 4 !important;
}

.preloader {
  width: 50px;
  height: 50px;
  
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  // ! do not change it to &-path
  .preloader-path {
    stroke: var(--primary-color);
  }
}

@keyframes thumbnail-fade-in-opacity {
  0% {
    opacity: 0;
  }

  to {
    opacity: .8;
  }
}

@keyframes fade-in-opacity {
  0% {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fade-out-opacity {
  0% {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes fade-in-backwards-opacity {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes fade-out-backwards-opacity {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes fade-in-opacity-fade-out-opacity {
  0% {
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  50% {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: .5rem 1rem;
  background-color: rgba(0, 0, 0, .66);
  color: #fff;
  font-size: 1rem;
  border-radius: $border-radius-medium;
  z-index: 5;
  max-width: unquote('min(30rem, calc(100vw - 2rem))');
  opacity: 0;
  backdrop-filter: blur(25px);

  &.is-visible {
    opacity: 1;
  }

  @include animation-level(2) {
    transition: opacity var(--transition-standard-in);
  }

  b {
    color: inherit;
  }

  a {
    color: #60a5e9!important;
    cursor: pointer;
  }
}

hr {
  width: 100%;
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0;
  padding-bottom: .5rem;
}

b {
  // color: var(--primary-text-color);
  font-weight: var(--font-weight-bold);
}

.avatar-edit {
  position: relative;
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;

  &.is-forum {
    border-radius: var(--avatar-border-radius-forum);
  }

  &-canvas {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(var(--avatar-color-top), var(--avatar-color-bottom));
  }

  html.no-touch body.animation-level-2 & {
    .tgico-cameraadd {
      transform: translateY(-50%) translateX(-50%) scale(1);
      transition: transform .2s ease-in-out;
    }

    &:hover {
      .tgico-cameraadd {
        transform: translateY(-50%) translateX(-50%) scale(1.2);
      }
    }
  }

  .tgico-cameraadd {
    position: absolute;
    font-size: 3rem;
	  line-height: 1;
    width: 3rem;
    height: 3rem;
    top: 50%;
    left: 50%;
    transform: translateY(-50%) translateX(-50%);
    z-index: 2;
    color: #fff;
  }

  .avatar-placeholder {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    filter: brightness(0.7);
  }
}

.missing-icon {
  width: 1.5rem;
  height: 1.5rem;

  &-path {
    fill: currentColor;
  }
}

.select-wrapper {
  max-height: 23.5rem;
  /* height: auto; */
  position: absolute;
  width: 100%;
  top: calc(100% + .5rem);
  left: 0;
  overflow: hidden;
  background-color: var(--surface-color);
  z-index: 3;
  border-radius: $border-radius-medium;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  transition: opacity .2s ease-out, transform .2s ease-out;
  transform: scale(.95);
  transform-origin: top center;
  opacity: 0;

  &.active {
    transform: scale(1);
    opacity: 1;
  }
  
  ul {
    margin: .5rem 0;
  }
  
  li {
    /* display: flex; */
    align-items: center;
    padding: 0 1rem;
    justify-content: space-between;
    height: 3.5rem;
    cursor: pointer;
    /* font-weight: 500; */
    
    text-align: start;
    display: grid;
    grid-template-columns: calc(26px + 2rem) 1fr 80px;
    
    @include hover-background-effect();
  }
  
  // +2 px bc of whitespace
  .emoji {
    height: 26px;
    width: 26px;
    font-size: 26px;
    line-height: 1;
  }

  .scrollable {
    position: relative;
  }
}

.phone-code {
  color: $placeholder-color;
  text-align: end;
}

// this dimensions will be used for monkey business
.auth-image {
  width: 166px;
  height: 166px;
  margin: 0 auto 18px;
  position: relative;
  
  @include respond-to(handhelds) {
    width: 120px;
    height: 120px;
  }
}

/* .phone-wrapper {
  display: flex;
  align-items: ;
} */

.phone-edit {
  width: 1.5rem;
  height: 1.5rem;
  margin-inline-start: .4rem;
  opacity: .5;
  transition: .2s opacity;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  
  @include hover() {
    opacity: 1;
  }
}

span.emoji {
  display: inline !important;
  //line-height: 1em;
  //font-size: 1em;
  
  font-family: apple color emoji,segoe ui emoji,noto color emoji,android emoji,emojisymbols,emojione mozilla,twemoji mozilla,segoe ui symbol;
  vertical-align: unset !important;
  line-height: 1 !important;
  // vertical-align: text-top !important;
}

// non-Retina device
@media
not screen and (-webkit-min-device-pixel-ratio: 2),
not screen and (   min--moz-device-pixel-ratio: 2),
not screen and (     -o-min-device-pixel-ratio: 2/1),
not screen and (        min-device-pixel-ratio: 2),
not screen and (                min-resolution: 192dpi),
not screen and (                min-resolution: 2dppx) {
  html:not(.is-safari) {
    span.emoji {
      margin-inline-end: 5px !important;
    }

    avatar-element span.emoji {
      margin-inline-end: 0 !important;
    }
  }
}

img.emoji {
  width: 18px;
  height: 18px;
  // margin: 0 .125rem;

  display: inline-block;
  /* width: 100%;
  height: 100%; */
  max-width: 100%;
  max-height: 100%;
  vertical-align: middle;
}

[contenteditable=true] {
  user-select: text;
  outline: none;
  cursor: text;
  white-space: pre-wrap;

  .custom-emoji {
    display: inline-block;
    margin-bottom: -2px; // compensate difference in sizes
    // color: transparent;

    &:before {
      content: none;
      // display: inline;
    }
  }

  [style*="markup"] {
    font-family: inherit !important;
  }

  [style*="bold"] {
    font-weight: bold;
  }

  [style*="italic"] {
    font-style: italic;
  }

  [style*="underline"] {
    text-decoration-line: underline;
  }

  [style*="strikethrough"] {
    text-decoration-line: line-through;
  }

  [style*="underline"][style*="strikethrough"] {
    text-decoration-line: underline line-through;
  }

  [style*="monospace"] {
    font-family: var(--font-monospace) !important;
  }

  [style*="spoiler"] {
    background-color: var(--spoiler-draft-background-color);
  }
}

[contenteditable][data-placeholder] {
  &:before {
    content: attr(data-placeholder);
    color: #a2acb4;
    display: block; /* For Firefox By Ariel Flesler */
    pointer-events: none;
    position: absolute;
    opacity: 0;
    
    @include animation-level(2) {
      transform: translateX(1.75rem);
      transition: opacity var(--input-transition) .01s, transform var(--input-transition) .01s;
    }
  }
  
  &:empty:before {
    opacity: 1;
    
    @include animation-level(2) {
      transform: translateX(0);
    }
  }
}

.sticky_sentinel {
  position: absolute;
  left: 0;
  right: 0; /* needs dimensions */
  visibility: hidden;
  pointer-events: none;
}

.super-stickers {
  width: 100%;
	display: grid;
	grid-template-columns: repeat(auto-fill, var(--esg-sticker-size)); // 64px
	// grid-column-gap: 1px;
	justify-content: space-between;
}

.super-sticker {
  @include hover-background-effect() {
    border-radius: $border-radius-medium;
  }
  
  /* &:nth-child(5n+5) {
    margin-inline-end: 0;
  } */
  
  /* > img, > .rlottie {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
  }

  > img {
    object-fit: contain;
    
    @include animation-level(2) {
      animation: fade-in-opacity .2s ease forwards;
    }
  } */
}

.fade-in-transition {
  opacity: 1;

  @include animation-level(2) {
    transition: opacity .2s ease-in-out;
  }
}

/* .fade-in-new {
  opacity: 1;
  transition: opacity .2s ease-in-out;

  &.not-yet {
    opacity: 0;
  }
} */

.show-more {
  padding-top: 13px;
  padding-bottom: 13px;
  cursor: pointer;
  user-select: none;
  position: relative;

  @include respond-to(not-handhelds) {
    padding-inline-start: 8px;
  }

  .tgico-down {
    float: left;
    padding-inline: 1rem 2rem;
    font-size: 24px;
    color: var(--secondary-text-color);
  }
}

// .message .audio .preloader-container {
// 	@include respond-to(handhelds) {
// 		width: 30px;
// 		height: 30px;
// 		left: 2px;
// 	}
// }

.content-empty {
  color: var(--secondary-text-color);
}

::selection,
.selection:after {
  background: var(--selection-background-color);
}

.selection:after {
  content: " ";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.input-something {
  display: inline-block;
}

.input-selectable {
  position: relative;
}

@keyframes grow-icon {
  0% {
    transform: scale(.5);
    opacity: .8;
  }

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

  100% {
    transform: scale(1);
  }
}

@keyframes hide-icon {
  from {
    transform: scale(1);
    opacity: .4;
  }

  to {
    transform: scale(.5);
    opacity: 0;
  }
}

.popup-disable-password, .popup-skip-email {
  .popup-description {
    max-width: 284px;
  }
}

.grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  grid-gap: .25rem;

  &-item {
    height: 0;
    padding-bottom: 100%;
    //overflow: hidden;
    position: relative;
    cursor: pointer;
    user-select: none;
    
    &-media {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}

.animated-super {
  &-row {
    --translateY: 100%;
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    transition: transform var(--pm-transition), opacity var(--pm-transition);

    body.animation-level-0 & {
      transition: none;
    }

    /* &:not(.is-hiding) {
      transform: none !important;
    } */

    &.is-hiding {
      opacity: 0;

      &.from-top {
        transform: translate3d(0, calc(var(--translateY) * -1), 0);
        //transform: translateY(calc(var(--translateY) * -1));
        //transform: translateY(-100%);
      }

      &.from-bottom {
        transform: translate3d(0, var(--translateY), 0);
        //transform: translateY(var(--translateY));
        //transform: translateY(100%);
      }
      
      /* &.backwards {
        opacity: 1;
        transform: translateY(0) !important;
      } */
    }
  }
}

.animated-counter {
  display: inline-flex;

  &-decimal {
    position: relative;

    &-placeholder {
      color: transparent;
    }

    &-wrapper {
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      right: 0;
    }

    /* &:not(:first-child) {
      .animated-super {
        &-row {
          &.is-hiding {
            &.from-top {
              transform: translateY(100%);
            }
      
            &.from-bottom {
              transform: translateY(-100%);
            }
          }
        }
      }
    } */
  }

  /* &.from-top {
    .animated-super-row.is-hiding {
      &.from-top {
        transform: translateY(100%) !important;
      }
    }
  } */
}

// *:not(input):not(textarea) {
//   -webkit-user-select: none; /* disable selection/Copy of UIWebView */
//   -webkit-touch-callout: none; /* disable the IOS popup when long-press on a link */
// }   

middle-ellipsis-element {
  width: 100%;
	overflow: hidden;
	display: block;
}

.album-item {
  &-media {
    width: 100%;
    height: 100%;
  }
}

.hover-effect {
  @include hover-background-effect();
}

.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;

  &__circle {
    transition: stroke-dashoffset;
    stroke-linecap: round;
  }
}

.rlottie, 
.rlottie-vector {
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
}

.rlottie-icon {
  position: relative;
  pointer-events: none;
}

.rlottie.fade-in {
  @include animation-level(2) {
    animation: fade-in-opacity .2s ease-in-out forwards;
  }
}

.rlottie-vector {
  fill: rgba(0, 0, 0, $hover-alpha);
}

.canvas-thumbnail {
  position: absolute;
  width: 100%;
  height: 100%;
}

// .shimmer {
//   &-canvas {
//     position: absolute;
//     width: 100%;
//     height: 100%;
//   }
// }

.media-container-contain {
  position: relative;

  .media-photo {
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
  }
}

.media-container-cover {
  position: relative;

  .media-photo {
    object-fit: cover;
    width: 100%;
    height: 100%;
  }
}

.media-photo, 
.media-video, 
.media-sticker, 
.media-round, 
.media-poster {
  @include animation-level(2) {
    &.fade-in {
      animation: fade-in-opacity .2s ease-in-out forwards;
    }
  
    &.fade-out {
      animation: fade-out-opacity .2s ease-in-out forwards;
    }
  }

  // & ~ & {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  // }
}

.media-video {
  z-index: 1; // * overflow media-photo
}

.media-sticker {
  margin: auto;
  object-fit: contain;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;

  &-wrapper {
    &.is-premium-sticker {
      &:before {
        // content: " ";
        position: absolute;
        bottom: .125rem;
        left: 50%;
        transform: translateX(-50%);
        width: 1.25rem;
        height: 1.25rem;
        background: rgba(0, 0, 0, .2);
        // backdrop-filter: blur(25px) saturate(1.5);
        border-radius: 50%;
        color: #fff;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        background-image: var(--lock-url);
        background-repeat: no-repeat;
        background-size: cover;
      }

      @include premium(true) {
        &:before,
        &:after {
          content: none;
        }
      }
    }
  }
}

.media-round {
  max-width: var(--round-video-size);
  max-height: var(--round-video-size);
  z-index: 1;

  canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
  }

  .video-time {
    padding: 0 .375rem;
    background-color: var(--message-highlightning-color) !important;

    &:before,
    &:after {
      margin-inline-start: .25rem;
    }
  }

  &.is-unread .video-time {
    &:before {
      order: 1;
      width: .5rem;
      height: .5rem;
      background-color: #fff;
      border-radius: 50%;
      content: " ";
    }
  }

  &.is-paused .video-time {
    &:after {
      content: $tgico-nosound;
      display: flex;
      align-items: center;
      font-size: 1.125rem;
      order: 2;
    }
  }
}

.gradient-delimiter {
  width: 100%;
  height: .75rem;
  background-color: var(--background-color-true);
  position: relative;

  &:before {
    content: " ";
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, .06) 0%, rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0) 94%, rgba(0, 0, 0, .06) 100%);
  }
}

.sidebar-left {
  &-section {
    background-color: var(--surface-color);
    padding: .5rem 0 !important;
    margin-bottom: .75rem;
    box-shadow: 0px 1px 3px 0px var(--section-box-shadow-color);

    &.no-shadow {
      box-shadow: none !important;
    }

    &-name {
      padding: .5rem 1rem;
    }

    &-caption {
      margin: -0.1875rem 0 1rem;
      font-size: var(--font-size-14);
      line-height: var(--line-height-14);
      padding: 0 1.5rem;

      &:first-child {
        margin-top: .8125rem;
        margin-bottom: .8125rem;
      }

      @include respond-to(handhelds) {
        padding: 0 1rem;
      }
    }

    &-container {
      user-select: none;

      a {
        cursor: pointer;
      }
    }
  }
}

hr {
  display: none !important;
}

// ! TEMPORARY
// .tgico-reply:before, 
// .tgico-attach:before,
// .tgico-saved:before,
// .tgico-phone:before,
.tgico-admin:before,
// .tgico-message:before,
.tgico-fontsize:before
// .tgico-forward:before,
// .tgico-reply_filled:before,
// .tgico-forward_filled:before {
{
  font-size: 20px !important;
  padding: 2px;
}

// ! TEMPORARY
.tgico-endcall_filled,
.tgico-phone_filled {
  font-size: 26px !important;
}

.stealthy {
  left: 0;
  margin: 0;
  max-height: 1px;
  max-width: 1px;
  opacity: 0;
  outline: none;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  top: 0;
  z-index: -1;
}

.navigable-list {
  .active {
    background-color: var(--light-secondary-text-color);
    border-radius: inherit;
  }
}

.super-emojis {
  --esg-emoji-size: 2.125rem;
  --esg-emoji-total-size: calc(var(--esg-emoji-size) + .5rem);
  --custom-emoji-size: var(--esg-emoji-size);
  // ! No chrome 56 support
  display: grid;
  column-gap: 2.44px;
  // row-gap: .25rem;
  grid-template-columns: repeat(auto-fill, var(--esg-emoji-total-size));
  justify-content: space-between;
  position: relative;

  font-size: var(--esg-emoji-size);
  line-height: var(--esg-emoji-size);

  // * new
  // --esg-emoji-size: 2.25rem;
  // --esg-emoji-total-size: var(--esg-emoji-size);
  // --custom-emoji-size: var(--esg-emoji-size);
  // column-gap: .625rem;
  
  // --esg-emoji-size: 1.875rem;
  // --esg-emoji-total-size: calc(var(--esg-emoji-size) + 0.375rem);
  // --custom-emoji-size: 2.25rem;
  
  column-gap: .25rem;
  --esg-emoji-size: 2.125rem;
  --esg-emoji-total-size: 2.625rem;
  --custom-emoji-size: 2.25rem;

  .super-emoji {
    display: inline-block;
    margin-inline: .0625rem;
    padding: .25rem;
    line-height: inherit;
    border-radius: $border-radius;
    cursor: pointer;
    user-select: none;
    vertical-align: middle;

    width: var(--esg-emoji-total-size);
    height: var(--esg-emoji-total-size);

    // html:not(.emoji-supported) & {
      position: relative;
    // }

    .emoji-placeholder {
      position: absolute;
      left: 7px;
      top: 7px;
      width: 1.75rem;
      height: 1.75rem;
      border-radius: 50%;
      background-color: var(--light-secondary-text-color);
      pointer-events: none;

      @include animation-level(2) {
        opacity: 0;
        transition: opacity .2s ease-in-out;
      }
    }

    @include animation-level(2) {
      img {
        opacity: 1;
        transition: opacity .2s ease-in-out;
      }
    }
    
    .emoji {
      width: 100%;
      height: 100%;
      vertical-align: unset;
      margin: 0;
    }

    &.active {
      background-color: var(--light-secondary-text-color);
    }

    @include hover-background-effect();
  }

  &.not-local {
    .super-emoji {
      padding: .1875rem;
    }
  }

  .super-emoji {
    margin: 0;
    // border-radius: unset;

    // @include hover-effect() {
    //   &:before {
    //     content: " ";
    //     border-radius: $border-radius;
    //     background-color: var(--light-secondary-text-color);
    //     position: absolute;
    //     top: -.1875rem;
    //     right: -.1875rem;
    //     bottom: -.1875rem;
    //     left: -.1875rem;
    //   }
    // }
  }

  &:not(.not-local) {
    .super-emoji {
      overflow: hidden;

      html.native-emoji & {
        padding-top: .3125rem;
        padding-bottom: .3125rem;
      }
    }
  }

  .custom-emoji {
    display: block;

    &-renderer {
      z-index: 1;
    }

    &:before {
      content: none;
    }
  }
}

.tgico-char {
  &:before {
    font-family: "Roboto" !important;
    font-weight: var(--font-weight-bold);
    width: 1.5rem;
    text-align: center;
  }

  &.z:before {
    content: "Z";
  }

  &.w:before {
    content: "W";
  }
}

.sending-status {
  &:empty {
    display: none;
  }

  /* &.animating {
    .sending-status-icon {
      background: var(--background);
    }
  } */

  .tgico-sendingerror {
    color: var(--danger-color);
  }

  &-icon {
    position: absolute;
    line-height: 1 !important;
  }
}

.quick-reaction-title {
  display: flex;
  align-items: center;
}

.quick-reaction-sticker {
  width: 32px !important;
  height: 32px !important;
  position: relative !important;
  margin: 0 .5rem 0 0 !important;
}

.verified-icon {
  &-svg {
    width: 1rem;
    height: 1rem;
  }

  &-check {
    fill: #fff;
  }
  
  &-background {
    fill: var(--primary-color);
  }
}

.verified-icon,
.premium-icon,
.emoji-status {
  flex: 0 0 auto;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-inline-start: .125rem;
  width: 1.25rem;
  height: 1.25rem;
}

.emoji-status {
  position: relative;
  width: 1.125rem;
  height: 1.125rem;
  margin-inline-start: .25rem;
}

.premium-icon {
  color: var(--primary-color);
  margin-top: -.0625rem;
}

.badge-fake {
  flex: 0 0 auto;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
  padding: .125rem .25rem;
  border-radius: .185rem;
  font-size: .625rem;
  font-weight: var(--font-weight-bold);
  line-height: 1 !important;
  margin-inline: .25rem .25rem;
}

.peer-title {
  &.with-icons {
    display: flex;
    align-items: center;
    overflow: hidden;
  }

  &-inner {
    @include text-overflow();
  }
}

.limit-line {
  height: 2rem;
  // border-radius: $border-radius-medium;
  font-weight: var(--font-weight-bold);
  display: flex;
  // background: linear-gradient(84.4deg, #6C93FF -4.85%, #976FFF 51.72%, #DF69D1 110.7%), #F1F3F5;

  &-free {
    color: #000;
  }

  &-premium {
    color: #fff;
  }

  &-free {
    border-top-left-radius: $border-radius-medium;
    border-bottom-left-radius: $border-radius-medium;
    background-color: #F1F3F5;
  }

  &-premium {
    border-top-right-radius: $border-radius-medium;
    border-bottom-right-radius: $border-radius-medium;
    background: linear-gradient(84.4deg, #6C93FF -4.85%, #976FFF 51.72%, #DF69D1 110.7%);
  }

  &-free,
  &-premium {
    flex: 1 1 0;
    padding: 0 .75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

.movable-element {
  --size: .5rem;
  position: relative;

  &-resize-handler {
    position: absolute;

    &-side-n,
    &-side-s {
      left: 0;
      right: 0;
      height: var(--size);
      cursor: row-resize;
    }

    &-side-e,
    &-side-w {
      top: 0;
      bottom: 0;
      width: var(--size);
      cursor: col-resize;
    }

    &-side-n {
      top: 0;
    }

    &-side-e {
      right: 0;
    }

    &-side-s {
      bottom: 0;
    }

    &-side-w {
      left: 0;
    }

    // corners
    &-side-nw,
    &-side-ne,
    &-side-sw,
    &-side-se {
      width: var(--size);
      height: var(--size);
      z-index: 1;
    }

    &-side-ne,
    &-side-sw {
      cursor: nesw-resize;
    }
    
    &-side-se,
    &-side-nw {
      cursor: nwse-resize;
    }

    &-side-ne {
      top: 0;
      right: 0;
    }

    &-side-se {
      right: 0;
      bottom: 0;
    }

    &-side-sw {
      bottom: 0;
      left: 0;
    }

    &-side-nw {
      top: 0;
      left: 0;
    }
  }
}

.chatlist-chat {
  &.row-with-padding {
    padding-inline-start: 4.5rem !important;
  }

  span {
    @include text-overflow(true);
  }

  .row {
    &-title {
      font-size: var(--font-size-16) !important;
      line-height: 1.375rem;

      &-right-secondary {
        margin-top: -.4375rem;
        font-size: var(--font-size-12) !important;
        line-height: var(--line-height-12) !important;
      }

      // .peer-title {
      //   font-weight: var(--font-weight-bold);
      // }
    }

    &-subtitle {
      display: block !important; // can drop to none if it's empty
    }

    &-row {
      height: 1.375rem;
    }
  }

  &.chatlist-chat-small {
    
  }

  &.chatlist-chat-abitbigger {
    .row {
      &-subtitle {
        margin-top: 0;
      }
    }
  }

  &.chatlist-chat-bigger {
    .row {
      &-subtitle {
        margin-top: 0;
        font-size: var(--font-size-16) !important;
        line-height: 1.375rem;

        &-row {
          margin-top: .125rem;
        }
      }

      &-title {
        .peer-title {
          font-weight: var(--font-weight-bold);
        }
      }
    }
  }
}

.username-purchase-help {
  b {
    font-weight: var(--font-weight-normal) !important;
    color: var(--danger-color) !important;
  }
}

.media-spoiler {
  &-container {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    border-radius: inherit;

    &.is-revealing {
      opacity: 1;

      &:not(.backwards) {
        opacity: 0;
      }

      &.animating {
        transition: opacity var(--transition-standard-out);
      }
    }
  }

  &-thumbnail,
  .canvas-thumbnail {
    position: absolute;
    // top: 0;
    // right: 0;
    // bottom: 0;
    // left: 0;
    object-fit: unset !important;
    width: 100%;
    height: 100%;
  }
}

.accordion {
  overflow: hidden;
  height: 0;

  &.is-expanded {
    height: var(--max-height);
  }

  @include animation-level(2) {
    transition: height var(--transition-standard-in);
  }

  &-icon {
    transform: rotate(0deg) translateY(4px);
    color: var(--secondary-text-color);
    font-size: 1.25rem;
    display: inline-block;
    line-height: 0;

    @include animation-level(2) {
      transition: transform var(--transition-standard-in);
    }
  }

  &-toggler-expanded {
    .accordion-icon {
      transform: translateY(4px) rotate(180deg);
    }
  }
}
