* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #111;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.topbar {
  display: flex;
  justify-content: center;
  padding: 28px 0 20px;
}

.upload-btn {
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
  transition: background 0.15s ease, transform 0.1s ease;
}
.upload-btn:hover { background: #1d4ed8; }
.upload-btn:active { transform: scale(0.97); }
.upload-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.upload-btn.drag { background: #1d4ed8; box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.18); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  padding: 0 20px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card .preview {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #f2f3f5;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}

.card img,
.card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card .icon-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa1ab;
}
.card .icon-wrap svg { width: 40%; height: 40%; }

.card .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card .action-btn {
  height: 32px;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: background 0.12s ease, opacity 0.12s ease;
}
.card .action-btn svg { width: 15px; height: 15px; }

.card .action-btn.download { background: #2563eb; }
.card .action-btn.download:hover { background: #1d4ed8; }

.card .action-btn.delete { background: #dc2626; }
.card .action-btn.delete:hover { background: #b91c1c; }

.card .action-btn:disabled { opacity: 0.5; cursor: default; }

.card.pending .preview .icon-wrap { display: none; }
.card.pending .actions { visibility: hidden; }

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #d7dce4;
  border-top-color: #2563eb;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card .busy-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.65);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #b0b6bf;
  padding: 60px 0;
}
.empty svg { width: 48px; height: 48px; }
.empty .spinner { margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.6s; }
}
