:root {
  color-scheme: light;
  --ink: #10181d;
  --muted: #627078;
  --line: #dce2e5;
  --surface: #ffffff;
  --canvas: #f3f5f4;
  --accent: #c87913;
  --accent-dark: #9e5d0c;
  --danger: #a52a2a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}

a { color: inherit; }

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 56px;
}

.site-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
}

.search-intro {
  padding: 52px 0 48px;
}

.hero {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.7rem, 5vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.052em;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  letter-spacing: -0.03em;
}

.lede {
  max-width: 630px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.index-stat {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.index-stat strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.search-panel {
  width: min(560px, 100%);
  margin: 30px auto 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(16, 24, 29, 0.07);
}

.search-panel-heading {
  margin-bottom: 18px;
}

.search-panel-heading h2 {
  margin-bottom: 5px;
  font-size: 1.35rem;
}

.search-panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.dropzone {
  position: relative;
  min-height: 126px;
  display: grid;
  place-items: center;
  border: 1.5px dashed #b8c2c7;
  border-radius: 10px;
  background: #fafbfa;
  transition: border-color 150ms ease, background 150ms ease, opacity 150ms ease;
}

.dropzone[hidden] { display: none; }

.dropzone.is-dragging {
  border-color: var(--accent);
  background: #fff9ef;
}

.dropzone.is-processing { opacity: 0.65; }

.file-input:focus-visible + .dropzone {
  outline: 3px solid rgba(200, 121, 19, 0.25);
  outline-offset: 3px;
}

.dropzone label {
  width: 100%;
  min-height: 126px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px;
  text-align: center;
  cursor: pointer;
}

.dropzone label strong {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
}

.dropzone label:hover strong { background: #27343a; }

.dropzone span,
.result-body span { color: var(--muted); }

.crop-stage {
  position: relative;
  padding: 12px 54px 12px 12px;
  align-items: center;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfa;
}

.crop-stage:not([hidden]) { display: grid; }

.crop-stage canvas {
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 8px;
}

.selected-face-details {
  display: grid;
  justify-items: start;
  gap: 5px;
}

.selected-face-details span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.crop-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.button:hover { background: #27343a; }
.button:disabled { cursor: wait; opacity: 0.58; }

.change-photo {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.change-photo:hover { border-color: #aab6bb; background: #f3f5f4; }
.change-photo:focus-visible { outline: 3px solid rgba(200, 121, 19, 0.25); outline-offset: 2px; }
.change-photo img { width: 18px; height: 18px; }

.status {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.status:empty { display: none; }
.status.is-error { color: var(--danger); }

.results-section { padding-top: 48px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.section-heading h2 { margin-bottom: 0; }
.section-heading > span { color: var(--muted); }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}

.result-card {
  min-width: 0;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  cursor: pointer;
}

.result-card:hover { border-color: #aab6bb; }

.result-card > img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  background: #e8ebeb;
}

.result-body {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.result-body strong { font-variant-numeric: tabular-nums; }
.result-platform { display: flex; align-items: center; gap: 6px; }
.source-icon { width: 16px; height: 16px; border-radius: 3px; }
.result-title { overflow-wrap: anywhere; }

.match-warning {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #dfc98e;
  border-radius: 10px;
  color: #674d12;
  background: #fff9e9;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 42px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .search-intro {
    padding: 44px 0 42px;
  }

  .hero { max-width: 720px; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 22px, 1160px); }
  .site-header { min-height: 56px; }
  .search-intro { padding: 32px 0 34px; }
  h1 { margin-bottom: 14px; font-size: clamp(2.25rem, 11vw, 3rem); }
  .lede { font-size: 0.95rem; line-height: 1.55; }
  .index-stat { margin-top: 14px; }
  .search-panel { margin-top: 22px; padding: 17px; }
  .search-panel-heading { margin-bottom: 14px; }
  .search-panel-heading h2 { font-size: 1.2rem; }
  .dropzone,
  .dropzone label { min-height: 104px; }
  .dropzone label { padding: 16px; }
  .section-heading { align-items: start; flex-direction: column; }
  .crop-stage { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; }
  .crop-stage canvas { width: 76px; height: 76px; }
  .crop-actions { align-items: stretch; flex-direction: column; gap: 2px; }
}
