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

.hidden {
  display: none !important;
}

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e4e7ec;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #dc2626;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 20px;
  font-weight: 700;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.dropzone {
  background: var(--card);
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: all 0.15s;
  cursor: pointer;
}
.dropzone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.dropzone-sm {
  padding: 24px 16px;
  margin-bottom: 16px;
}

.dropzone-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.dropzone-title {
  font-size: 17px;
  font-weight: 600;
}

.dropzone-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 18px;
}

.dropzone-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.progress {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  overflow: hidden;
  position: relative;
}
.progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  background: var(--primary);
  border-radius: 3px;
  animation: loading 1s infinite;
}
@keyframes loading {
  0% { left: -40%; }
  100% { left: 100%; }
}

.progress-text {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 28px 0 16px;
}

.section-head h2 {
  font-size: 18px;
}

.count {
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
  position: relative;
}
.card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}
.card.dragging {
  opacity: 0.4;
}
.card.drag-over {
  border-color: var(--primary);
}

.card-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-cover .placeholder {
  font-size: 40px;
  color: #cbd5e1;
}

.card-body {
  padding: 12px 14px;
}

.card-name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.card-actions {
  display: flex;
  gap: 6px;
  padding: 0 14px 12px;
  flex-wrap: wrap;
}

.card-actions .btn {
  flex: 1;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden {
  display: none;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.modal-box {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 360px;
  max-width: calc(100vw - 40px);
}
.modal-box h3 {
  font-size: 16px;
  margin-bottom: 14px;
}
.modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.modal-input:focus {
  border-color: var(--primary);
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 100;
  max-width: 80vw;
}
.toast.hidden {
  display: none;
}

@media (max-width: 640px) {
  .topbar-inner,
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
}
