.bb {
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  /* a dot every 18 px (5 mm), with a dot on each margin */
  background:
    radial-gradient(circle, #aeb7c2 1.05px, transparent 1.4px) 15px 15px / 18px 18px,
    var(--paper) 0 0 / 540px 540px;
  font-family: "Mansalva", cursive;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;

  --ink: #141414;
  --marker: #ffe234;
}

.bb p {
  margin: 0;
}

.bb-defs {
  position: absolute;
  width: 0;
  height: 0;
}

/* What is being lifted, and where in the session it falls. */
.bb-lift {
  position: absolute;
  left: 21.5px;
  top: 18px;
  font-size: 40px;
  line-height: 44px;
  white-space: nowrap;
}

.bb-set {
  position: absolute;
  right: 23px;
  top: 30.5px;
  font-size: 25px;
  line-height: 30px;
  white-space: nowrap;
}

/* The pen: one fineliner for outlines, a finer one for hatching. */
.bb-line,
.bb-fine {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bb-line {
  stroke-width: 1.9;
}

.bb-fine {
  stroke-width: 1.1;
}

.bb-bar {
  position: absolute;
  left: 0;
  top: 24px;
  overflow: visible;
  scale: 1.12;
  transform-origin: 0 0;
}

.bb-sleeve {
  transition: stroke-dasharray 240ms cubic-bezier(0.3, 0.7, 0.3, 1);
}

.bb-plate,
.bb-collar {
  transition: translate 240ms cubic-bezier(0.3, 0.7, 0.3, 1);
}

/* A plate that goes on is drawn on: its outline in one go, then its hatching, top to bottom. */
.bb-draw {
  stroke-dasharray: 1;
  animation: bb-draw 300ms cubic-bezier(0.3, 0, 0.3, 1) both;
}

.bb-shade {
  animation-duration: 380ms;
  animation-delay: 170ms;
}

.bb-cross {
  animation-duration: 340ms;
  animation-delay: 380ms;
}

@keyframes bb-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Anything written is written from its left end. */
.bb-write {
  animation: bb-write 280ms cubic-bezier(0.3, 0, 0.3, 1) both;
}

@keyframes bb-write {
  from {
    clip-path: inset(-20% 100% -20% -4%);
  }
  to {
    clip-path: inset(-20% -4% -20% -4%);
  }
}

/* The sum for one side, set out as a column. */
.bb-sum {
  position: absolute;
  right: 24px;
  top: 108px;
  width: 118px;
  font-size: 25px;
  line-height: 24px;
}

.bb-sum-head {
  font-size: 22px;
  text-align: right;
  white-space: nowrap;
  padding-bottom: 5px;
}

.bb-sum ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.bb-figure {
  display: grid;
  grid-template-columns: 1fr 36px;
}

.bb-whole {
  text-align: right;
}

.bb-none {
  display: block;
  text-align: right;
  font-size: 22px;
  white-space: nowrap;
}

.bb-sum-rule {
  display: block;
  margin: 2px 0 1px auto;
  overflow: visible;
}

.bb-total {
  line-height: 29px;
}

.bb-sum-foot {
  padding-top: 5px;
  font-size: 20px;
  line-height: 24px;
  text-align: right;
  white-space: nowrap;
}

.bb-sum-foot b {
  display: inline-block;
  font-weight: 400;
}

/* The weight: big block figures, outlined and hatched in, between a minus and a plus. */
.bb-group {
  position: absolute;
  left: 24px;
  top: 366px;
  width: 492px;
  height: 148px;
}

.bb-figures,
.bb-edges {
  all: unset;
  box-sizing: border-box;
  position: absolute;
  left: 52px;
  top: 0;
  width: 348px;
  height: 148px;
  padding: 0 6px;
  font-family: "Bricolage Grotesque Variable", sans-serif;
  font-size: 158px;
  line-height: 148px;
  font-weight: 800;
  font-stretch: 75%;
  font-variation-settings: "opsz" 96;
  font-variant-numeric: tabular-nums;
  letter-spacing: 7px;
  text-align: right;
  white-space: pre;
  color: transparent;
  filter: url(#bb-figures);
}

/* The field: the hatching, cut to the shape of whatever is typed. */
.bb-figures {
  caret-color: var(--ink);
  background-image: var(--shading);
  background-size: 400px 200px;
  background-position-y: -30px;
  -webkit-background-clip: text;
  background-clip: text;
  transition: background-position-x 200ms ease-out;
}

/* Their outlines, over the top. */
.bb-edges {
  overflow: hidden;
  pointer-events: none;
  -webkit-text-stroke: 2.5px var(--ink);
}

.bb-edges span {
  display: inline-block;
}

/* Selected figures are gone over with a highlighter, the one colour on the page: a single swipe, left to
   right, a little off the level, with the ink showing through it. The browser's own box is not drawn. */
.bb-figures::selection {
  background: transparent;
  color: transparent;
}

.bb-marker {
  position: absolute;
  top: 27px;
  height: 96px;
  border-radius: 13px 21px 17px 24px / 38px 30px 42px 34px;
  background: var(--marker);
  mix-blend-mode: multiply;
  rotate: -0.7deg;
  pointer-events: none;
  filter: url(#bb-pen);
  transition:
    left 90ms ease-out,
    width 90ms ease-out;
  animation: bb-swipe 190ms cubic-bezier(0.3, 0, 0.3, 1) both;
}

@keyframes bb-swipe {
  from {
    clip-path: inset(-10% 100% -10% -4%);
  }
  to {
    clip-path: inset(-10% -4% -10% -4%);
  }
}

.bb-unit {
  position: absolute;
  left: 402px;
  top: 94px;
  font-size: 38px;
  line-height: 40px;
}

/* Focus: a loose ring is thrown round the weight, in one movement, running on past where it started. */
.bb-lasso {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
}

.bb-lasso path {
  stroke-width: 1.7;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition:
    opacity 140ms ease-out,
    stroke-dashoffset 0s 140ms;
}

.bb-figures:focus-visible ~ .bb-lasso path {
  stroke-dashoffset: 0;
  opacity: 1;
  transition:
    stroke-dashoffset 520ms cubic-bezier(0.3, 0, 0.25, 1),
    opacity 0s;
}

/* The steps: a ring and a sign. */
.bb-step {
  all: unset;
  position: absolute;
  top: 50px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bb-less {
  left: 0;
}

.bb-more {
  right: -1.5px;
}

.bb-step svg {
  display: block;
  overflow: visible;
  transition: scale 90ms ease-out;
}

.bb-sign {
  stroke-width: 2.4;
  transition: stroke-width 90ms ease-out;
}

/* Under the pointer the ring is gone round again. */
.bb-again {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 120ms ease-in;
}

.bb-step:hover .bb-again {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 300ms cubic-bezier(0.3, 0, 0.3, 1);
}

/* Pressed, the ring is scrubbed in and the pen bears down on the sign. The scrubbing shows at once and stays a
   moment after the press is over, so a quick click is seen too; a step taken from the keyboard does the same. */
.bb-press {
  opacity: 0;
  transition: opacity 220ms ease-out 130ms;
}

.bb-step:not([data-disabled]):active .bb-press,
.bb-step[data-tap] .bb-press {
  opacity: 1;
  transition: none;
}

.bb-step:not([data-disabled]):active svg {
  scale: 0.94;
}

.bb-step:not([data-disabled]):active .bb-sign,
.bb-step:not([data-disabled]):active .bb-ring,
.bb-step[data-tap] .bb-sign {
  stroke-width: 3.1;
}

/* At the empty bar or the heaviest load there is nothing further that way: the step is only pencilled. */
.bb-step[data-disabled] {
  cursor: default;
  opacity: 0.26;
}

.bb-step[data-disabled] .bb-again {
  display: none;
}

/* A typed weight the plates can't make is struck out and the nearest one written beside it. */
.bb-fix {
  position: absolute;
  left: 24px;
  top: 324px;
  font-size: 25px;
  line-height: 28px;
  white-space: nowrap;
}

.bb-fix span {
  display: inline-block;
}

.bb-fix s {
  text-decoration-thickness: 2px;
}

.bb-fix i {
  display: block;
  font-style: normal;
  font-size: 20px;
  line-height: 24px;
}

@media (prefers-reduced-motion: reduce) {
  .bb-draw,
  .bb-write,
  .bb-marker {
    animation: none;
  }
  .bb-plate,
  .bb-collar,
  .bb-sleeve,
  .bb-lasso path,
  .bb-again {
    transition: none !important;
  }
}
