.compress-editor h2 { font-size: 1.1rem; font-weight: 760; }

.image-picker {
  display: grid;
  justify-items: center;
  gap: .22rem;
  min-height: 7.8rem;
  padding: .95rem .75rem;
  margin-top: .6rem;
  border: 1px dashed #a7b6e4;
  border-radius: .95rem;
  background: linear-gradient(135deg, #f4f6ff, #f8fbff);
  color: var(--ink);
  cursor: pointer;
  width: 100%;
  text-align: center;
}
.image-picker--compact { min-height: 6.4rem; padding: .78rem .65rem; }

.image-picker:hover:not(:disabled), .image-picker[data-dragging] {
  border-color: var(--blue);
  background: #eef1ff;
}
.image-picker strong { font-size: .95rem; font-weight: 740; }
.image-picker small { color: var(--muted); font-size: .82rem; }

.picker-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.45rem;
  aspect-ratio: 1;
  margin-bottom: .15rem;
  border: 1px solid #d8e1fc;
  border-radius: .78rem;
  background: #e5ebff;
  color: #485fc4;
}
.picker-icon::before {
  content: "";
  width: 1.15rem;
  height: .88rem;
  border: .095rem solid currentColor;
  border-radius: .2rem;
  background: radial-gradient(circle at 26% 28%, currentColor .1rem, transparent .12rem);
}
.picker-icon::after {
  content: "";
  position: absolute;
  width: .86rem;
  height: .42rem;
  transform: translateY(.14rem);
  clip-path: polygon(0 100%, 35% 12%, 58% 65%, 77% 33%, 100% 100%);
  background: currentColor;
}

.selected-image {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  padding: .18rem .65rem;
  margin-top: .45rem;
  border: 1px solid var(--line);
  border-radius: .74rem;
  background: #f9faff;
  color: var(--muted);
  font-size: .85rem;
}
.selected-image span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-image button {
  flex: none;
  min-height: 2.35rem;
  padding: 0 .2rem;
  border: 0;
  background: none;
  color: var(--blue);
  cursor: pointer;
  font-weight: 680;
}
.selected-image button:hover { text-decoration: underline; }

.compress-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin-top: .95rem;
}
.compress-edge-row { margin-top: .7rem; }

.compress-setting label { display: block; margin-bottom: .3rem; font-size: .92rem; font-weight: 710; }

.size-control, .compress-setting select {
  min-height: 2.65rem;
  border: 1px solid #c9d4ea;
  border-radius: .72rem;
  background-color: #f8faff;
  color: var(--ink);
}
.size-control { display: flex; align-items: center; padding-inline: .68rem; }
.size-control:focus-within { outline: .16rem solid var(--blue); outline-offset: .15rem; }
.size-control:has(input[aria-invalid="true"]) { border-color: #b12c43; }
.size-control span { flex: none; color: var(--muted); font-size: .82rem; }
.size-control input {
  appearance: textfield;
  width: 100%;
  min-width: 0;
  padding: .42rem .3rem .42rem 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 730;
  font-variant-numeric: tabular-nums;
}
.size-control input:focus-visible { outline: 0; }
.size-control input::-webkit-inner-spin-button { appearance: none; }

.compress-setting select, .select-input {
  appearance: none;
  width: 100%;
  min-height: 2.6rem;
  padding: .42rem 1.85rem .42rem .68rem;
  border: 1px solid #c9d4ea;
  border-radius: .72rem;
  background-color: #f8faff;
  background-image: linear-gradient(45deg, transparent 50%, #5e6f95 50%), linear-gradient(135deg, #5e6f95 50%, transparent 50%);
  background-position: right .94rem center, right .69rem center;
  background-repeat: no-repeat;
  background-size: .25rem .25rem;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 660;
}

.limit-presets { display: flex; flex-wrap: wrap; gap: .34rem; margin-top: .55rem; }
.limit-presets button {
  min-height: 2.1rem;
  padding-inline: .6rem;
  border: 1px solid var(--line);
  border-radius: .56rem;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 660;
}
.limit-presets button:hover:not(:disabled) { border-color: #9baae9; }
.limit-presets button[aria-pressed="true"] { border-color: #c3cef7; background: #ebefff; color: #384bb2; }
.limit-presets button:disabled { cursor: default; }

.compress-editor .field-help { margin: .46rem 0 0; }
.compress-editor #format-help { margin-top: .16rem; }
.compress-editor .primary-button { margin-top: .9rem; }

.compress-privacy {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .38rem;
  margin-top: .65rem;
  color: var(--muted);
  font-size: .82rem;
}
.compress-privacy span {
  position: relative;
  width: .71rem;
  height: .57rem;
  margin-top: .22rem;
  border: 1px solid currentColor;
  border-radius: .12rem;
}
.compress-privacy span::before {
  content: "";
  position: absolute;
  inset: -.35rem .13rem .35rem;
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: .3rem .3rem 0 0;
}

.image-download { display: inline-flex; align-items: center; }

.image-preview {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(15rem, 29vw, 23rem);
  padding: 1.15rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, #e5eeff, transparent 72%),
    radial-gradient(circle, #b6c5e578 1px, transparent 1.5px),
    #f3f6fc;
  background-size: auto, 1.18rem 1.18rem, auto;
  background-position: center;
}
.image-preview[data-has-image] {
  background: repeating-conic-gradient(#e7edf6 0% 25%, #f7f9fd 0% 50%) center / 1.24rem 1.24rem;
}

.image-preview > img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  image-orientation: from-image;
}

/* === Before/After Split Comparison Slider === */
.split-stage {
  position: relative;
  width: 100%;
  height: 100%;
  user-select: none;
  touch-action: none;
}
.split-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.split-layer--before {
  clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0);
}
.split-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split, 50%);
  width: 2px;
  background: #3349c7;
  box-shadow: 0 0 0 1px #fff, 0 2px 8px #0f172a55;
  pointer-events: none;
  display: grid;
  place-items: center;
}
.split-divider span {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #3349c7;
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px #0f172a40;
}
.split-tag {
  position: absolute;
  top: .5rem;
  padding: .16rem .52rem;
  border-radius: 999px;
  background: #172440cc;
  color: #fff;
  font-size: .74rem;
  font-weight: 680;
  pointer-events: none;
}
.split-tag--left { left: .5rem; }
.split-tag--right { right: .5rem; }

.split-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.photo-stack {
  display: grid;
  position: relative;
  place-items: center;
  width: min(80%, 15.5rem);
  aspect-ratio: 1.18;
}
.photo-stack span {
  position: absolute;
  width: 76%;
  aspect-ratio: 1.48;
  transform: translate(-1rem, -.65rem) rotate(-10deg);
  border: .44rem solid white;
  border-radius: .82rem;
  background: radial-gradient(circle at 73% 25%, #fff0bd 0 9%, transparent 9.8%), linear-gradient(143deg, #aacea7, #a6bef5 68%);
  box-shadow: 0 .28rem 1.35rem #3448793d;
  overflow: hidden;
}
.photo-stack span:last-child {
  width: 64%;
  transform: translate(1.8rem, 1.15rem) rotate(9deg);
  background: radial-gradient(circle at 71% 27%, #fff2c8 0 9%, transparent 9.8%), linear-gradient(150deg, #c8c5f6, #91bee5);
}
.photo-stack span::before, .photo-stack span::after {
  content: "";
  position: absolute;
  inset: 20% 0 0;
  background: #6686c5;
  clip-path: polygon(0 100%, 0 72%, 26% 25%, 49% 68%, 70% 12%, 100% 62%, 100% 100%);
}
.photo-stack span::after {
  inset: 39% 0 0;
  background: #415e9e;
  clip-path: polygon(0 100%, 0 57%, 32% 10%, 58% 73%, 82% 40%, 100% 72%, 100% 100%);
}

.image-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
  padding: .8rem clamp(.85rem, 2.8vw, 1.45rem) .95rem;
  border-top: 1px solid var(--line);
  background: #f8faff;
}
.image-metric {
  position: relative;
  display: grid;
  gap: .06rem;
  min-width: 0;
  min-height: 5.2rem;
  padding: .62rem .75rem;
  border: 1px solid var(--line);
  border-radius: .78rem;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.image-metric[aria-pressed="true"] { border-color: #aebcf4; background: #eef2ff; }
.image-metric:hover:not(:disabled) { border-color: #aebcf4; }
.image-metric:disabled { color: var(--muted); cursor: default; }
.image-metric:not(:disabled)::after {
  content: "";
  position: absolute;
  top: .8rem;
  right: .75rem;
  width: .56rem;
  aspect-ratio: 1;
  border: 1px solid #8c9cc3;
  border-radius: 50%;
}
.image-metric[aria-pressed="true"]::after {
  border-color: var(--blue);
  background: radial-gradient(circle, var(--blue) 0 38%, transparent 42%);
}
.image-metric span, .image-metric small { color: var(--muted); font-size: .8rem; }
.image-metric strong { font-size: 1.06rem; font-weight: 760; }
.image-metric:disabled strong { font-size: .95rem; }
.metric-head {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  padding-right: 1.15rem;
}
.savings-badge {
  font-style: normal;
  padding: .05rem .44rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: .72rem;
  font-weight: 760;
  line-height: 1.3;
}

/* === Batch Compression Queue === */
.compress-queue-wrap {
  padding: .75rem clamp(.85rem, 2.8vw, 1.45rem) 1rem;
  border-top: 1px solid var(--line);
  background: #fff;
}
.compress-queue-summary {
  font-size: .83rem;
  font-weight: 680;
  color: var(--muted);
  margin-bottom: .55rem;
}
.compress-queue {
  display: grid;
  gap: .45rem;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 15.5rem;
  overflow-y: auto;
}
.compress-q-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .36rem .5rem;
  border: 1px solid #e2e8f5;
  border-radius: .72rem;
  background: #f9fbff;
}
.compress-q-item[data-active="true"] {
  border-color: #9baef0;
  background: #eef3ff;
}
.compress-q-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .55rem;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.compress-q-main img {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: .42rem;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #dce4f4;
}
.compress-q-main > span { min-width: 0; display: grid; }
.compress-q-main strong {
  font-size: .84rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compress-q-main small { font-size: .77rem; color: var(--muted); }
.compress-q-main small.q-done { color: #166534; font-weight: 640; }
.compress-q-main small.q-err { color: #a22137; }
.compress-q-ops { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }

@media (max-width: 46rem) {
  .image-preview { height: clamp(13rem, 61vw, 18.5rem); padding: .85rem; }
  .image-comparison { gap: .5rem; }
  .limit-presets button { min-height: 2.35rem; }
}

/* === Dark Mode Overrides for Compress === */
[data-theme="dark"] .image-picker {
  background: linear-gradient(135deg, #111b30, #142038);
  border-color: rgba(123, 154, 255, .36);
}
[data-theme="dark"] .image-picker:hover:not(:disabled),
[data-theme="dark"] .image-picker[data-dragging] {
  background: #182644;
  border-color: #7b9aff;
}
[data-theme="dark"] .picker-icon {
  background: rgba(123, 154, 255, .18);
  color: #93b4ff;
}
[data-theme="dark"] .selected-image,
[data-theme="dark"] .size-control,
[data-theme="dark"] .compress-setting select,
[data-theme="dark"] .compress-setting input.text-input {
  background-color: #0e1627;
  border-color: rgba(148, 163, 184, .26);
  color: var(--ink);
}
.limit-presets button {
  border-radius: 9999px;
  border-color: rgba(15, 23, 42, .1);
  background: rgba(255, 255, 255, .94);
  color: #334155;
}
.limit-presets button[aria-pressed="true"] {
  border-color: #111827;
  background: #111827;
  color: #ffffff;
}
[data-theme="dark"] .limit-presets button {
  border-radius: 9999px;
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
  color: #cbd5e1;
}
[data-theme="dark"] .limit-presets button:hover:not(:disabled) {
  background: rgba(122, 162, 255, .14);
  border-color: rgba(122, 162, 255, .45);
  color: #ffffff;
}
[data-theme="dark"] .limit-presets button[aria-pressed="true"] {
  background: #2554e6;
  border-color: #5b7cff;
  color: #ffffff;
}
[data-theme="dark"] .image-preview {
  background: radial-gradient(circle, rgba(148, 163, 184, .14) 1px, transparent 1.5px), #0e1627;
  background-size: 1.15rem 1.15rem;
}
[data-theme="dark"] .image-preview[data-has-image] {
  background: repeating-conic-gradient(#162138 0% 25%, #0f172a 0% 50%) center / 1.24rem 1.24rem;
}
[data-theme="dark"] .image-comparison,
[data-theme="dark"] .compress-queue-wrap {
  background: #10182b;
  border-color: rgba(148, 163, 184, .18);
}
[data-theme="dark"] .image-metric,
[data-theme="dark"] .compress-q-item {
  background: #152038;
  border-color: rgba(148, 163, 184, .2);
  color: var(--ink);
}
[data-theme="dark"] .image-metric[aria-pressed="true"],
[data-theme="dark"] .compress-q-item[data-active="true"] {
  background: rgba(51, 73, 199, .26);
  border-color: #6d8bff;
}
[data-theme="dark"] .savings-badge {
  background: rgba(6, 95, 70, .4);
  color: #6ee7b7;
}
[data-theme="dark"] .compress-q-main small.q-done { color: #6ee7b7; }
[data-theme="dark"] .compress-q-main small.q-err { color: #fca5a5; }
