.results > article,
.converter-results > article,
.results .converter-card,
.results .compress-card,
.results .crop-card,
.results .resize-card,
.results .rotate-card {
  position: relative;
}

.results .remove-one,
.converter-results .remove-one {
  position: absolute !important;
  z-index: 12;
  top: 10px;
  right: 10px;
  display: grid !important;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28) !important;
  border-radius: 999px !important;
  background: rgba(12, 18, 29, .82) !important;
  color: #fff !important;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .3) !important;
  font: 700 21px/1 Arial, sans-serif !important;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.results .remove-one:hover,
.converter-results .remove-one:hover {
  border-color: rgba(255, 255, 255, .55) !important;
  background: #d54b55 !important;
  transform: scale(1.07);
}

.results .remove-one:focus-visible,
.converter-results .remove-one:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent, #7488ff) 55%, transparent);
  outline-offset: 2px;
}

.results .card-actions,
.converter-results .card-actions {
  align-self: center;
  align-items: stretch;
  gap: 8px;
}

.results .card-actions > button:not(.remove-one),
.converter-results .card-actions > button:not(.remove-one) {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  margin: 0;
  text-align: center;
}

/* Converter, compressor, and resizer each have one remaining card action. */
.converter-card .card-actions,
.compress-card .card-actions,
.resize-card .card-actions {
  display: grid !important;
  grid-template-columns: minmax(116px, 1fr) !important;
  min-width: 130px;
}

/* Crop cards keep Edit and Download side by side. */
.crop-card .card-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(100px, 1fr)) !important;
  min-width: 216px;
}

/* Rotation controls use two balanced columns; Download occupies a full row. */
.rotate-card .card-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(112px, 1fr)) !important;
  min-width: 236px;
}

.rotate-card .card-actions .download-one {
  grid-column: 1 / -1;
}

.grid-view .card-actions,
.medium-grid-view .card-actions,
.large-grid-view .card-actions,
.card-view .card-actions,
.card-small-view .card-actions,
.card-medium-view .card-actions {
  width: 100% !important;
  min-width: 0 !important;
  margin-top: auto;
}

@media (max-width: 760px) {
  .results .card-actions,
  .converter-results .card-actions {
    grid-column: 1 / -1;
    width: 100% !important;
    min-width: 0 !important;
  }

  .results .remove-one,
  .converter-results .remove-one { top: 8px; right: 8px; }
}

@media (max-width: 440px) {
  .crop-card .card-actions,
  .rotate-card .card-actions {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .rotate-card .card-actions .download-one { grid-column: auto; }
}

/* Compact per-image download button positioned below the remove button. */
.results .download-one,
.converter-results .download-one {
  position: absolute !important; z-index: 12; top: 50px; right: 10px;
  display: grid !important; width: 32px !important; min-width: 32px !important;
  height: 32px !important; min-height: 32px !important; padding: 0 !important;
  place-items: center; border: 1px solid rgba(255,255,255,.28) !important;
  border-radius: 999px !important; background: rgba(12,18,29,.82) !important;
  color: #fff !important; box-shadow: 0 5px 16px rgba(0,0,0,.3) !important;
  font-size: 0 !important; line-height: 1 !important; backdrop-filter: blur(8px);
  transition: border-color .16s ease, background .16s ease, transform .16s ease, opacity .16s ease;
}
.results .download-one:not(:has(svg))::before,
.converter-results .download-one:not(:has(svg))::before {
  width: 17px; height: 17px; background: currentColor; content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v11m0 0 4-4m-4 4-4-4M5 18v2h14v-2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v11m0 0 4-4m-4 4-4-4M5 18v2h14v-2'/%3E%3C/svg%3E") center / contain no-repeat;
}
.results .download-one:not(:disabled):hover,
.converter-results .download-one:not(:disabled):hover { border-color: rgba(255,255,255,.55) !important; background: var(--accent,#7488ff) !important; transform: scale(1.07); }
.results .download-one:disabled,
.converter-results .download-one:disabled { opacity: .38; cursor: not-allowed; }
.results .download-one:focus-visible,
.converter-results .download-one:focus-visible { outline: 3px solid color-mix(in srgb,var(--accent,#7488ff) 55%,transparent); outline-offset: 2px; }
.converter-card .card-actions,
.compress-card .card-actions:not(:has(.cancel-one)),
.resize-card .card-actions { width: 0 !important; min-width: 0 !important; height: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; }
.crop-card .card-actions { width: 0 !important; min-width: 0 !important; height: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; }
.crop-card .edit-one {
  position: absolute !important; z-index: 12; top: 50px; right: 10px;
  display: grid !important; width: 32px !important; min-width: 32px !important;
  height: 32px !important; min-height: 32px !important; padding: 0 !important;
  place-items: center; border: 1px solid rgba(255,255,255,.28) !important;
  border-radius: 999px !important; background: rgba(12,18,29,.82) !important;
  color: #fff !important; box-shadow: 0 5px 16px rgba(0,0,0,.3) !important;
  font-size: 0 !important; line-height: 1 !important; backdrop-filter: blur(8px);
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.crop-card .edit-one::before {
  width: 17px; height: 17px; background: currentColor; content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L8 18l-4 1 1-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L8 18l-4 1 1-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.crop-card .edit-one:hover { border-color: rgba(255,255,255,.55) !important; background: var(--accent,#7488ff) !important; transform: scale(1.07); }
.crop-card .edit-one:focus-visible { outline: 3px solid color-mix(in srgb,var(--accent,#7488ff) 55%,transparent); outline-offset: 2px; }
.crop-card .download-one { top: 90px !important; }
@media (max-width:760px) {
  .results .download-one,
  .converter-results .download-one { top: 48px; right: 8px; }
  .crop-card .edit-one { top: 48px; right: 8px; }
  .crop-card .download-one { top: 88px !important; }
}

/* Keep original and resulting pixel dimensions together on one row. */
.file-info .dimensions {
  display: flex !important;
  max-width: 100%;
  min-width: 0;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.file-info .dimensions::-webkit-scrollbar { display: none; }
.file-info .dimensions :is(b, i, em) { flex: 0 0 auto; }
.file-info .dimensions i,
.file-info .dimensions em { color: var(--muted); font-style: normal; }
.file-info .dimensions b { padding: 4px 7px; border-radius: 6px; background: #e5e9f1; color: #526075; font: 700 11px 'DM Mono', monospace; }
.file-info .dimensions b.output { background: var(--accent); color: #fff; }
html[data-theme=dark] .file-info .dimensions b:not(.output) { background: #293448; color: #c1cadb; }

/* Crop result metadata: keep pixel dimensions and file sizes on one line. */
.crop-card .file-info {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
}
.crop-card .file-info::-webkit-scrollbar { display: none; }
.crop-card .file-info > .dimensions { display: inline-flex !important; }
.crop-card .file-info > .dimensions + span {
  display: inline-block;
  margin-left: 7px;
  white-space: nowrap;
}

/* Shared status badges shown over image previews. */
:is(.compress-card,.crop-card,.rotate-card) .preview-wrap { position: relative; }
.card-status-overlay {
  position: absolute !important;
  z-index: 9;
  top: 9px;
  left: 9px;
  display: inline-flex !important;
  width: auto !important;
  max-width: calc(100% - 18px);
  min-height: 24px;
  align-items: center;
  margin: 0 !important;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  background: rgba(15,23,42,.86);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
  font: 700 10px/1.25 'Noto Sans Thai','Segoe UI',sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(7px);
  pointer-events: none;
}
.card-status-overlay.card-status-on-card { top: 22px; left: 22px; }
.card-status-overlay.status-done { background: rgba(8,116,90,.92); }
.card-status-overlay.status-working { background: rgba(79,70,229,.92); }
.card-status-overlay.status-failed { background: rgba(185,56,56,.94); }
.card-status-overlay.status-cancelled { background: rgba(71,85,105,.92); }
@media(max-width:760px){.card-status-overlay.card-status-on-card{top:17px;left:17px}}
