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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f0f14;
  color: #e0e0e6;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

header h1 {
  font-size: 1.8rem;
  background: linear-gradient(135deg, #ff6b9d, #c084fc, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #888;
  margin-top: 0.4rem;
  font-size: 0.9rem;
}

/* Drop Zone */
.drop-zone {
  max-width: 600px;
  margin: 1.5rem auto;
  border: 2px dashed #3a3a4a;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: #c084fc;
  background: rgba(192, 132, 252, 0.05);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: #888;
}

.drop-zone-content svg {
  color: #666;
}

.drop-zone-content span {
  font-size: 0.8rem;
  color: #555;
}

.file-btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  background: #c084fc;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.2s;
}

.file-btn:hover {
  background: #a855f7;
}

/* Toolbar */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #16161e;
  border-bottom: 1px solid #2a2a3a;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-left label {
  font-size: 0.8rem;
  color: #888;
  white-space: nowrap;
}

.toolbar-left input {
  background: #1e1e2a;
  border: 1px solid #3a3a4a;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  color: #e0e0e6;
  font-size: 0.85rem;
  width: 220px;
}

.toolbar-left input:focus {
  outline: none;
  border-color: #c084fc;
}

.toolbar-center {
  font-size: 0.85rem;
  color: #aaa;
  font-variant-numeric: tabular-nums;
}

.toolbar-right {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  padding: 0.45rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
  background: #c084fc;
  color: #fff;
}
.btn-primary:hover { background: #a855f7; }

.btn-secondary {
  background: #2a2a3a;
  color: #ccc;
}
.btn-secondary:hover { background: #3a3a4a; }

.btn-danger {
  background: #ef4444;
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-ghost {
  background: transparent;
  color: #888;
  border: 1px solid #3a3a4a;
}
.btn-ghost:hover { background: #1e1e2a; }

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  padding: 1rem 1.5rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  aspect-ratio: 9 / 16;
  background: #1a1a24;
}

.card:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.card.selected {
  outline: 3px solid #ef4444;
  outline-offset: -3px;
  opacity: 0.5;
}

.card.selected::after {
  content: "\2715";
  position: absolute;
  top: 6px;
  right: 8px;
  background: #ef4444;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

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

.card .card-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.5rem 0.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size: 0.7rem;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background: #1a1a24;
  border: 1px solid #2a2a3a;
  border-radius: 12px;
  padding: 2rem;
  max-width: 650px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin-bottom: 1rem;
  color: #c084fc;
}

.modal-content h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.9rem;
  color: #aaa;
}

.export-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.info-row {
  display: flex;
  gap: 0.5rem;
  font-size: 0.88rem;
}

.info-row span { color: #888; }
.info-row code {
  background: #2a2a3a;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.82rem;
  user-select: all;
}

.modal-content pre {
  background: #12121a;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.75rem;
  overflow-x: auto;
  max-height: 250px;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-center {
    text-align: center;
  }
  .toolbar-right {
    justify-content: center;
  }
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    padding: 0.8rem;
    gap: 8px;
  }
}
