Image element dynamic resizing

Helllo all,
I have a pictures elements card, that have a blue rectangle. I want to dynamic resize, but it not works. I try the folow code:

type: picture-elements
image: /local/vizmu/0001_alap_4.png
elements:
  - type: image
    entity: input_number.ontozo_vizszin_szam
    image: /local/vizmu/öntöző_vízszint.png
    style:
      left: 50%
      top: 50%
      width: 100%
      transform: translate(-50%, -50%)
    card_mod:
      style: |
        :host {
          --my-image-height: ${states['input_number.ontozo_vizszin_szam'].state}%;
        }
        img {
          height: var(--my-image-height);
        }

This forum helped me when i wrote this code. I hope someone helps me now again. bye

Because this is a JS-like code - and card-mod accepts jinja!