* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: #0f0f12;
  color: #e8e8e8;
  min-height: 100vh;
}

/* Top Bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: #17171c;
  border-bottom: 1px solid #2a2a35;
}
.topbar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}
.topbar .logo .icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.topbar .actions {
  display: flex; gap: 10px; align-items: center;
}
.topbar .count-badge {
  font-size: 13px; color: #888;
  padding: 4px 12px;
  background: #22222a; border-radius: 20px;
  border: 1px solid #33333d;
}

/* Buttons */
.btn {
  padding: 8px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 500; border: none;
  cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: #22222a; color: #ccc; border: 1px solid #33333d; }
.btn-secondary:hover { background: #2a2a35; color: #fff; }
.btn-danger { background: #2a1515; color: #ef4444; border: 1px solid #5a2020; }
.btn-danger:hover { background: #3a1818; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* Main layout */
.main { display: flex; height: calc(100vh - 57px); }

/* Sidebar */
.sidebar {
  width: 320px; background: #17171c;
  border-right: 1px solid #2a2a35;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-section {
  padding: 20px;
  border-bottom: 1px solid #2a2a35;
}
.sidebar-section h3 {
  font-size: 12px; font-weight: 600; color: #888;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 14px;
}

/* Upload area */
.upload-area {
  border: 2px dashed #33333d; border-radius: 12px;
  padding: 32px 20px; text-align: center;
  cursor: pointer; transition: all 0.2s; background: #1a1a22;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: #f59e0b; background: #1e1c14;
}
.upload-area .upload-icon { font-size: 36px; margin-bottom: 10px; }
.upload-area .upload-text { font-size: 14px; color: #ccc; margin-bottom: 4px; }
.upload-area .upload-hint { font-size: 12px; color: #666; }
#fileInput { display: none; }

/* Settings */
.setting-row { margin-bottom: 16px; }
.setting-label {
  font-size: 13px; color: #bbb; margin-bottom: 7px;
  display: flex; justify-content: space-between; align-items: center;
}
.setting-label .val { font-size: 12px; color: #f59e0b; font-weight: 600; }

select, input[type="color"], input[type="range"], input[type="text"], input[type="number"] {
  width: 100%; background: #22222a;
  border: 1px solid #33333d; border-radius: 8px;
  color: #e8e8e8; font-size: 13px; padding: 7px 10px;
  outline: none; transition: border-color 0.2s;
}
select:focus, input[type="text"]:focus, input[type="number"]:focus {
  border-color: #f59e0b;
}
input[type="color"] { height: 36px; padding: 3px 6px; cursor: pointer; }
input[type="range"] { padding: 0; height: 6px; cursor: pointer; accent-color: #f59e0b; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button { opacity: 1; }

.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] { width: 52px; flex-shrink: 0; }
.color-row input[type="text"] { flex: 1; }

/* Toggle */
.toggle-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; font-size: 13px; color: #bbb;
}
.toggle { position: relative; width: 40px; height: 22px; }
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #33333d; border-radius: 11px;
  cursor: pointer; transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: #888; border-radius: 50%; transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: #f59e0b; }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: #fff; }

/* Progress */
.export-progress { display: none; margin-top: 12px; }
.progress-bar { height: 6px; background: #22222a; border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #f59e0b, #f97316); border-radius: 3px; width: 0%; transition: width 0.3s; }
.progress-text { font-size: 12px; color: #888; text-align: center; }

/* Grid area */
.grid-area {
  flex: 1; overflow-y: auto; padding: 24px; background: #0f0f12;
}

/* Empty state */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; color: #555; text-align: center;
}
.empty-state .empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h2 { font-size: 20px; color: #777; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: #555; }

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.photo-card {
  background: #17171c; border-radius: 12px;
  overflow: hidden; border: 1px solid #2a2a35;
  transition: transform 0.2s, border-color 0.2s;
}
.photo-card:hover { transform: translateY(-3px); border-color: #444450; }
.photo-card .card-thumb {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  display: block; background: #22222a; cursor: pointer;
}
.photo-card .card-info { padding: 10px 14px; }
.photo-card .card-name {
  font-size: 13px; color: #ccc;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-bottom: 4px;
}
.photo-card .card-meta { font-size: 12px; color: #666; margin-bottom: 8px; }
.photo-card .card-date {
  font-size: 12px; color: #f59e0b;
  display: flex; align-items: center; gap: 4px; margin-bottom: 10px;
}
.photo-card .card-date.no-exif { color: #ef4444; }
.photo-card .card-actions { display: flex; gap: 8px; }
.card-btn {
  flex: 1; padding: 6px 0; border-radius: 6px;
  font-size: 12px; border: none; cursor: pointer;
  transition: all 0.2s; text-align: center;
}
.card-btn-preview { background: #22222a; color: #ccc; border: 1px solid #33333d; }
.card-btn-preview:hover { background: #2a2a35; color: #fff; }
.card-btn-download { background: linear-gradient(135deg, #1a3a1a, #1e4a1e); color: #4ade80; border: 1px solid #2a5a2a; }
.card-btn-download:hover { background: #2a4a2a; }
.card-btn-remove { background: #2a1515; color: #ef4444; border: 1px solid #3a2020; }
.card-btn-remove:hover { background: #351818; }

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.85); z-index: 1000;
  align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #17171c; border-radius: 16px;
  border: 1px solid #2a2a35;
  max-width: 90vw; max-height: 90vh;
  overflow: hidden; display: flex; flex-direction: column;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid #2a2a35;
  font-size: 15px; font-weight: 600; color: #fff;
}
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: #2a2a35; border: none; color: #aaa;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: #3a3a45; color: #fff; }
.modal-body { overflow: auto; padding: 16px; }
#previewCanvas { display: block; max-width: 100%; max-height: 70vh; border-radius: 8px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #17171c; }
::-webkit-scrollbar-thumb { background: #33333d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444450; }

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #22222a; border: 1px solid #33333d;
  color: #e8e8e8; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; z-index: 9999; transition: transform 0.3s;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: #2a5a2a; color: #4ade80; }
.toast.error { border-color: #5a2020; color: #ef4444; }

/* Status dot */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-green { background: #4ade80; }
.dot-yellow { background: #f59e0b; }
.dot-red { background: #ef4444; }

/* Size input row */
.size-row { display: flex; gap: 8px; align-items: center; }
.size-row span { color: #666; font-size: 13px; flex-shrink: 0; }
.size-row input { text-align: center; }
