:root {
  --ground: #f4f5f2;
  --surface: #ffffff;
  --ink: #16202b;
  --muted: #5b6875;
  --line: #d9ddd8;
  --accent: #0f7b6c;
  --accent-ink: #ffffff;
  --accent-soft: #dcefeb;
  --check: #eef0ec;
  --bad: #b42318;
  --radius: 12px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #11161c;
    --surface: #182029;
    --ink: #e6ecf1;
    --muted: #97a4b1;
    --line: #2a3440;
    --accent: #3fc1a9;
    --accent-ink: #0b1a17;
    --accent-soft: #16302c;
    --check: #1e2731;
    --bad: #f97066;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.05;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.arrow { color: var(--accent); }

.lede {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* The drop zone sits on a transparency checkerboard: the one place where
   JPG and PNG genuinely differ, used as the backdrop for the whole job. */
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: repeating-conic-gradient(var(--check) 0 25%, var(--surface) 0 50%) 0 0 / 18px 18px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop.over { box-shadow: 0 0 0 4px var(--accent-soft); }
.drop:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }

.drop-title, .drop-sub {
  background: var(--surface);
  border-radius: 6px;
  padding: 2px 10px;
}
.drop-title { font-size: 1.3rem; font-weight: 650; }
.drop-sub { color: var(--muted); }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.status {
  margin: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bar-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }

.thumb {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-conic-gradient(var(--check) 0 25%, var(--surface) 0 50%) 0 0 / 10px 10px;
}
.thumb img { display: block; max-width: 100%; max-height: 100%; }

.meta { min-width: 0; }
.name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.row.err .sub { color: var(--bad); font-family: var(--sans); font-size: 0.9rem; }
.row.busy .sub { animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.45; } }

.foot {
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.foot p { margin: 0 0 4px; max-width: 65ch; text-wrap: pretty; }

@media (max-width: 520px) {
  .wrap { padding-top: 36px; }
  .row { grid-template-columns: 56px 1fr; }
  .thumb { width: 56px; height: 56px; }
  .act { grid-column: 1 / -1; }
  .act .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
