:root {
  --bg: #0a0c11;
  --bg-2: #0e1117;
  --panel: rgba(22, 27, 36, 0.72);
  --panel-solid: #161b24;
  --panel-2: rgba(31, 37, 48, 0.7);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f7;
  --muted: #98a1b3;
  --accent: #6d8bff;
  --accent-2: #8b5cf6;
  --accent-3: #22d3ee;
  --accent-grad: linear-gradient(135deg, #6d8bff 0%, #8b5cf6 55%, #22d3ee 120%);
  --match: #34d399;
  --danger: #fb7185;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  --glow: 0 10px 30px rgba(109, 139, 255, 0.35);
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win, even over flex containers below. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
}

/* Media never forces the layout wider than the viewport. */
img { max-width: 100%; }

/* Animated aurora background */
body::before {
  content: "";
  position: fixed;
  inset: -20% -10% -10% -10%;
  z-index: -2;
  background:
    radial-gradient(40% 50% at 18% 18%, rgba(109, 139, 255, 0.28), transparent 60%),
    radial-gradient(38% 45% at 82% 22%, rgba(139, 92, 246, 0.26), transparent 60%),
    radial-gradient(45% 50% at 65% 88%, rgba(34, 211, 238, 0.18), transparent 60%),
    radial-gradient(40% 45% at 25% 80%, rgba(251, 113, 133, 0.12), transparent 60%);
  filter: blur(20px);
  animation: drift 24s ease-in-out infinite alternate;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 12, 17, 0.2), rgba(10, 12, 17, 0.85)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 1%, 0) scale(1.02); }
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: linear-gradient(180deg, rgba(14, 17, 23, 0.85), rgba(14, 17, 23, 0.55));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-logo {
  height: 92px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 10px rgba(109, 139, 255, 0.35));
  transition: transform 0.2s ease, filter 0.2s ease;
}
.brand-logo:hover {
  transform: translateY(-1px) scale(1.02);
  filter: drop-shadow(0 4px 16px rgba(139, 92, 246, 0.5));
}
.status {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  align-items: start;
}

/* Glass panel */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 96px;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(109, 139, 255, 0.45), transparent 40%, transparent 60%, rgba(34, 211, 238, 0.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.dropzone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
  background: rgba(255, 255, 255, 0.02);
}
.dropzone:hover, .dropzone.dragover {
  border-color: transparent;
  background: rgba(109, 139, 255, 0.08);
  transform: translateY(-2px);
  box-shadow: var(--glow);
}
.dropzone:hover .dropzone-icon, .dropzone.dragover .dropzone-icon {
  transform: translateY(-4px);
}
.dropzone-icon {
  font-size: 38px;
  line-height: 1;
  display: inline-block;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: transform 0.25s ease;
}
.dropzone p { margin: 8px 0; font-size: 14px; }

.controls { margin-top: 20px; }
.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.thr-value {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(109, 139, 255, 0.16);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 6px;
}

/* Custom range slider */
input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 0 12px rgba(109, 139, 255, 0.7);
  transition: transform 0.12s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 0 12px rgba(109, 139, 255, 0.7);
}

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Selection tray */
.selection-tray {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.small-btn { padding: 4px 10px; font-size: 12px; }
.tray-faces {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.tray-face {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid transparent;
  background-image: linear-gradient(var(--panel-solid), var(--panel-solid)), var(--accent-grad);
  background-origin: border-box;
  background-clip: content-box, border-box;
  cursor: pointer;
  transition: transform 0.12s;
}
.tray-face:hover { transform: scale(1.08); border-color: var(--danger); }
.selection-tray .btn { width: 100%; }

.results { min-height: 200px; }

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeInUp 0.4s ease both;
}
.results-info { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
.results-actions { display: flex; align-items: center; gap: 12px; }
.query-thumb {
  width: 46px; height: 46px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid transparent;
  background-image: linear-gradient(var(--panel-solid), var(--panel-solid)), var(--accent-grad);
  background-origin: border-box;
  background-clip: content-box, border-box;
  box-shadow: 0 0 14px rgba(109, 139, 255, 0.4);
}

.btn {
  position: relative;
  background: var(--accent-grad);
  background-size: 160% 160%;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background-position 0.4s;
  box-shadow: 0 6px 18px rgba(109, 139, 255, 0.3);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--glow); background-position: 100% 0; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }
.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.2s, border-color 0.2s;
  animation: cardIn 0.45s ease both;
}
.card:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(109, 139, 255, 0.4);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
}

.card-imgwrap { position: relative; width: 100%; aspect-ratio: 1 / 1; background: var(--panel-2); overflow: hidden; }
.card-imgwrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.card:hover .card-imgwrap img { transform: scale(1.07); }
.card-imgwrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(7, 9, 14, 0.55));
  opacity: 0;
  transition: opacity 0.25s;
}
.card:hover .card-imgwrap::after { opacity: 1; }

/* Result selection */
.card-check {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 3;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(10, 12, 17, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s, transform 0.12s;
}
.card:hover .card-check { opacity: 1; }
.card-check:hover { transform: scale(1.12); }
.card-check::after {
  content: "";
  position: absolute;
  left: 8px; top: 4px;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.12s;
}
.card.selected .card-check {
  opacity: 1;
  background: var(--accent-grad);
  border-color: transparent;
}
.card.selected .card-check::after { opacity: 1; }
.card.selected {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--accent), 0 14px 34px rgba(109, 139, 255, 0.45);
}

.sel-count {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.overlay-layer { position: absolute; inset: 0; }
.face-btn {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(109, 139, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.face-btn:hover { background: rgba(109, 139, 255, 0.32); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 139, 255, 0.3); }
.face-btn.matched { border-color: var(--match); background: rgba(52, 211, 153, 0.18); box-shadow: 0 0 14px rgba(52, 211, 153, 0.4); }
.face-btn.selected { border-color: var(--accent); background: rgba(109, 139, 255, 0.42); border-width: 3px; }

.people-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(52, 211, 153, 0.95);
  color: #06210f;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-meta {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sim {
  font-weight: 700;
  font-size: 13px;
  color: var(--match);
  font-variant-numeric: tabular-nums;
}
.fname {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 80px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.015);
}
.empty .empty-icon {
  font-size: 52px;
  display: block;
  margin-bottom: 14px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: floaty 3.5s ease-in-out infinite;
}
.empty h2 { margin: 0 0 6px; color: var(--text); font-weight: 700; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* Modal */
.modal, .lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
  animation: fadeIn 0.2s ease both;
}
.modal-card {
  background: linear-gradient(180deg, rgba(28, 33, 44, 0.96), rgba(20, 24, 32, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 740px;
  width: 100%;
  box-shadow: var(--shadow);
  animation: popIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.modal-card h2 { margin: 0 0 4px; font-size: 22px; }
.face-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.face-option {
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--panel-2);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.face-option:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--glow); }
.face-option.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(109, 139, 255, 0.5), var(--glow); }
.face-option img { width: 100%; height: 112px; object-fit: cover; display: block; }
.face-option .score { font-size: 11px; color: var(--muted); padding: 5px 6px; text-align: center; }

.face-option, .person-option { position: relative; }
.face-option.blurry, .person-option.blurry { border-color: rgba(245, 158, 66, 0.55); }
.face-option.blurry img, .person-option.blurry .person-stack { opacity: 0.6; }
.blur-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #1a1205;
  background: #f59e42;
  padding: 2px 6px;
  border-radius: 999px;
  pointer-events: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* People grouping (multi-image upload) */
.people-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin: 20px 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}
.person-option {
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
  cursor: pointer;
  padding: 16px 8px 12px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.person-option:hover { border-color: var(--accent); transform: translateY(-3px); }
.person-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(109, 139, 255, 0.5), var(--glow);
}
.person-stack {
  position: relative;
  height: 110px;
  margin-bottom: 10px;
}
.person-stack img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid var(--panel-solid);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%)
    rotate(calc((var(--i) - (var(--n) - 1) / 2) * 7deg))
    translateX(calc((var(--i) - (var(--n) - 1) / 2) * 12px));
  animation: dropIn 0.45s ease both;
  animation-delay: calc(var(--i) * 0.08s);
  z-index: var(--i);
}
@keyframes dropIn {
  from { opacity: 0; transform: translate(-50%, -170%) rotate(0deg); }
}
.person-label {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* Lightbox */
.lightbox { flex-direction: column; gap: 16px; }
.lightbox-stage { position: relative; max-width: 92vw; max-height: 80vh; animation: popIn 0.3s ease both; }
.lightbox-stage img { max-width: 92vw; max-height: 80vh; display: block; border-radius: 12px; box-shadow: var(--shadow); }
.lightbox-close {
  position: absolute;
  top: 18px; right: 26px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: white;
  font-size: 26px;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, transform 0.15s;
}
.lightbox-close:hover { background: rgba(251, 113, 133, 0.3); transform: rotate(90deg); }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-strong);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.15s, opacity 0.15s;
}
.lightbox-nav.prev { left: 18px; }
.lightbox-nav.next { right: 18px; }
.lightbox-nav:hover { background: rgba(109, 139, 255, 0.35); transform: translateY(-50%) scale(1.08); }
.lightbox-nav:disabled { opacity: 0.25; cursor: default; }
.lightbox-hint { color: var(--muted); font-size: 13px; }
.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(31, 37, 48, 0.96), rgba(22, 27, 36, 0.96));
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 60;
  animation: fadeInUp 0.3s ease both;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94); } }

/* Scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(109, 139, 255, 0.5); background-clip: content-box; }

@media (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
    padding: 20px 16px 48px;
    gap: 20px;
  }
  .panel { position: static; }
  .topbar { padding: 12px 18px; }
  .brand-logo { height: 64px; }
}

@media (max-width: 560px) {
  .topbar {
    padding: 10px 14px;
    gap: 10px;
  }
  .brand { gap: 8px; }
  .brand-logo { height: auto; width: min(184px, 52vw); }
  .status {
    font-size: 11px;
    padding: 4px 9px;
    text-align: right;
  }

  main { padding: 16px 12px 44px; gap: 16px; }
  .panel { padding: 16px; }
  .dropzone { padding: 24px 14px; }

  /* Two columns that always fit the viewport (no horizontal overflow). */
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .results-bar { padding: 10px 12px; gap: 10px; }
  .results-info { font-size: 14px; gap: 8px; }
  .results-actions { gap: 8px; flex-wrap: wrap; }
  .results-actions .btn { padding: 9px 12px; font-size: 12px; }

  .modal, .lightbox { padding: 14px; }
  .modal-card { padding: 20px 18px; }
  .modal-card h2 { font-size: 19px; }
  .face-options { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
  .people-options { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 12px; }

  .empty { padding: 56px 16px; }
  .lightbox-close { top: 10px; right: 12px; width: 40px; height: 40px; font-size: 24px; }
  .lightbox-nav { width: 42px; height: 42px; font-size: 26px; }
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, .logo, .empty .empty-icon { animation: none; }
  .card, .results-bar, .toast { animation: none; }
}
