:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #0a0a0a;
  --muted: #71717a;
  --faint: #a1a1aa;
  --line: rgba(10, 10, 10, 0.08);
  --soft: #f4f4f5;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --err: #dc2626;
  --err-soft: #fef2f2;
  --zone-h: clamp(98px, 24vh, 150px);
  --row-h: 60px;
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  overflow: clip;
  display: grid;
  place-items: center;
  padding: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(14px, 3.4vh, 22px);
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.04), 0 24px 60px -24px rgba(10, 10, 10, 0.18);
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: clamp(10px, 2.4vh, 16px);
}

.card__title { font-size: 16px; font-weight: 640; letter-spacing: -0.01em; }
.card__sub { margin-top: 2px; font-size: 13px; color: var(--muted); }

.card__count {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  background: var(--soft);
  border-radius: 999px;
  padding: 4px 10px;
  font-variant-numeric: tabular-nums;
}

/* the slot holds the drop zone or the live row and animates its own height between the two */
.slot {
  position: relative;
  height: var(--zone-h);
}

.zone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 16px;
  background: #fafafa;
  cursor: pointer;
  transition: background-color 0.25s;
}

.zone__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.zone:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }

.zone__border {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.zone__border rect {
  fill: none;
  stroke: #d4d4d8;
  stroke-width: 1.5;
  stroke-dasharray: 6 6;
  transition: stroke 0.25s;
}

.zone.is-over { background: var(--accent-soft); }
.zone.is-over .zone__border rect { stroke: var(--accent); }

.zone__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px -2px rgba(10, 10, 10, 0.12);
  margin-bottom: 4px;
}

.zone__icon svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.zone.is-over .zone__icon svg { stroke: var(--accent); }

.zone__text { font-size: 14px; font-weight: 520; }
.zone__text b { font-weight: 620; color: var(--accent); }
.zone__hint { font-size: 12px; color: var(--faint); }

@media (hover: hover) {
  .zone:hover { background: #f6f6f7; }
  .zone.is-over:hover { background: var(--accent-soft); }
}

/* one upload, one row */
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--row-h);
  padding: 0 10px 0 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  list-style: none;
  overflow: hidden;
}

.row--live { position: absolute; inset: 0; height: auto; }

.row.is-done { background: var(--ok-soft); border-color: rgba(21, 128, 61, 0.16); }
.row.is-error { background: var(--err-soft); border-color: rgba(220, 38, 38, 0.18); }

.ficon { position: relative; flex: none; width: 30px; height: 36px; }
.ficon svg { width: 100%; height: 100%; fill: #fff; stroke: #52525b; stroke-width: 1.3; stroke-linejoin: round; }
.ficon b {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--tag, #52525b);
  border-radius: 3px;
  padding: 1px 3px;
}

.row__body { flex: 1; min-width: 0; }

.row__top, .row__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}

.row__name { font-size: 13.5px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; }
.row__pct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bar {
  position: relative;
  height: 4px;
  margin: 6px 0 5px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.bar i {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.row.is-done .bar i { background: var(--ok); }
.row.is-error .bar i { background: var(--err); }

.row__meta { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row.is-error .row__speed { color: var(--err); }
.row.is-done .row__speed { color: var(--ok); }

.row__btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.row__btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.row__btn--retry {
  width: auto;
  gap: 5px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #fff;
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: var(--err);
  font-size: 12px;
  font-weight: 600;
}

.row__ok { flex: none; width: 30px; height: 30px; display: grid; place-items: center; }
.row__ok svg { width: 18px; height: 18px; fill: none; stroke: var(--ok); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: hover) {
  .row__btn:hover { background: var(--soft); color: var(--ink); }
  .row__btn--retry:hover { background: #fff5f5; color: var(--err); }
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin-top: 10px;
  min-height: calc(var(--row-h) * 2 + 8px);
  margin-bottom: clamp(10px, 2.4vh, 16px);
}

.card__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: clamp(10px, 2vh, 14px);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.meter { flex: 1; height: 4px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.meter i { display: block; height: 100%; width: 32%; background: var(--ink); border-radius: inherit; }
.card__used { font-variant-numeric: tabular-nums; }

/* the fake pointer and the file it drags */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

.ghost__arrow {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #0a0a0a;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.chip {
  position: absolute;
  left: 10px;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 8px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 14px 30px -10px rgba(10, 10, 10, 0.3);
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 560;
  transform-origin: 0 0;
}

.chip .ficon { width: 22px; height: 27px; }
.chip .ficon b { font-size: 6px; bottom: 4px; }

@media (max-width: 420px) {
  :root { --row-h: 54px; }
  .card { border-radius: 18px; }
  .card__sub { font-size: 12px; }
  .row { gap: 10px; }
  .row__name { font-size: 12.5px; }
  .row__meta { font-size: 10.5px; }
}

@media (max-height: 460px) {
  :root { --row-h: 50px; --zone-h: 88px; }
  .card__sub { display: none; }
  .zone__hint { display: none; }
  .zone__icon { width: 30px; height: 30px; margin-bottom: 0; }
  .bar { margin: 4px 0 3px; }
}
