.hg {
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  isolation: isolate;
  background: #1d4f55;
  color: #f3e8d2;
  font-family: "Besley Variable", serif;
  user-select: none;
  -webkit-user-select: none;
}

.hg * { box-sizing: border-box; }

.hg-gl {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 540px;
  height: 540px;
  pointer-events: none;
}

/* The setting's row: its name, and whether it is on. */
.hg-row {
  position: absolute;
  left: 40px;
  right: 40px;
  top: 436px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  height: 64px;
  padding-top: 16px;
  font-size: 30px;
  font-weight: 500;
  line-height: 36px;
  letter-spacing: -0.015em;
  cursor: default;
}

/* The state: set in the italic. Its colour and its spring are driven from
   the lamp and the contact, frame by frame. */
.hg-state {
  display: inline-block;
  color: rgb(243 232 210 / 0.62);
  font-style: italic;
  font-weight: 450;
  transform-origin: 100% 80%;
  will-change: transform;
}

/* The switch is the capsule: its button covers where the capsule can be. The
   picture is drawn by the canvas under it. */
.hg-switch {
  position: absolute;
  left: -24px;
  top: -336px;
  width: 492px;
  height: 248px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  appearance: none;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.hg-switch:active { cursor: grabbing; }

.hg-thumb { display: none; }

/* Focus: a ring round the capsule, 2 px off it, turning with it. */
.hg-ring {
  position: absolute;
  left: 7px;
  top: 67px;
  width: 458px;
  height: 114px;
  border-radius: 57px;
  box-shadow: 0 0 0 2px #f7ecd4, 0 0 0 3.5px #12363b;
  opacity: 0;
  pointer-events: none;
  transform-origin: 229px 57px;
}

.hg-switch:focus-visible .hg-ring { opacity: 1; }
