/*<div class="pie" style="--p:20"> 20%</div>*/
/*<div class="pie" style="--p:40;--c:darkblue;--b:10px"> 40%</div>*/
/*<div class="pie no-round" style="--p:60;--c:purple;--b:15px"> 60%</div>*/
/*<div class="pie" style="--p:80;--c:orange;"> 80%</div>*/
/*<div class="pie no-round" style="--p:90;--c:lightgreen"> 90%</div>*/

.pie {
  --p: 20;
  /* the percentage */
  --b: 22px;
  /* the thickness */
  --c: darkred;
  /* the color */
  --w: 150px;
  /* the size*/

  width: var(--w);
  aspect-ratio: 1/1;
  position: relative;
  display: inline-grid;
  margin: 5px;
  place-content: center;
  font-size: 25px;
  font-weight: bold;
  /*font-family: sans-serif;*/
}

.pie:before,
.pie:after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.pie:before {
  inset: 0;
  background:
    radial-gradient(farthest-side, var(--c) 98%, #0000) top/var(--b) var(--b) no-repeat,
    conic-gradient(var(--c) calc(var(--p)*1%), #eee 0);/*#0000 instead of #ccc to make it fully white*/
  -webkit-mask: radial-gradient(farthest-side, #0000 calc(99% - var(--b)), #000 calc(100% - var(--b)));
  mask: radial-gradient(farthest-side, #0000 calc(99% - var(--b)), #000 calc(100% - var(--b)));
}

.no-fill:before {
  inset: 0;
  background:
    radial-gradient(farthest-side, var(--c) 98%, #0000) top/var(--b) var(--b) no-repeat,
    conic-gradient(var(--c) calc(var(--p)*1%), #0000 0);/*#0000 instead of #ccc to make it fully white*/
  -webkit-mask: radial-gradient(farthest-side, #0000 calc(99% - var(--b)), #000 calc(100% - var(--b)));
  mask: radial-gradient(farthest-side, #0000 calc(99% - var(--b)), #000 calc(100% - var(--b)));
}

.pie:after {
  inset: calc(50% - var(--b)/2);
  background: var(--c);
  transform: rotate(calc(var(--p)*3.6deg - 90deg)) translate(calc(var(--w)/2 - 50%));
}

.no-round:before {
  background-size: 0 0, auto;
}

.no-round:after {
  content: none;
}
