:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f2330;
  --border: #2a2f3c;
  --text: #e6e8ee;
  --muted: #9aa3b2;
  --accent: #5b8cff;
  --accent-2: #3f6fe0;
  --danger: #ff5d5d;
  --danger-2: #d83b3b;
  --good: #43d39e;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 96px;
}

.muted { color: var(--muted); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }

/* Header */
.topbar {
  padding: 28px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #141824, var(--bg));
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 28px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
}
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -0.5px; }
.tagline { margin: 10px 0 0; color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Controls */
.controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
button {
  font: inherit; cursor: pointer; border-radius: 10px;
  padding: 10px 16px; border: 1px solid transparent;
  transition: background .15s, opacity .15s;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-2); }
button.secondary { background: var(--panel-2); color: var(--text); border-color: var(--border); }
button.secondary:hover:not(:disabled) { background: #262b3a; }
button.danger { background: var(--danger); color: #fff; }
button.danger:hover:not(:disabled) { background: var(--danger-2); }

.slider { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--muted); font-size: 14px; }
.slider input[type=range] { accent-color: var(--accent); }

/* Notices */
.notice { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); }
.notice.warn { background: #2a2113; border-color: #5a4a1f; color: #f0d28a; }

/* Progress */
.progress { margin-top: 20px; }
.progress .bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress .fill { height: 100%; width: calc(var(--frac, 0) * 1%); background: var(--accent); transition: width .2s; }
.progress .fill.indeterminate {
  width: 35%;
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}
.progress .muted { margin-top: 8px; font-size: 14px; }

/* Summary */
.summary {
  margin-top: 20px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 15px;
}
.summary strong { color: var(--good); }

.empty {
  margin-top: 40px; text-align: center; color: var(--muted);
  padding: 40px; border: 1px dashed var(--border); border-radius: var(--radius);
}

/* Results */
.results { margin-top: 20px; display: flex; flex-direction: column; gap: 18px; }
.group {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.group-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--panel-2); font-size: 14px;
}
.badge {
  background: var(--accent); color: #fff; font-weight: 600;
  padding: 2px 10px; border-radius: 99px; font-size: 12px;
}

.grid {
  display: grid; gap: 14px; padding: 16px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.card {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .15s, opacity .15s;
}
.card.marked { border-color: var(--danger); opacity: .72; }
.thumb { position: relative; aspect-ratio: 4 / 3; background: #0b0d12; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.best-tag {
  position: absolute; top: 8px; left: 8px;
  background: var(--good); color: #07261c; font-weight: 700; font-size: 11px;
  padding: 2px 8px; border-radius: 99px;
}
.meta { padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.meta .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toggle {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 10px 12px; border-top: 1px solid var(--border); font-size: 13px;
}
.toggle input { accent-color: var(--danger); width: 16px; height: 16px; }

/* Sticky delete bar */
.delete-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  background: var(--panel); border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0,0,0,.3);
}
.delete-bar strong { color: var(--danger); }

.foot { padding: 20px 24px; font-size: 13px; border-top: 1px solid var(--border); }
