.top-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 30;
  display: flex;
  gap: 10px;
}

.bottom-controls {
  position: absolute;
  right: 20px;
  bottom: 24px;
  left: 20px;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 22px;
}

.action-controls,
.direction-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.action-controls {
  justify-content: flex-start;
  gap: 16%;
}

.direction-controls {
  justify-content: flex-end;
  gap: 16%;
}

.ui-button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    filter 120ms ease,
    transform 120ms ease;
}

.ui-button:hover,
.ui-button:focus-visible,
.ui-button:active,
.sound-toggle-input:checked + .sound-icon + .sound-icon-off {
  filter: brightness(1.3);
}

.ui-button:focus-visible {
  outline: 2px solid white;
  outline-offset: 4px;
}

.ui-button:active {
  transform: scale(0.94);
}

.control-button {
  width: 80px;
  height: 80px;
  touch-action: none;
}

.control-button img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.home-button,
.resize-button,
.story-toggle-button,
.sound-toggle {
  width: 42px;
  height: 42px;
}

.home-button img,
.resize-button img,
.story-toggle-button img,
.sound-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sound-toggle {
  position: relative;
}

.sound-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.sound-icon-off {
  display: none;
}

.sound-toggle-input:checked ~ .sound-icon-on {
  display: none;
}

.sound-toggle-input:checked ~ .sound-icon-off {
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .action-controls,
  .direction-controls {
    display: none;
  }
}
