/* image tools */
.img-hide { display: none !important; }
.img-group { display: grid; gap: 22px; }
.img-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.img-drop { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 22px 16px 16px; border: 2px dashed color-mix(in srgb, #9333ea 35%, var(--border)); border-radius: 18px; background: linear-gradient(180deg, color-mix(in srgb, #9333ea 5%, var(--surface)), var(--surface)); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.img-drop:hover, .img-drop.is-over, .img-drop:focus-within { border-color: #9333ea; background: color-mix(in srgb, #9333ea 9%, var(--surface)); }
.img-drop.is-over { transform: scale(1.01); }
.img-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.img-drop-ic { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: #9333ea; color: #fff; font-size: 1.25rem; box-shadow: 0 10px 22px -12px #9333ea; }
.img-drop b { font-size: .98rem; color: var(--ink); }
.img-drop b u { color: #9333ea; text-underline-offset: 3px; }
.img-drop small { font-size: .78rem; color: var(--muted); }
.img-fname { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-top: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .img-fname { white-space: normal; border-radius: 12px; text-align: center; justify-content: center; } }
.img-fname.is-bad { white-space: normal; border-radius: 12px; background: #fef2f2; color: #b91c1c; text-align: left; }
.img-stage { display: grid; place-items: center; min-height: 160px; padding: 12px; border-radius: 16px; border: 1px solid var(--border); overflow: hidden;
  background: repeating-conic-gradient(#e9ebf1 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.img-stage > canvas, .img-stage > img { display: block; max-width: 100%; max-height: 460px; width: auto; height: auto; border-radius: 6px; box-shadow: 0 10px 30px -14px rgba(16, 24, 40, .45); }
.img-stage-sm { min-height: 0; padding: 6px; width: 88px; height: 88px; border-radius: 12px; }
.img-stage-sm > img { max-height: 74px; box-shadow: none; }
.img-cmp { position: relative; display: inline-block; max-width: 100%; line-height: 0; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px -14px rgba(16, 24, 40, .45); --x: 50%; }
.img-cmp > canvas { display: block; max-width: 100%; max-height: 460px; width: auto; height: auto; }
.img-cmp-a { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--x)); }
.img-cmp-a > canvas, .img-cmp-a > img { display: block; width: 100%; height: 100%; }
.img-cmp::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--x); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); pointer-events: none; }
.img-cmp input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; z-index: 2; }
.img-cmp::before { content: "\2194"; position: absolute; z-index: 1; top: 50%; left: var(--x); width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: #fff; color: #111827; font: 700 18px/34px system-ui, sans-serif; text-align: center; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); pointer-events: none; }
.img-cmp-t { position: absolute; top: 10px; z-index: 1; padding: 3px 9px; border-radius: 999px; background: rgba(15, 23, 42, .65); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.5; letter-spacing: .03em; pointer-events: none; }
.img-cmp-l { left: 10px; } .img-cmp-r { right: 10px; }
.img-stats .stat b { font-size: 1.05rem; }
.img-stats .stat b span { font-size: inherit; color: inherit; }
.img-stats .stat span i { font-style: normal; font-weight: 600; color: var(--ink-2); }
.img-good { color: #16a34a; } .img-warn { color: #b45309; }
.img-dlrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.img-dlrow .btn { background: #9333ea; box-shadow: 0 10px 24px -12px #9333ea; }
.img-dlrow .btn:hover { background: #7e22ce; }
.img-dlrow .btn:disabled { opacity: .55; cursor: progress; transform: none; }
.img-dlname { font-size: .82rem; color: var(--muted); word-break: break-all; }
.img-privacy i { color: #16a34a; margin-right: 3px; }
.img-dot { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 4px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.img-hint { font-size: .85rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.img-hint b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.img-crcv { touch-action: none; user-select: none; cursor: crosshair; }
.img-thumbrow { display: flex; gap: 14px; align-items: center; }
.img-thumb { flex: none; display: grid; place-items: center; width: 110px; height: 110px; padding: 6px; border-radius: 14px; border: 1px solid var(--border); background: repeating-conic-gradient(#e9ebf1 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.img-thumb canvas { max-width: 100%; max-height: 96px; width: auto; height: auto; border-radius: 4px; box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .4); }
.img-thumbrow b { font-size: .92rem; }
.img-btns .btn { flex: 1 1 0; }
.img-presets .chip-link { cursor: pointer; font: inherit; font-size: .88rem; padding: 7px 13px; }
.img-pos { display: grid; grid-template-columns: repeat(3, 44px); gap: 6px; padding: 8px; width: max-content; border-radius: 14px; background: var(--surface-2); }
.img-pos label { position: relative; cursor: pointer; }
.img-pos input { position: absolute; opacity: 0; pointer-events: none; }
.img-pos span { display: grid; place-items: center; height: 32px; border-radius: 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); transition: .15s; }
.img-pos span::after { content: ""; display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.img-pos input:checked + span { background: #9333ea; box-shadow: none; }
.img-pos input:checked + span::after { background: #fff; }
.img-pos input:focus-visible + span { outline: 3px solid var(--ring); }
.img-b64head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.img-b64head > div:last-child { display: grid; gap: 2px; min-width: 0; }
.img-b64head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-b64head span { font-size: .82rem; color: var(--muted); }
.img-b64out { width: 100%; min-height: 150px; resize: vertical; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); font: .78rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.img-empty { display: grid; justify-items: center; gap: 10px; padding: 30px 16px; text-align: center; color: var(--muted); border: 2px dashed var(--border); border-radius: 16px; }
.img-empty i { font-size: 1.6rem; color: #9333ea; }
@media (max-width: 560px) { .img-stats { gap: 8px; } .img-stats .stat { padding: 11px 10px; } .img-stats .stat b { font-size: .9rem; } }
