.image-tool {
  display: grid;
  gap: clamp(16px, 2vw, 28px);
  min-width: 0;
  color: inherit;
  font-family: var(--font-sans, sans-serif);
}
.image-tool [hidden] { display: none !important; }
.image-tool-drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 190px;
  overflow: hidden;
  padding: 12px;
  border: 1px dashed #aaa;
  border-radius: 6px;
  background: #f7f7f5;
  text-align: center;
  cursor: pointer;
}
.image-tool-drop:is(:hover, :focus-within, .image-tool-dragging) { border-color: currentColor; }
.image-tool-drop:focus-within { outline: 2px solid currentColor; outline-offset: 3px; }
.image-tool-dragging { background: #eee; }
.image-tool-drop input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.image-tool-drop-copy { display: grid; gap: 8px; }
.image-tool-drop-copy strong { font-size: clamp(19px, 2vw, 27px); font-weight: 500; }
.image-tool-drop-copy small { font-size: 13px; line-height: 1.5; color: #575757; }
.image-tool-preview { display: block; width: 100%; height: clamp(180px, 20vw, 270px); object-fit: contain; }
.image-tool-replace {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 5px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #161616;
  font-size: 12px;
}
.image-tool-source, .image-tool-dimensions, .image-tool-status {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.image-tool-source { margin-top: -8px; color: #595959; }
.image-tool-parameters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr));
  align-items: end;
  gap: 14px;
}
.image-tool-parameters label {
  display: grid;
  min-width: 0;
  gap: 8px;
  font-size: 13px;
}
.image-tool-control, .image-tool-parameters select {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 0 10px;
  border: 1px solid #bdbdb9;
  border-radius: 4px;
  color: inherit;
  background: #fff;
  font: inherit;
  font-size: 16px;
}
.image-tool-control span, .image-tool-slider output { color: #555; font-size: 12px; }
.image-tool-control input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}
.image-tool-control:focus-within { outline: 2px solid currentColor; outline-offset: 2px; }
.image-tool-control input:focus-visible { outline: none; }
.image-tool-slider { display: flex; min-height: 43px; align-items: center; gap: 6px; }
.image-tool-slider input { flex: 1; min-width: 0; width: 100%; accent-color: #111; }
.image-tool-slider output { min-width: 3ch; font-variant-numeric: tabular-nums; }
.image-tool-bottom { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.image-tool-bottom button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  min-height: 42px;
  border: 1px solid #111;
  border-radius: 4px;
  background: #111;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.image-tool-bottom button:disabled { background: #eee; border-color: #eee; color: #777; cursor: default; }
.image-tool-status:empty { display: none; }
.image-tool-status a { text-decoration: underline; text-underline-offset: .2em; }
.image-tool-error { color: #9a211e; }
@media (max-width: 420px) {
  .image-tool-parameters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .image-tool-parameters .image-tool-quality { grid-column: 1 / -1; }
}
