.range-slider {
  --primary-color: #a7807b93;
  --value-offset-y: var(--ticks-gap);
  --value-active-color: white;
  --value-background: transparent;
  --value-background-hover: var(--main-color);
  --value-font: 700 12px/1 Arial;
  --fill-color: var(--main-color);
  --progress-background: #eee;
  --track-height: 6px;
  --min-max-x-offset: 50%;
  --thumb-size: 16px;
  --thumb-color: #fb6da0;
  --thumb-border: 1px solid #fb6da0;
  --thumb-hover-color: #fb6da0;
  --thumb-hover-border: 1px solid transparent;
  --thumb-active-color: #fb6da0;
  --thumb-active-border: 1px solid transparent;
  --thumb-focus-outline: 2px solid #fb6da0;
  --thumb-focus-outline-offset: .25rem;
  --ticks-thickness: 2px;
  --ticks-height: 10px;
  --ticks-gap: var(--ticks-height);
  --ticks-color: #ccc;
  --step: 1;
  --ticks-count: Calc(var(--max) - var(--min)) / var(--step);
  --maxTicksAllowed: 30;
  --too-many-ticks: Min(1, Max(var(--ticks-count) - var(--maxTicksAllowed), 0));
  --x-step: Max(var(--step),
      var(--too-many-ticks) * (var(--max) - var(--min)));
  /* --tickInterval: 100/ ((var(--max) - var(--min)) / var(--step)) * var(--tickEvery, 1);
    --tickIntervalPerc: calc(
      (100% - var(--thumb-size)) / ((var(--max) - var(--min)) / var(--x-step)) *
        var(--tickEvery, 1)
    ); */
  --value-a: Clamp(var(--min),
      var(--value, 0),
      var(--max));
  --value-b: var(--value, 0);
  --text-value-a: var(--text-value, "");
  --completed-a: calc((var(--value-a) - var(--min)) / (var(--max) - var(--min)) * 100);
  --completed-b: calc((var(--value-b) - var(--min)) / (var(--max) - var(--min)) * 100);
  --ca: Min(var(--completed-a), var(--completed-b));
  --cb: Max(var(--completed-a), var(--completed-b));
  --thumbs-too-close: Clamp(-1,
      1000 * (Min(1, Max(var(--cb) - var(--ca) - 5, -1)) + 0.001),
      1);
  --thumb-close-to-min: Min(1, Max(var(--ca) - 2, 0));
  --thumb-close-to-max: Min(1, Max(98 - var(--cb), 0));
  display: inline-block;
  height: max(var(--track-height), var(--thumb-size));
  background: linear-gradient(to right, var(--ticks-color) var(--ticks-thickness), transparent 1px) repeat-x;
  background-size: var(--tickIntervalPerc) var(--ticks-height);
  /* background-position-x: calc( var(--thumb-size) / 2 - var(--ticks-thickness) / 2 ); */
  /* background-position-y: var(--flip-y, bottom); */
  /* padding-bottom: var(--flip-y, var(--ticks-gap));
    padding-top: calc(var(--flip-y) * var(--ticks-gap)); */
  position: relative;
  z-index: 1;
}

.range-slider[data-ticks-position=top] {
  --flip-y: 1;
}

/* .range-slider::before, .range-slider::after {
    --offset: calc(var(--thumb-size) / 2);
    content: counter(x);
    display: var(--show-min-max, block);
    position: absolute;
    bottom: var(--flip-y, -2.5ch);
    top: calc(-2.5ch * var(--flip-y));
    transform: translateX(calc(var(--min-max-x-offset) * var(--before, -1) * -1)) scale(var(--at-edge));
    pointer-events: none;
    font-family: Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 700;
  } */
/* .range-slider::before {
    --before: 1;
    --at-edge: var(--thumb-close-to-min);
    counter-reset: x var(--min);
    left: var(--offset);
  }
  .range-slider::after {
    --at-edge: var(--thumb-close-to-max);
    counter-reset: x var(--max);
    right: var(--offset);
  } */
.range-slider__progress {
  --start-end: calc(var(--thumb-size) / 2);
  --clip-end: calc(100% - (var(--cb)) * 1%);
  --clip-start: calc(var(--ca) * 1%);
  --clip: inset(-20px var(--clip-end) -20px var(--clip-start));
  position: absolute;
  left: var(--start-end);
  right: var(--start-end);
  top: calc(var(--ticks-gap) * var(--flip-y, 0) + var(--thumb-size) / 2 - var(--track-height) / 2);
  height: calc(var(--track-height));
  background: var(--progress-background, #eee);
  pointer-events: none;
  z-index: -1;
}

.range-slider__progress::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  clip-path: var(--clip);
  top: 0;
  bottom: 0;
  background: var(--fill-color, #A7807B);
  box-shadow: var(--progress-flll-shadow);
  z-index: 1;
  border-radius: inherit;
}

.range-slider>input {
  -webkit-appearance: none;
  width: 100%;
  height: var(--thumb-size);
  margin: 0;
  position: absolute;
  left: 0;
  top: calc(50% - Max(var(--track-height), var(--thumb-size)) / 2 + calc(var(--ticks-gap) / 2 * var(--flip-y, -1)));
  cursor: -webkit-grab;
  cursor: grab;
  outline: none;
  background: none;
}

.range-slider>input:not(:only-of-type) {
  pointer-events: none;
}

.range-slider>input::-webkit-slider-thumb {
  appearance: none;
  height: var(--thumb-size);
  width: var(--thumb-size);
  transform: var(--thumb-transform);
  border-radius: var(--thumb-radius, 50%);
  background: var(--thumb-color);
  border: var(--thumb-border);
  pointer-events: auto;
  transition: 0.1s;
}

.range-slider>input::-moz-range-thumb {
  appearance: none;
  height: var(--thumb-size);
  width: var(--thumb-size);
  transform: var(--thumb-transform);
  border-radius: var(--thumb-radius, 50%);
  background: var(--thumb-color);
  border: var(--thumb-border);
  pointer-events: auto;
  transition: 0.1s;
}

.range-slider>input::-ms-thumb {
  appearance: none;
  height: var(--thumb-size);
  width: var(--thumb-size);
  transform: var(--thumb-transform);
  border-radius: var(--thumb-radius, 50%);
  background: var(--thumb-color);
  border: var(--thumb-border);
  pointer-events: auto;
  transition: 0.1s;
}

.range-slider>input:hover+output {
  --value-background: var(--value-background-hover);
  --y-offset: -5px;
  color: var(--value-active-color);
  box-shadow: 0 0 0 3px var(--value-background);
}

.range-slider>input:active {
  cursor: grabbing;
  z-index: 2;
}

.range-slider>input:active+output {
  transition: 0s;
}

.range-slider>input:hover::-webkit-slider-thumb {
  background-color: var(--thumb-hover-color);
  border-color: var(--thumb-hover-border);
}

.range-slider>input:hover::-moz-range-thumb {
  background-color: var(--thumb-hover-color);
  border-color: var(--thumb-hover-border);
}

.range-slider>input:hover::-ms-thumb {
  background-color: var(--thumb-hover-color);
  border-color: var(--thumb-hover-border);
}

.range-slider>input:active::-webkit-slider-thumb {
  background-color: var(--thumb-active-color);
  border-color: var(--thumb-active-border);
}

.range-slider>input:active::-moz-range-thumb {
  background-color: var(--thumb-active-color);
  border-color: var(--thumb-active-border);
}

.range-slider>input:active::-ms-thumb {
  background-color: var(--thumb-active-color);
  border-color: var(--thumb-active-border);
}

.range-slider>input:focus::-webkit-slider-thumb {
  outline: var(--thumb-focus-outline);
  outline-offset: var(--thumb-focus-outline-offset);
}

.range-slider>input:focus::-moz-range-thumb {
  outline: var(--thumb-focus-outline);
  outline-offset: var(--thumb-focus-outline-offset);
}

.range-slider>input:focus::-ms-thumb {
  outline: var(--thumb-focus-outline);
  outline-offset: var(--thumb-focus-outline-offset);
}

.range-slider>input:nth-of-type(1) {
  --is-left-most: Clamp(0, (var(--value-a) - var(--value-b)) * 99999, 1);
}

.range-slider>input:nth-of-type(1)+output {
  --value: var(--value-a);
  --x-offset: calc(var(--completed-a) * -1%);
}

.range-slider>input:nth-of-type(1)+output:not(:only-of-type) {
  --flip: calc(var(--thumbs-too-close) * -1);
}

.range-slider>input:nth-of-type(1)+output::after {
  content: var(--prefix, "") var(--text-value-a) var(--suffix, "");
}

.range-slider>input:nth-of-type(2) {
  --is-left-most: Clamp(0, (var(--value-b) - var(--value-a)) * 99999, 1);
}

.range-slider>input:nth-of-type(2)+output {
  --value: var(--value-b);
}

.range-slider>input+output {
  --flip: -1;
  --x-offset: calc(var(--completed-b) * -1%);
  --pos: calc(((var(--value) - var(--min)) / (var(--max) - var(--min))) * 100%);
  pointer-events: none;
  position: absolute;
  z-index: 5;
  background: var(--value-background);
  border-radius: 10px;
  padding: 2px 4px;
  left: var(--pos);
  transform: translate(var(--x-offset), calc(150% * var(--flip) - (var(--y-offset, 0px) + var(--value-offset-y)) * var(--flip)));
  transition: all 0.12s ease-out, left 0s;
}

.range-slider>input+output::after {
  content: var(--prefix, "") var(--text-value-b) var(--suffix, "");
  font: var(--value-font);
}


@media screen and (max-width: 500px) {
  body {
    padding-top: 2em;
    gap: 8%;
  }
}

body>.range-slider,
label[dir=rtl] .range-slider {
  width: clamp(300px, 50vw, 800px);
  min-width: 200px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}