.image-search-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
}
.image-search-footer {
  display: none;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
  position: relative;
  bottom: 0;
}

.image-attribution-giphy-top {
  display: block;
  margin: 0 auto;
  width: 100%;
  height: auto;
}

.image-attribution-giphy-bottom-right {
  display: block;
  margin: 0 auto;
  width: 100px;
  height: auto;
  right: 0px;
  bottom: 0px;
  position: absolute;
}

.image-attribution-giphy-bottom-left {
  display: block;
  margin: 0 auto;
  width: 100px;
  height: auto;
  left: 0px;
  bottom: 0px;
  position: absolute;
}


.image-search-ui {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-family: system-ui, sans-serif;
  margin: 24px;
}

#image-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

#image-search-form select,
#image-search-form input[type="text"],
#image-search-form button {
  padding: 0.4em 0.6em;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 0.9em;
  flex: 1;
  min-width: 120px;
}

#image-search-form button {
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

#image-search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

#image-search-results img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#image-search-results img:hover {
  transform: scale(1.05);
}

#send-selected-images {
  align-self: flex-start;
  padding: 0.5em 1em;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
}


@media (max-width: 767px) and (pointer: coarse) and (hover: none) {
  .image-search-ui {
    margin: 12px;
    gap: 1.5rem;
    font-size: 1.5em;
  }

  #image-search-form {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  #image-search-form select,
  #image-search-form input[type="text"],
  #image-search-form button {
    padding: 1em;
    min-width: unset;
    flex: unset;
  }

  #image-search-form button {
    font-size: 1.5em;
  }

  #send-selected-images {
    font-size: 1.4em;
    padding: 1em;
    width: 100%;
  }

  #image-search-results {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 128px;
  }

  #image-search-results img {
    border-radius: 8px;
    height: auto;
  }

  .image-attribution-giphy-bottom-right,
  .image-attribution-giphy-bottom-left {
    width: 64px;
    opacity: 0.7;
  }

  .image-search-footer {
    display: flex;
    flex-direction: column;
    font-size: 1.2em;
    margin-top: 2rem;
  }
}
