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

#top-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 9999;
  display: none;
  background: #111;
  transition: opacity 0.4s;
}
#top-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3a8eff, #6ec6ff);
  transition: width 0.3s ease-out;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px #3a8eff88;
}
@keyframes progress-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
#top-progress-bar.loading {
  width: 35% !important;
  transition: none;
  background: linear-gradient(90deg, #1a5ccc 0%, #3a8eff 40%, #6ec6ff 60%, #1a5ccc 100%);
  background-size: 200% 100%;
  animation: progress-shimmer 1.4s linear infinite;
}

/* ── Loading overlay ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
}
#loading-overlay.vis { opacity: 1; }

#loading-box {
  background: #141414;
  border: 1px solid #222;
  padding: 28px 36px 24px;
  width: 340px;
}

#loading-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
#loading-title {
  font-size: 13px;
  font-weight: 600;
  color: #bbb;
}
#loading-photo-count {
  font-size: 11px;
  color: #3a8eff;
  font-variant-numeric: tabular-nums;
}

#loading-bar-wrap {
  height: 2px;
  background: #1e1e1e;
  margin-bottom: 20px;
}
#loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3a8eff, #6ec6ff);
  width: 0%;
  transition: width 0.3s ease-out;
}

#loading-steps {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}
.loading-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #191919;
}
.loading-step:last-child { border-bottom: none; }

.ls-icon {
  width: 14px;
  font-size: 11px;
  flex-shrink: 0;
  color: #2a2a2a;
  text-align: center;
  line-height: 1;
}
.ls-label { flex: 1; font-size: 12px; color: #444; }
.ls-count  { font-size: 11px; color: #2e2e2e; font-variant-numeric: tabular-nums; }

.loading-step.ls-active .ls-icon  { color: #3a8eff; }
.loading-step.ls-active .ls-label { color: #aaa; }
.loading-step.ls-active .ls-count { color: #3a8eff; }
.loading-step.ls-done   .ls-icon  { color: #2d6b3a; }
.loading-step.ls-done   .ls-label { color: #3a3a3a; }
.loading-step.ls-done   .ls-count { color: #2e2e2e; }

@keyframes ls-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}
.loading-step.ls-active .ls-icon { animation: ls-pulse 1.2s ease-in-out infinite; }

#loading-skip {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid #1e1e1e;
  color: #333;
  font-size: 11px;
  padding: 5px;
  cursor: pointer;
  text-align: center;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}
#loading-skip:hover { color: #777; border-color: #333; }

body {
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── App layout ── */
#app { display: flex; flex: 1; overflow: hidden; }

#sidebar {
  width: 156px;
  flex-shrink: 0;
  background: #111;
  border-right: 1px solid #1e1e1e;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
}

#main { flex: 1; overflow-y: auto; scrollbar-gutter: stable; }

#reanalysis-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #1a1a1a;
  border-bottom: 1px solid #222;
  font-size: 12px;
  color: #555;
}
#reanalysis-prompt span { flex: 1; }
#reanalysis-prompt button {
  background: none;
  border: 1px solid #2a2a2a;
  color: #555;
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
}
#reanalysis-prompt #reanalysis-yes { color: #888; border-color: #333; }
#reanalysis-prompt #reanalysis-yes:hover { color: #ccc; border-color: #555; }
#reanalysis-prompt #reanalysis-no:hover { color: #aaa; }
body.sim-active #sidebar { display: none; }

/* ── Sim top bar ── */
#sim-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: #111;
  border-bottom: 1px solid #2a0808;
  padding: 0 16px;
  height: 44px;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
body.sim-active #sim-topbar { display: flex; }
#sim-topbar-back {
  background: transparent;
  border: 1px solid #333;
  color: #aaa;
  font-size: 13px;
  padding: 4px 12px;
  cursor: pointer;
  flex-shrink: 0;
}
#sim-topbar-back:hover { border-color: #555; color: #eee; }
#sim-topbar-reanalyze {
  background: transparent;
  border: 1px solid #333;
  color: #777;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  flex-shrink: 0;
}
#sim-topbar-reanalyze:hover { border-color: #555; color: #aaa; }
#sim-topbar-stats {
  flex: 1;
  font-size: 12px;
  color: #555;
  text-align: center;
}
#sim-topbar-stats b { color: #fca5a5; }
#sim-topbar-undo {
  background: transparent;
  border: 1px solid #444;
  color: #888;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  flex-shrink: 0;
  display: none;
}
#sim-topbar-undo:hover { border-color: #666; color: #bbb; }
#sim-topbar-upto {
  background: #7f1d1d;
  border: none;
  color: #fca5a5;
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  flex-shrink: 0;
}
#sim-topbar-upto:hover { background: #991b1b; }
#sim-topbar-upto:disabled { background: #2a2a2a; color: #444; cursor: not-allowed; }
#sim-topbar-del {
  background: #c0392b;
  border: none;
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 600;
}
#sim-topbar-del:hover { background: #e74c3c; }
#sim-topbar-del:disabled { background: #2a2a2a; color: #444; cursor: not-allowed; }

.sb-section {
  padding: 12px 0;
  border-bottom: 1px solid #1a1a1a;
}
.sb-section:last-child { border-bottom: none; }

.sb-label {
  font-size: 10px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 7px;
}

.sb-btn-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}
.sb-btn-wrap .sb-btn { text-align: center; }

/* Category buttons: same look as .loc-city (location tree). */
#f-cat-btns .sb-btn {
  display: flex;
  align-items: center;
  text-align: left;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 11px;
  color: #888;
  line-height: 1.2;
  margin: 0;
  user-select: none;
  transition: color 0.12s, background 0.12s;
}
#f-cat-btns .sb-btn:hover { color: #ccc; background: #1a1a1a; }
#f-cat-btns .sb-btn.active { color: #7aaeff; background: transparent; }

/* English: one category per row (full-width labels). */
#f-cat-btns.sb-cat-en {
  display: flex;
  flex-direction: column;
  grid-template-columns: unset;
  gap: 0;
}
#f-cat-btns.sb-cat-en .sb-btn {
  width: 100%;
  white-space: normal;
}

.sb-btn {
  padding: 3px 9px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: #888;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.5;
}
.sb-btn:hover { color: #ccc; background: #1e1e1e; }
.sb-btn.active { background: #1e3a5f; color: #7aaeff; }
.sb-btn.sim-btn { background: #7f1d1d; color: #fff; }
.sb-btn.sim-btn:hover { background: #991b1b; color: #fff; }
.sb-btn.sim-btn.active { background: #dc2626; color: #fff; }

.sb-star-filter-btn {
  flex-shrink: 0;
  width: 25px;
  min-width: 25px;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #c9a227;
  border: none;
  color: #2a2208;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, box-shadow 0.15s;
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
}
.sb-star-filter-btn:hover {
  background: #d4ae2e;
  color: #1a1504;
}
.sb-star-filter-btn.active {
  background: #e8c040;
  box-shadow: inset 0 0 0 2px #f5d76e;
  color: #1a1300;
}
.sb-btn.ai-btn { background: #1a4a1a; color: #fff; }
.sb-btn.ai-btn:hover { background: #1f5c1f; color: #fff; }

/* User widget (header top-right) */
#user-widget {
  position: relative;
  display: flex;
  align-items: center;
}
#settings-btn:hover { color: #ccc !important; border-color: #444 !important; }

#user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px;
  min-width: 200px;
  z-index: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
#user-dropdown.open { display: block; }
.user-dd-divider { height: 1px; background: #2a2a2a; margin-bottom: 8px; }
.user-dd-item {
  display: block;
  padding: 6px 8px;
  font-size: 12px;
  color: #888;
  text-decoration: none;
  border-radius: 5px;
}
.user-dd-item:hover { background: #252525; color: #bbb; }
#f-starred { color: #a07820; }
#f-starred.active { background: #78450a; color: #f5c518; }


#sort-select {
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
}
#sort-select:hover { color: #bbb; }
#sidebar .range-slider { width: 100%; }

.user-dd-section-label { font-size: 10px; color: #444; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.setting-hint { font-size: 10px; color: #555; margin-top: 5px; line-height: 1.4; min-height: 14px; }
.sp-col-btns { display: flex; gap: 4px; }
.sp-col-btn {
  flex: 1;
  padding: 5px 0;
  border: 1px solid #2a2a2a;
  border-radius: 5px;
  background: transparent;
  color: #555;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
}
.sp-col-btn:hover { border-color: #444; color: #aaa; }
.sp-col-btn.active { background: #1e3a5f; border-color: #4f8ef7; color: #7aaeff; }
.lb-toggle-btn {
  flex: 1; padding: 4px 0; background: #1a1a1a; border: 1px solid #333;
  color: #555; font-size: 11px; cursor: pointer;
}
.lb-toggle-btn:hover { border-color: #444; color: #aaa; }
.lb-toggle-btn.active { background: #1e3a5f; border-color: #4f8ef7; color: #7aaeff; }

/* ── Location tree ── */
.loc-city {
  display: flex;
  align-items: center;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 11px;
  color: #888;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
  user-select: none;
}
.loc-city:hover { color: #ccc; background: #1a1a1a; }
.loc-city.active { color: #7aaeff; }
.loc-areas {
  margin: 1px 0 3px 8px;
  padding-left: 8px;
  border-left: 1px solid #222;
}
.loc-area {
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 10px;
  color: #777;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
  user-select: none;
}
.loc-area:hover { color: #aaa; background: #1a1a1a; }
.loc-area.active { color: #7aaeff; }

/* ── Calendar ── */
#cal-wrap { user-select: none; background: #161616; border-radius: 4px; padding: 6px; }
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.cal-nav {
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  font-size: 15px;
  padding: 0 2px;
  line-height: 1;
}
.cal-nav:hover { color: #aaa; }
.cal-month-label { font-size: 11px; color: #999; font-weight: 500; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.cal-dow {
  font-size: 9px;
  color: #555;
  text-align: center;
  padding-bottom: 2px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #2a2a2a;
  border-radius: 3px;
  cursor: default;
  position: relative;
  transition: background 0.1s, color 0.1s;
}
.cal-day.has-photos { color: #c0c0c0; cursor: pointer; font-weight: 500; }
.cal-day.has-photos::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #4f8ef7;
  opacity: 0.7;
}
.cal-day.has-photos:hover { color: #fff; background: #1e1e1e; }
.cal-day.in-range { background: #152a47; color: #7aaeff; }
.cal-day.in-range::after { opacity: 0; }
.cal-day.selected { background: #1e3a5f; color: #fff; }
.cal-day.selected::after { opacity: 0; }
.cal-day.today.has-photos { color: #fff; }
#cal-clear {
  display: none;
  width: 100%;
  margin-top: 6px;
  padding: 3px 0;
  background: none;
  border: none;
  color: #4f8ef7;
  font-size: 10px;
  cursor: pointer;
  text-align: center;
}
#cal-clear:hover { color: #7aaeff; }

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #161616;
  border-bottom: 1px solid #2a2a2a;
  padding: 14px 24px 14px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

header h1 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  margin-right: 8px;
}

#count {
  font-size: 13px;
  color: #666;
  white-space: nowrap;
}

/* ── Folder selector ── */
.folder-selector {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
  position: relative;
  user-select: none;
}
.folder-selector:hover { background: #222; }
.folder-selector:hover .folder-chevron { color: #aaa; }

#folder-name {
  font-size: 14px;
  font-weight: 400;
  color: #888;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}
.folder-selector:hover #folder-name { color: #ccc; }
#folder-name.has-folder { color: #e0e0e0; }
.folder-selector:hover #folder-name.has-folder { color: #fff; }

.folder-chevron {
  font-size: 11px;
  color: #444;
  transition: transform 0.15s, color 0.15s;
  flex-shrink: 0;
}
.folder-chevron.open { transform: rotate(90deg); color: #888; }

.folder-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #1c1c1c;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 5px;
  min-width: 300px;
  z-index: 300;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
}
.folder-dropdown.open { display: block; }

.folder-dd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #aaa;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  overflow: hidden;
}
.folder-dd-item:hover { background: #2a2a2a; color: #fff; }
.folder-dd-item.browse { color: #4f8ef7; }
.folder-dd-item.browse:hover { background: #1a2a4a; color: #7aaeff; }
.folder-dd-item.active { color: #fff; }
.folder-dd-item .dd-icon { font-size: 14px; flex-shrink: 0; }
.folder-dd-item .dd-name { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.folder-dd-item .dd-meta { font-size: 11px; color: #555; flex-shrink: 0; }
.folder-dd-item .dd-remove { font-size: 13px; color: #444; flex-shrink: 0; line-height: 1; padding: 0 2px; transition: color 0.1s; }
.folder-dd-item .dd-remove:hover { color: #f66; }
.folder-dd-item .dd-remove:hover { color: #f66; }
.folder-dd-item .dd-path { font-size: 11px; color: #555; overflow: hidden; text-overflow: ellipsis; }
.folder-dd-divider { height: 1px; background: #2a2a2a; margin: 4px 0; }
.folder-dd-label { font-size: 11px; color: #444; padding: 5px 10px 3px; }

/* Recent projects: align count/date columns without separator dot */
.recent-meta-row--full {
  display: grid;
  grid-template-columns: 8.75em minmax(0, max-content);
  align-items: baseline;
  column-gap: 0.35em;
}
.recent-meta-row--single {
  display: inline;
}
.recent-meta-cell--count {
  justify-self: end;
  min-width: 0;
}
.recent-meta-cell--date {
  justify-self: start;
  min-width: 0;
  width: 5em;
  text-align: right;
}

.recent-photo-count {
  display: inline-grid;
  align-items: baseline;
  vertical-align: baseline;
}
.recent-photo-count--zh {
  grid-template-columns: auto auto;
  column-gap: 0;
}
.recent-photo-count--en {
  grid-template-columns: minmax(4.5ch, max-content) minmax(3.75em, max-content);
  column-gap: 0.28em;
}
.recent-photo-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.recent-photo-count--en .recent-photo-label {
  text-align: left;
}
.recent-meta-date {
  white-space: nowrap;
}
.recent-project-meta {
  color: #444;
  font-size: 11px;
  flex-shrink: 0;
  margin-left: 10px;
  display: block;
  white-space: nowrap;
}
.folder-dd-item .dd-meta {
  display: block;
  min-width: 11.5em;
}

/* ── Filters ── */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 5px 10px;
}

.filter-group label {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

/* ── Custom multi-select dropdown ── */
.multi-select {
  position: relative;
}
.ms-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: border-color 0.15s, color 0.15s;
}
.ms-trigger:hover { border-color: #555; }
.ms-trigger.has-selection { border-color: #4f8ef7; color: #4f8ef7; }
.ms-trigger .ms-chevron { font-size: 9px; color: #555; margin-left: 2px; }
.ms-trigger.has-selection .ms-chevron { color: #4f8ef7; }

.ms-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background: #1c1c1c;
  border: 1px solid #383838;
  border-radius: 8px;
  padding: 5px;
  min-width: 130px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6);
}
.ms-dropdown.open { display: block; }

.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: #aaa;
  user-select: none;
}
.ms-option:hover { background: #2a2a2a; color: #ddd; }
.ms-option.checked { color: #fff; }
.ms-option input[type=checkbox] {
  accent-color: #4f8ef7;
  cursor: pointer;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

select, input[type=range] {
  background: transparent;
  border: none;
  color: #ddd;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

select option { background: #222; }

/* Dual-handle score range slider */
.range-slider {
  position: relative;
  width: 100px;
  height: 20px;
}
.range-slider input[type=range] {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
  padding: 0;
}
.range-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4f8ef7;
  cursor: pointer;
  pointer-events: all;
  border: 1px solid #1a1a2e;
  box-shadow: 0 0 0 1px #4f8ef7;
  margin-top: -4px;
}
.range-slider input[type=range]::-webkit-slider-runnable-track {
  height: 2px;
  background: transparent;
}
.range-slider-track {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 2px;
  background: #333;
  border-radius: 1px;
  pointer-events: none;
}
.range-slider-fill {
  position: absolute;
  height: 100%;
  background: #4f8ef7;
  border-radius: 1px;
}

.range-val {
  font-size: 12px;
  color: #4f8ef7;
  min-width: 28px;
  text-align: center;
  white-space: nowrap;
}

.toggle-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #222;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.toggle-btn.active {
  background: #4f8ef7;
  border-color: #4f8ef7;
  color: #fff;
}
.toggle-btn:hover { border-color: #555; }
.toggle-btn.sim-btn {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fca5a5;
}
.toggle-btn.sim-btn:hover {
  background: #991b1b;
  border-color: #b91c1c;
}
.toggle-btn.sim-btn.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}
#select-mode-btn.active {
  background: #4f8ef7;
  border-color: #4f8ef7;
  color: #fff;
}
#f-starred { color: #888; }
#f-starred.active {
  background: #78450a;
  border-color: #a05c0e;
  color: #f5c518;
}
.toggle-btn.warn-btn.active {
  background: #b45309;
  border-color: #b45309;
  color: #fef3c7;
}
.toggle-btn.danger-btn.active {
  background: #1f2937;
  border-color: #4b5563;
  color: #9ca3af;
}

/* Button group (radio-style) — same outer height as .toggle-btn */
.btn-group {
  display: flex;
  gap: 0;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 2px;
  align-items: center;
}
.btn-group .toggle-btn {
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  padding: 3px 9px;
  font-size: 12px;
  color: #888;
}
.btn-group .toggle-btn.active {
  background: #4f8ef7;
  border-color: #4f8ef7;
  color: #fff;
}
.btn-group .toggle-btn:hover:not(.active) { background: #2a2a2a; border-color: #444; }

#sort-select {
  padding: 5px 8px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

/* ── Grid ── */
#grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  background: #0f0f0f;
  /* Card typography — scaled down when fixed column count is higher (narrower cells) */
  --card-fn: 11px;
  --card-exif: 12px;
  --card-score: 12px;
  --card-desc: 11px;
  --card-info-pt: 10px;
  --card-info-px: 4px;
  --card-score-pad-y: 1px;
  --card-score-pad-x: 6px;
  --card-top-mb: 5px;
  --card-btn-size: 26px;
  --card-btn-font-del: 13px;
  --card-btn-font-star: 14px;
  --card-btn-inset: 8px;
  --card-top-gap: 3px;
}
#grid[data-cols="3"] {
  --card-fn: 10px;
  --card-exif: 10px;
  --card-score: 11px;
  --card-desc: 10px;
  --card-info-pt: 8px;
  --card-info-px: 3px;
  --card-score-pad-x: 5px;
  --card-top-mb: 4px;
  --card-btn-size: 24px;
  --card-btn-font-del: 12px;
  --card-btn-font-star: 13px;
  --card-btn-inset: 6px;
  --card-top-gap: 2px;
}
#grid[data-cols="4"] {
  --card-fn: 9px;
  --card-exif: 9px;
  --card-score: 10px;
  --card-desc: 9px;
  --card-info-pt: 7px;
  --card-info-px: 2px;
  --card-score-pad-x: 4px;
  --card-top-mb: 3px;
  --card-btn-size: 22px;
  --card-btn-font-del: 11px;
  --card-btn-font-star: 12px;
  --card-btn-inset: 5px;
  --card-top-gap: 2px;
}
#grid[data-cols="5"] {
  --card-fn: 8px;
  --card-exif: 8px;
  --card-score: 9px;
  --card-desc: 8px;
  --card-info-pt: 6px;
  --card-info-px: 2px;
  --card-score-pad-x: 3px;
  --card-top-mb: 3px;
  --card-btn-size: 20px;
  --card-btn-font-del: 10px;
  --card-btn-font-star: 11px;
  --card-btn-inset: 4px;
  --card-top-gap: 2px;
}

/* ── Card ── */
.card {
  position: relative;
  cursor: pointer;
  background: #0f0f0f;
  transition: opacity 0.15s;
  min-width: 0; /* grid: allow 1fr columns to stay equal; long filenames clip in .filename */
  container-type: inline-size;
  container-name: sk-card;
}
.card:hover { opacity: 0.88; }
.card.selected { background: #0d1f3c; }
.card.selected .card-info { background: #0d1f3c; }
.card.selected::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px #4f8ef7;
  pointer-events: none;
  z-index: 10;
}

.card-img-wrap {
  position: relative;
  overflow: hidden;
  background: #141414;
  height: 0;
  padding-bottom: 66.667%; /* 2/3 of width → always 3:2 */
}

.card img {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;       /* required for object-fit to work on both axes */
  object-fit: cover;  /* crop: portrait fills the 3:2 box, excess cropped */
  object-position: center center;
  display: block;
}

/* Portrait orientation badge — bottom-left, crop mode only */
body:not(.card-fit) .card-img-wrap[data-portrait]::after {
  content: '';
  position: absolute;
  bottom: 7px;
  left: 7px;
  width: 7px;
  height: 11px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 1.5px;
  pointer-events: none;
  z-index: 5;
}

/* fit mode: portrait shown in full, black bars on sides */
body.card-fit .card img {
  object-fit: contain;
  object-position: center center;
}
body.card-fit .card-img-wrap {
  background: #000;
}

.card-info {
  padding: var(--card-info-pt) var(--card-info-px) 0;
}

.card-top {
  display: flex;
  align-items: center;
  margin-bottom: var(--card-top-mb);
  column-gap: var(--card-top-gap);
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}

.card-top .filename {
  flex: 1 1 0;
  min-width: 0;
  font-size: var(--card-fn);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #444;
  font-family: monospace;
}

.card-category {
  flex-shrink: 0;
  margin-left: auto;
  font-size: var(--card-fn);
  font-weight: 600;
  color: #ccc;
}

.score {
  font-size: var(--card-score);
  font-weight: 700;
  padding: var(--card-score-pad-y) var(--card-score-pad-x);
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: auto;
}
.score.high { background: #1a3a1a; color: #4caf50; }
.score.mid  { background: #2a2a1a; color: #ffc107; }
.score.low  { background: #2a1a1a; color: #f44336; }

.desc {
  font-size: var(--card-desc);
  color: #555;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tile typography by card width (auto grid ~260px+ per track; exif shrinks so title keeps space) */
@container sk-card (max-width: 400px) {
  .card {
    --card-fn: 10px;
    --card-exif: 10px;
    --card-score: 11px;
    --card-desc: 10px;
    --card-info-pt: 8px;
    --card-info-px: 3px;
    --card-score-pad-x: 5px;
    --card-top-mb: 4px;
    --card-btn-size: 24px;
    --card-btn-font-del: 12px;
    --card-btn-font-star: 13px;
    --card-btn-inset: 6px;
    --card-top-gap: 2px;
  }
}
@container sk-card (max-width: 340px) {
  .card {
    --card-fn: 9px;
    --card-exif: 9px;
    --card-score: 10px;
    --card-desc: 9px;
    --card-info-pt: 7px;
    --card-info-px: 2px;
    --card-score-pad-x: 4px;
    --card-top-mb: 3px;
    --card-btn-size: 22px;
    --card-btn-font-del: 11px;
    --card-btn-font-star: 12px;
    --card-btn-inset: 5px;
    --card-top-gap: 2px;
  }
}
@container sk-card (max-width: 290px) {
  .card {
    --card-fn: 8px;
    --card-exif: 8px;
    --card-score: 9px;
    --card-desc: 8px;
    --card-info-pt: 6px;
    --card-info-px: 2px;
    --card-score-pad-x: 3px;
    --card-top-mb: 3px;
    --card-btn-size: 20px;
    --card-btn-font-del: 10px;
    --card-btn-font-star: 11px;
    --card-btn-inset: 4px;
    --card-top-gap: 2px;
  }
}
@container sk-card (max-width: 240px) {
  .card {
    --card-fn: 7px;
    --card-exif: 7px;
    --card-score: 8px;
    --card-desc: 7px;
    --card-info-pt: 5px;
    --card-info-px: 2px;
    --card-score-pad-x: 3px;
    --card-top-mb: 2px;
    --card-btn-size: 18px;
    --card-btn-font-del: 9px;
    --card-btn-font-star: 10px;
    --card-btn-inset: 4px;
    --card-top-gap: 2px;
  }
}

/* Delete button on hover */
.del-btn {
  position: absolute;
  top: var(--card-btn-inset);
  right: var(--card-btn-inset);
  width: var(--card-btn-size);
  height: var(--card-btn-size);
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #ff6666;
  font-size: var(--card-btn-font-del);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
}
.card:hover .del-btn { opacity: 1; }
.del-btn:hover { background: rgba(220,50,50,0.8); color: #fff; }

.star-btn {
  position: absolute;
  top: var(--card-btn-inset);
  left: var(--card-btn-inset);
  width: var(--card-btn-size);
  height: var(--card-btn-size);
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #555;
  font-size: var(--card-btn-font-star);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
}
.star-btn.starred { opacity: 1; color: #f5c518; }
.card:hover .star-btn { opacity: 1; }
.star-btn:hover { color: #f5c518; }

/* ── Lightbox ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.92);
  justify-content: center;
  align-items: center;
}
#lightbox.open { display: flex; }

#lb-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 0;
}

#lb-img-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}
@keyframes lbFadeIn { from { opacity: 0.3 } to { opacity: 1 } }
.lb-loaded { animation: lbFadeIn 0.12s ease-out; }

@keyframes cardDelete {
  0%   { opacity: 1; transform: scale(1); }
  60%  { opacity: 0.6; transform: scale(0.92); }
  100% { opacity: 0; transform: scale(0.82); }
}
.card.deleting {
  animation: cardDelete 0.2s cubic-bezier(0.4, 0, 0.8, 1) forwards;
  pointer-events: none;
}

@keyframes lbDelete {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9); }
}
.lb-deleting { animation: lbDelete 0.15s ease-in forwards; }

#lb-img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

#lb-grid-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  display: none;
}

#lb-histogram {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 180px;
  height: 80px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0.85;
}

#lb-magnifier {
  position: fixed;
  border-radius: 50% !important;
  border: 2px solid rgba(255,255,255,0.45);
  pointer-events: none;
  display: none;
  box-shadow: 0 4px 24px rgba(0,0,0,0.7), inset 0 0 0 1px rgba(0,0,0,0.3);
  z-index: 1500;
}

#lb-info {
  color: #aaa;
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

#lb-exif {
  font-size: 12px;
  color: #666;
  font-family: monospace;
  text-align: center;
  letter-spacing: 0.02em;
}

#lb-close {
  position: absolute;
  top: -40px;
  right: 0;
  font-size: 24px;
  color: #888;
  cursor: pointer;
  background: none;
  border: none;
}
#lb-close:hover { color: #fff; }

#lb-star {
  padding: 7px 20px;
  background: #333;
  color: #888;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#lb-star:hover { color: #f5c518; }
#lb-star.starred { background: #78450a; color: #f5c518; }

#lb-del {
  padding: 7px 20px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
#lb-del:hover { background: #e74c3c; }

#lb-actions .lb-sim-btn { display: none; }
#lb-actions.sim-open .lb-sim-btn { display: inline-flex; }
#lb-actions.sim-open #lb-del { display: none !important; }
#lb-actions.sim-open #lb-star { display: none; }
.lb-sim-btn {
  padding: 7px 28px;
  border-radius: 7px;
  border: 1px solid #444;
  background: #222;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.lb-sim-btn.keep.active  { background: #1a4a1a; border-color: #27ae60; color: #4caf50; }
.lb-sim-btn.del.active   { background: #4a1a1a; border-color: #c0392b; color: #e74c3c; }
.lb-sim-btn:not(.active):hover { border-color: #666; color: #ccc; }

/* ── Color swatches ── */
#f-color-btns { display: flex; }
.color-swatch {
  flex: 1;
  height: 16px;
  border-radius: 0;
  cursor: pointer;
  border: none;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s;
}
.color-swatch.active { outline-color: #fff; }

/* ── Search box ── */
#sb-search-section { position: relative; }
#sb-search-section input {
  width: 100%;
  padding: 5px 8px;
  background: #1a1a1a;
  border: 1px solid #1a1a1a;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  color: #ccc;
  font-size: 12px;
  outline: none;
}
#sb-search-section input:focus { border-color: #444; }
#sb-search-section input::placeholder { color: #444; }

/* ── Batch delete bar ── */
#bottom-stack {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
#bottom-stack > * { pointer-events: auto; }
#batch-bar {
  background: #222;
  border: 1px solid #444;
  padding: 12px 20px;
  display: none;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  font-size: 13px;
}
#batch-bar.visible { display: flex; }

#batch-del-btn {
  padding: 6px 16px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}
#batch-del-btn:hover { background: #e74c3c; }

#batch-star-btn {
  padding: 6px 16px;
  background: #333;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}
#batch-star-btn:hover { background: #444; color: #fff; }
#batch-star-btn.starred { background: #78450a; color: #f5c518; border-color: #a05c0e; }
#batch-star-btn.starred:hover { background: #8a5010; }

#batch-clear-btn {
  padding: 6px 12px;
  background: #333;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  margin-left: 5px;
  font-size: 11px;
  font-family: inherit;
  line-height: 1.4;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: rgba(255,255,255,0.7);
  vertical-align: middle;
  pointer-events: none;
}

/* Empty state */
#empty {
  display: none;
  text-align: center;
  padding: 80px 20px;
  color: #444;
  font-size: 15px;
}

/* Confirm dialog */
#confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
#confirm-overlay.open { display: flex; }

#confirm-box {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px;
  max-width: 340px;
  width: 90%;
  text-align: center;
}
#confirm-box h3 { font-size: 16px; margin-bottom: 10px; }
#confirm-box p { font-size: 13px; color: #888; margin-bottom: 20px; line-height: 1.5; }
.confirm-btns { display: flex; gap: 10px; justify-content: center; }
.confirm-btns button {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
}
#confirm-yes { background: #c0392b; color: #fff; }
#confirm-yes:hover { background: #e74c3c; }
#confirm-no { background: #333; color: #aaa; border: 1px solid #444; }

/* ── GPS search popup ── */
#gps-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 3000;
  justify-content: center;
  align-items: center;
}
#gps-overlay.open { display: flex; }
#gps-box {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 22px 24px;
  width: min(480px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#gps-box h3 { font-size: 14px; color: #ddd; }
#gps-search-row { display: flex; gap: 8px; }
#gps-input {
  flex: 1;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 7px;
  color: #eee;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
}
#gps-input:focus { border-color: #555; }
#gps-search-btn {
  padding: 8px 16px;
  background: #2a5298;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
#gps-search-btn:hover { background: #3a63b8; }
#gps-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}
.gps-result-item {
  padding: 9px 12px;
  background: #252525;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #bbb;
  line-height: 1.4;
}
.gps-result-item:hover { background: #2a3a50; border-color: #3a5a80; color: #ddd; }
.gps-result-item .gps-result-name { font-size: 13px; color: #eee; margin-bottom: 2px; }
.gps-result-coords { font-size: 11px; color: #666; margin-top: 2px; }
#gps-status { font-size: 12px; color: #666; min-height: 16px; }
#gps-cancel {
  align-self: flex-end;
  padding: 6px 16px;
  background: #333;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
}

/* lb-gps button */
#lb-gps {
  padding: 6px 14px;
  background: #1a3a1a;
  color: #7fd87f;
  border: 1px solid #2a6a2a;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}
#lb-gps:hover { background: #244a24; }

/* ── Export popup ── */
#export-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
#export-overlay.open { display: flex; }
#export-box {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 360px;
  width: 90%;
}
#export-box h3 { font-size: 15px; margin-bottom: 10px; color: #eee; }
#exp-intro { font-size: 12px; color: #666; line-height: 1.6; margin-bottom: 18px; }
.export-option { margin-bottom: 16px; }
.export-option label { display: block; font-size: 12px; color: #888; margin-bottom: 6px; }
.export-toggle-group { display: flex; gap: 6px; }
.export-toggle-group button {
  flex: 1;
  padding: 7px 0;
  border-radius: 7px;
  border: 1px solid #444;
  background: #2a2a2a;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.export-toggle-group button.active {
  background: #1a3a5c;
  border-color: #3a7bd5;
  color: #7fb8ff;
}
.export-footer { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }
.export-footer button {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
}
#export-cancel { background: #333; color: #aaa; border: 1px solid #444; }
#export-confirm { background: #2a5298; color: #fff; }
#export-confirm:hover { background: #3a63b8; }

/* ── Undo toast ── */
#undo-toast {
  background: #1a1a1a;
  border: 1px solid #444;
  padding: 8px 14px;
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  white-space: nowrap;
}
#undo-toast.visible { display: flex; }
#undo-toast-btn {
  background: transparent;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}
#undo-toast-btn:hover { color: #fff; }
#undo-toast-close {
  background: transparent;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 14px;
  padding: 0 0 0 4px;
  line-height: 1;
}
#undo-toast-close:hover { color: #aaa; }

/* ── Feedback popup ── */
#feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
#feedback-overlay.open { display: flex; }
#feedback-box {
  background: #1e1e1e;
  border: 1px solid #333;
  padding: 24px;
  width: 360px;
  max-width: 90vw;
}
#feedback-box h3 { font-size: 14px; color: #ccc; margin-bottom: 14px; }
#feedback-email {
  width: 100%; padding: 7px 10px; background: #141414;
  border: 1px solid #333; color: #ccc; font-size: 13px;
  margin-bottom: 8px; box-sizing: border-box;
}
#feedback-text {
  width: 100%; height: 100px; padding: 8px 10px; background: #141414;
  border: 1px solid #333; color: #ccc; font-size: 13px;
  resize: vertical; box-sizing: border-box; margin-bottom: 12px;
  font-family: inherit;
}
#feedback-email:focus, #feedback-text:focus { outline: none; border-color: #555; }
#feedback-submit {
  width: 100%; padding: 8px; background: #333; border: none;
  color: #ccc; font-size: 13px; cursor: pointer;
}
#feedback-submit:hover { background: #444; color: #fff; }
#feedback-submit:disabled { background: #222; color: #444; cursor: not-allowed; }
#feedback-msg { font-size: 12px; color: #666; margin-bottom: 10px; min-height: 16px; }

/* ── Undo confirm popup ── */
#undo-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
#undo-overlay.open { display: flex; }
#undo-box {
  background: #1e1e1e;
  border: 1px solid #333;
  padding: 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
}
#undo-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin-bottom: 16px;
  display: none;
  background: #0a0a0a;
}
#undo-msg { font-size: 13px; color: #aaa; margin-bottom: 20px; }
#undo-yes { background: #2a5298; color: #fff; }
#undo-yes:hover { background: #3a62a8; }
#undo-no  { background: #333; color: #aaa; border: 1px solid #444 !important; }

/* ── Similar panel ── */
#similar-panel {
  display: none;
  padding: 20px;
}
#similar-panel.active { display: block; }

.sim-loading {
  text-align: center;
  padding: 80px 20px;
  color: #666;
}
.sim-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #333;
  border-top-color: #dc2626;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sim analysis progress ── */
.sim-progress-wrap {
  max-width: 380px;
  margin: 60px auto;
  padding: 28px 36px 24px;
  background: #141414;
  border: 1px solid #222;
}
.sp-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sp-title  { font-size: 13px; font-weight: 600; color: #bbb; }
.sp-overall { font-size: 11px; color: #dc2626; font-variant-numeric: tabular-nums; }
.sp-bar-wrap { height: 2px; background: #1e1e1e; margin-bottom: 20px; }
.sp-bar { height: 100%; background: linear-gradient(90deg, #dc2626, #e87070); width: 0%; transition: width 0.3s ease-out; }
.sp-steps { display: flex; flex-direction: column; }
.sp-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #191919;
}
.sp-step:last-child { border-bottom: none; }
.sp-icon  { width: 14px; font-size: 11px; flex-shrink: 0; color: #2a2a2a; text-align: center; line-height: 1; }
.sp-label { flex: 1; font-size: 12px; color: #444; }
.sp-count { font-size: 11px; color: #2e2e2e; font-variant-numeric: tabular-nums; }
.sp-step.sp-active .sp-icon  { color: #dc2626; animation: ls-pulse 1.2s ease-in-out infinite; }
.sp-step.sp-active .sp-label { color: #aaa; }
.sp-step.sp-active .sp-count { color: #dc2626; }
.sp-step.sp-done   .sp-icon  { color: #2d6b3a; }
.sp-step.sp-done   .sp-label { color: #3a3a3a; }
.sp-step.sp-done   .sp-count { color: #2e2e2e; }

.sim-error {
  text-align: center;
  padding: 60px 20px;
  color: #f44336;
  font-size: 14px;
  line-height: 1.7;
}

.sim-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.sim-stat {
  background: #1e1e2e;
  border: 1px solid #2e2e4e;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: #a0a0c0;
}
.sim-stat b { color: #fca5a5; }

.sim-reanalyze {
  padding: 5px 12px;
  background: #222;
  border: 1px solid #444;
  border-radius: 7px;
  color: #888;
  font-size: 12px;
  cursor: pointer;
}
.sim-reanalyze:hover { border-color: #666; color: #ccc; }

.sim-no-dupes {
  text-align: center;
  padding: 80px 20px;
  color: #444;
  font-size: 15px;
}

.sim-group {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}

.sim-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: #202020;
  cursor: pointer;
  user-select: none;
}
.sim-group-head:hover { background: #262626; }

.sim-badge {
  background: #7f1d1d;
  color: #fca5a5;
  border-radius: 5px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.sim-gtitle {
  flex: 1;
  font-size: 12px;
  color: #888;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sim-gcnt {
  font-size: 12px;
  color: #555;
  flex-shrink: 0;
}
.sim-chevron {
  color: #555;
  font-size: 13px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.sim-group.collapsed .sim-chevron { transform: rotate(-90deg); }
.sim-group.collapsed .sim-photos { display: none; }

.sim-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
}

/* sim-card: green = keep, red = del */
.sim-card {
  width: 190px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.sim-card.keep {
  border-color: #27ae60;
  background: #081810;
}
.sim-card.keep:hover { border-color: #2ecc71; }
.sim-card.del {
  border-color: #7f1d1d;
  background: #1a0808;
}
.sim-card.del:hover { border-color: #c0392b; }

.sim-thumb {
  position: relative;
  width: 100%;
  height: 150px;
  background: #0a0a0a;
  overflow: hidden;
}
.sim-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sim-thumb-zoom {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  border-radius: 50% !important;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
}
.sim-thumb:hover .sim-thumb-zoom { opacity: 1; }

.sim-badge-state {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.sim-card.keep .sim-badge-state { background: #27ae60; color: #fff; }
.sim-card.del  .sim-badge-state { background: #7f1d1d; color: #fca5a5; }
.sim-eye-badge {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 11px;
  background: rgba(0,0,0,0.6);
  padding: 2px 5px;
}

.sim-card-info {
  padding: 7px 10px 9px;
}
.sim-fname {
  font-size: 10px;
  color: #555;
  font-family: monospace;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sim-sharp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sim-sharp-wrap {
  flex: 1;
  height: 3px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}
.sim-sharp-fill {
  height: 100%;
  background: #dc2626;
  border-radius: 2px;
  transition: width 0.3s;
}
.sim-card.keep .sim-sharp-fill { background: #27ae60; }
.sim-sharp-score {
  font-size: 10px;
  color: #555;
  min-width: 28px;
  text-align: right;
  white-space: nowrap;
}

/* Trash action bar */
/* ── Sim settings popup ── */
#sim-settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
#sim-settings-overlay.open { display: flex; }
#sim-settings-box {
  background: #1a1a1a;
  border: 1px solid #333;
  padding: 28px 32px;
  width: 340px;
}
#sim-settings-box h3 {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 24px;
}
.sim-param-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}
.sim-param-label b { color: #e0e0e0; font-size: 13px; }
#sim-settings-box input[type=range] {
  width: 100%;
  display: block;
  accent-color: #e0e0e0;
  margin-bottom: 6px;
}
.sim-param-hint {
  font-size: 11px;
  color: #555;
  margin-bottom: 24px;
}
#sim-settings-box .sim-reset-btn {
  padding: 9px 16px;
  background: #555;
  color: #ccc;
  border: none;
  font-size: 13px;
  cursor: pointer;
}
#sim-settings-box .sim-reset-btn:hover { background: #666; color: #fff; }
#sim-settings-box .sim-start-btn {
  flex: 1;
  padding: 9px;
  background: #e0e0e0;
  color: #111;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#sim-settings-box .sim-start-btn:hover { background: #fff; }

