:root {
  --border-color: #4f5352;
  --rick-skin-color: #ebe6e3;
  --morty-skin-color: #f1daca;
  --rick-hair-color: #bdcccf;
  --morty-hair-color: #a68564;
  --rick-spittle-color: #8bffc5;
  --rick-shirt-color: #d2eaea;
  --morty-shirt-color: #fffac0;
  --rick-hair-shape: polygon(15% 20%, 37% 32%, 49% 0%, 62% 32%, 83% 20%, 74% 43%, 89% 49%, 77% 62%, 88% 71%, 75% 77%, 82% 85%, 73% 84%, 73% 96%, 50% 86%, 25% 96%, 26% 84%, 17% 84%, 24% 77%, 10% 71%, 22% 62%, 9% 49%, 25% 42%);
  --custom-filter:
    drop-shadow(0 4px 0 var(--border-color))
    drop-shadow(4px 0 0 var(--border-color))
    drop-shadow(0 -4px 0 var(--border-color))
    drop-shadow(-4px 0 0 var(--border-color));
  --custom-filter-small:
    drop-shadow(0 2px 0 var(--border-color))
    drop-shadow(2px 0 0 var(--border-color))
    drop-shadow(0 -2px 0 var(--border-color))
    drop-shadow(-2px 0 0 var(--border-color));
}

.container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
}

.rick-container {
  width: 300px;

  & .head-container {
    width: 100%;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
    z-index: 2;

    & .head {
      width: 38%;
      height: 60%;
      border: 4px solid var(--border-color);
      background: var(--rick-skin-color);
      border-radius: 80px;
      position: relative;
      z-index: 2;
      transform: translate(-2px, -15px);
      display: flex;
      justify-content: center;

      & .brow-container {
        width: 90%;
        height: 25%;
        transform: translate(0, 8px);
        display: flex;
        align-items: flex-end;
        position: relative;
        z-index: 1;

        & .brow {
          width: 90%;
          height: 20%;
          background: var(--rick-hair-color);
          border-radius: 25px;
          border: 4px solid var(--border-color);
          display: flex;
          flex-direction: column;
          align-items: center;

          &::before,
          &::after {
            position: absolute;
            content: "";
            display: block;
            width: 80%;
            height: 4px;
            border-radius: 50px;
            background: var(--border-color);
          }

          &::before {
            width: 30%;
            transform: translate(0, -20px);
          }

          &::after {
            width: 65%;
            transform: translate(0, -12px);
          }
        }
      }

      & .eyes-container {
        position: absolute;
        width: 100%;
        height: 50px;
        transform: translate(0, 42px);
        display: flex;
        justify-content: space-around;

        & .eye {
          width: 40px;
          height: 40px;
          border: 4px solid var(--border-color);
          border-radius: 50%;
          overflow: hidden;
          background: #fff;

          &::before {
            content: "";
            display: block;
            width: 100%;
            height: 50%;
            background: var(--rick-skin-color);
            border-bottom: 4px solid var(--border-color);
            position: relative;
            z-index: 4;
            animation: closeEyes 2s linear infinite alternate;
          }

          & .pupil {
            content: "";
            display: block;
            width: 5px;
            height: 12px;
            border-radius: 50%;
            background: var(--border-color);
            transform: translate(18px, -4px) rotate(25deg);
            position: relative;
            z-index: 1;

            &::before,
            &::after {
              content: "";
              display: block;
              width: 12px;
              height: 4px;
              position: absolute;
              border-radius: inherit;
              background: inherit;
              transform: translate(-3px, 3px) rotate(-30deg);
            }

            &::after {
              transform: translate(-3px, 3px) rotate(30deg);
            }
          }
        }
      }

      & .eyebags-container {
        position: absolute;
        width: 100%;
        height: 50px;
        transform: translate(0, 51px);
        display: flex;
        justify-content: space-around;

        & .eyebag {
          width: 40px;
          height: 40px;
          border-radius: 50%;
          border: 3px solid var(--border-color);
          clip-path: polygon(0 80%, 100% 80%, 100% 100%, 0 100%);
        }
      }

      & .nose {
        position: absolute;
        border: 3px solid var(--border-color);
        width: 11px;
        height: 20px;
        border-top: 0;
        border-radius: 0 0 25px 25px;
        transform: translate(0, 90px);
      }

      & .mouth-container {
        position: absolute;
        width: 100%;
        height: 40px;
        transform: translate(0, 120px);
        display: flex;
        justify-content: center;

        & .mouth {
          border-top: 3px solid var(--border-color);
          border-radius: 15px / 8px;
          width: 60%;
          position: relative;
          z-index: 2;

          &::before,
          &::after {
            position: absolute;
            content: "";
            display: block;
            border-bottom: 4px solid var(--border-color);
            width: 15px;
            height: 10px;
            border-radius: 50%;
          }

          &::before {
            transform: translate(-10px, -2px) rotate(85deg);
          }

          &::after {
            transform: translate(64px, -2px) rotate(-85deg);
          }
        }

        & .spittle {
          position: absolute;
          z-index: 0;
          width: 30%;
          height: 15%;
          border-radius: 0 0 25px 25px;
          background: var(--rick-spittle-color);
          transform: translate(0, 2px);
          filter: var(--custom-filter-small);

          &::after,
          &::before {
            position: absolute;
            content: "";
            display: block;
            background: inherit;
            width: 10px;
            height: 24px;
            border-radius: inherit;
          }

          &::before {
            transform: translate(2px, 0);
            width: 26px;
            height: 10px;
          }

          &::after {
            transform: translate(14px, 0);
          }
        }

        & .spittle-arcs {
          position: absolute;
          width: 40px;
          height: 40px;

          &::before,
          &::after {
            position: absolute;
            content: "";
            display: block;
            background: var(--rick-spittle-color);
            width: 4px;
            height: 4px;
            z-index: 5;
            border: 3px solid var(--border-color);
            border-radius: 40%;
          }

          &::before {
            height: 8px;
            transform: translate(-2px, 20px) rotate(-45deg);
          }

          &::after {
            transform: translate(40px, 20px);
          }
        }
      }
    }

    & .ear-container {
      position: absolute;
      z-index: 1;
      display: flex;
      justify-content: space-between;
      width: 150px;
      height: 30px;
      transform: translate(-2px, -100px);

      & .ear {
        width: 20px;
        height: 30px;
        background: var(--rick-skin-color);
        border: 4px solid var(--border-color);
        border-radius: 25px;
      }
    }

    & .hair-container {
      position: absolute;
      width: 100%;
      height: 100%;
      filter: var(--custom-filter);

      & .hair {
        width: 100%;
        height: 90%;
        background: var(--rick-hair-color);
        clip-path: var(--rick-hair-shape);
      }
    }

    & .neck {
      position: absolute;
      width: 40px;
      height: 25px;
      border: 4px solid var(--border-color);
      border-radius: 0 0 15px 15px / 0 0 8px 8px;
      background: var(--rick-skin-color);
    }
  }

  & .body-container {
    width: 100%;
    height: 150px;
    transform: translate(0, -12px);
    display: flex;
    justify-content: center;
    filter: var(--custom-filter);

    & .body {
      width: 100%;
      height: 100%;
      background: #fff;
      clip-path: polygon(20% 100%, 25% 25%, 50% 0, 75% 25%, 80% 100%);
      display: flex;
      justify-content: center;

      &::before,
      &::after {
        content: "";
        display: block;
        position: absolute;
        border-left: 4px solid var(--border-color);
        width: 5px;
        height: 80px;
      }

      &::after {
        transform: translate(-50px, 72px) rotate(4deg);
      }

      &::before {
        transform: translate(55px, 72px) rotate(-4deg);
      }

      & .shirt {
        width: 20%;
        height: 100%;
        background: var(--rick-shirt-color);
        border: 4px solid var(--border-color);
        border-radius: 30px 30px 0 0;
        border-top: 0;
        border-bottom: 0;
      }

      & .flaps-container {
        width: 200%;
        height: 100%;
        display: flex;
        justify-content: space-around;
        filter: var(--custom-filter);
        position: relative;
        z-index: 5;

        & .flap {
          background: #fff;
          width: 35px;
          height: 100%;
          transform: translate(-38px, 0);
          clip-path: polygon(0 65%, 100% 0, 100% 100%, 5% 100%, 0 90%, 85% 80%);

          &.right {
            transform: translate(-22px, 0) scale(-1, 1);
          }
        }
      }
    }
  }
}

.morty-container {
  width: 300px;
  height: 250px;
  transform: translateX(-100px);

  & .head-container {
    width: 100%;
    height: 175px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
    z-index: 2;

    & .head {
      width: 45%;
      height: 75%;
      border: 4px solid var(--border-color);
      background: var(--morty-skin-color);
      border-radius: 80px;
      position: relative;
      z-index: 2;
      transform: translate(-2px, -15px);
      display: flex;
      justify-content: center;

      & .brows-container {
        position: absolute;
        width: 100%;
        height: 20px;
        display: flex;
        justify-content: space-around;

        & .brow {
          width: 40px;
          height: 35px;
          border: 4px solid var(--border-color);
          border-radius: 30%;
          border-left: 0;
          border-bottom: 0;
          border-right: 0;
          transform: translate(0, 25px);

          &.left {
            border-top-right-radius: 0;
          }

          &.right {
            border-top-left-radius: 0;
          }
        }
      }

      & .eyes-container {
        position: absolute;
        width: 92%;
        height: 50px;
        transform: translate(0, 32px);
        display: flex;
        justify-content: space-around;

        & .eye {
          width: 45px;
          height: 45px;
          border: 4px solid var(--border-color);
          border-radius: 50%;
          overflow: hidden;
          background: #fff;
          clip-path: polygon(0 16%, 100% 16%, 100% 100%, 0 100%);

          &::before {
            content: "";
            display: block;
            width: 100%;
            height: 50%;
            background: var(--morty-skin-color);
            border-bottom: 4px solid var(--border-color);
            position: relative;
            z-index: 4;
            animation: closeEyes 2s linear infinite alternate;
          }

          & .pupil {
            content: "";
            display: block;
            width: 5px;
            height: 12px;
            border-radius: 50%;
            background: var(--border-color);
            transform: translate(18px, -4px) rotate(25deg);
            position: relative;
            z-index: 1;

            &::before,
            &::after {
              content: "";
              display: block;
              width: 12px;
              height: 4px;
              position: absolute;
              border-radius: inherit;
              background: inherit;
              transform: translate(-3px, 3px) rotate(-30deg);
            }

            &::after {
              transform: translate(-3px, 3px) rotate(30deg);
            }
          }
        }
      }

      & .nose {
        position: absolute;
        border: 4px solid var(--border-color);
        width: 8px;
        height: 12px;
        border-top: 0;
        border-radius: 0 0 25px 25px;
        transform: translate(5px, 80px) rotate(-45deg);
      }

      & .mouth-container {
        position: absolute;
        border-left: 4px solid var(--border-color);
        width: 6px;
        height: 12px;
        transform: translate(-5px, 105px);

        & .mouth::before,
        & .mouth::after {
          position: absolute;
          content: "";
          display: block;
          border: 4px solid var(--border-color);
          width: 6px;
          height: 12px;
          border-top: 0;
          border-radius: 0 0 25px 25px;
          transform: translate(-4px, 4px);
        }

        & .mouth::after {
          width: 6px;
          height: 12px;
          border-left: 0;
          transform: translate(8px, -4px);
        }
      }
    }

    & .ear-container {
      position: absolute;
      z-index: 1;
      display: flex;
      justify-content: space-between;
      width: 170px;
      height: 30px;
      transform: translate(-2px, -60px);

      & .ear {
        width: 20px;
        height: 20px;
        background: var(--morty-skin-color);
        border: 6px solid var(--border-color);
        border-radius: 50px;
      }
    }

    & .hair-container {
      position: absolute;
      width: 50%;
      height: 80%;
      border: 6px solid var(--border-color);
      background: var(--morty-hair-color);
      transform: translate(-3px, -30px);
      border-radius: 42% 50% / 45% 50%;
    }
  }

  & .body-container {
    width: 300px;
    height: 100px;
    transform: translate(0, -12px);
    display: flex;
    justify-content: center;
    filter: var(--custom-filter);

    & .body {
      width: 55%;
      height: 200%;
      background: var(--morty-shirt-color);
      border-radius: 50% 50% 0 0;
      overflow: hidden;
      clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
      display: flex;
      justify-content: center;
      position: absolute;
      transform: translate(0, -25px);

      &::before,
      &::after {
        content: "";
        display: block;
        position: absolute;
        border-left: 4px solid var(--border-color);
        width: 5px;
        height: 80px;
      }

      &::after {
        transform: translate(-50px, 72px) rotate(4deg);
      }

      &::before {
        transform: translate(55px, 72px) rotate(-4deg);
      }
    }
  }
}

@keyframes closeEyes {
  0%,
  85% { height: 50%; }

  100% { height: 100%; }
}

.body-personajes {
  padding-bottom: 0;
  overflow: hidden;
}

.personajes-animados {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 260px;
  pointer-events: none;
  z-index: 5;
}

.personajes-animados .rick-container {
  position: fixed;
  left: 12px;
  bottom: -18px;
  transform: scale(0.43);
  transform-origin: bottom left;
}

.personajes-animados .morty-container {
  position: fixed;
  right: 12px;
  bottom: 0;
  transform: scale(0.53);
  transform-origin: bottom right;
}

.animacion-info {
  width: min(720px, calc(100% - 40px));
  margin: -6px auto 18px;
  padding: 0 18px;
  text-align: center;
}

.animacion-info strong,
.animacion-info span {
  display: block;
}

.animacion-info strong {
  color: #c8ff72;
  margin-bottom: 3px;
  font-size: 1.4rem;
  text-shadow: 0 0 12px rgba(123, 220, 57, 0.45);
}

.animacion-info span {
  color: #cbd5e1;
  font-size: 1rem;
}

@media (max-width: 900px) {
  .body-personajes {
    padding-bottom: 90px;
    overflow: auto;
  }

  .personajes-animados .rick-container {
    left: 8px;
    bottom: -15px;
    transform: scale(0.34);
  }

  .personajes-animados .morty-container {
    right: 8px;
    bottom: 0;
    transform: scale(0.42);
  }

  .animacion-info {
    width: min(520px, calc(100% - 40px));
  }
}

@media (max-width: 620px) {
  .body-personajes {
    padding-bottom: 78px;
  }

  .personajes-animados {
    height: 95px;
    bottom: 0;
    z-index: 0;
  }

  .personajes-animados .rick-container {
    display: block;
    left: -4px;
    bottom: -48px;
    transform: scale(0.17);
    opacity: 0.35;
  }

  .personajes-animados .morty-container {
    display: block;
    right: -70px;
    bottom: -28px;
    transform: scale(0.22);
    opacity: 0.35;
  }

  .animacion-info {
    width: calc(100% - 28px);
    padding: 9px 12px;
  }

  .animacion-info strong {
    font-size: 0.86rem;
  }

  .animacion-info span {
    font-size: 0.78rem;
  }
}
