:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #20324d;
  background: #eef2f7;
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; background: #eef2f7; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.search-results[hidden] { display: none; }

.eyebrow { color: #31569f; font-size: 12px; font-weight: 800; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
.reference-header p, .add-reference p { color: #66758a; }
#poi-search {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #bdc8d6;
  border-radius: 9px;
  background: #fff;
  font-size: 16px;
}
.primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 9px;
  background: #24418c;
  color: #fff;
  font-weight: 750;
}
.reference-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px max(20px, calc((100vw - 1120px) / 2));
  background: #fff;
  border-bottom: 1px solid #dbe2eb;
}
.reference-header h1 { margin: 5px 0 4px; font-size: 28px; }
.reference-header p { margin-bottom: 0; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.secondary-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 8px;
  white-space: nowrap;
  text-decoration: none;
  font-weight: 700;
}
.secondary-button { color: #24418c; border: 1px solid #aebbd0; background: #fff; }
.text-button { border: 0; background: transparent; color: #52647d; }

main { width: min(1120px, calc(100% - 32px)); margin: 24px auto 48px; }
.add-reference {
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(300px, 1.3fr);
  gap: 24px;
  align-items: center;
  padding: 20px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 22px rgba(35, 53, 83, .08);
}
.add-reference h2 { margin-bottom: 4px; font-size: 18px; }
.add-reference p { margin-bottom: 0; font-size: 14px; }
.search-wrap { position: relative; }
.search-results {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #c9d2df;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(27, 42, 68, .18);
}
.search-result {
  display: block;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  background: #fff;
  color: #20324d;
  text-align: left;
}
.search-result:hover, .search-result:focus { background: #f0f5ff; outline: 0; }
.search-result strong, .search-result span { display: block; }
.search-result span { margin-top: 2px; color: #6b798d; font-size: 12px; }

.reference-status { min-height: 24px; margin: 18px 2px 10px; color: #607086; font-size: 14px; }
.reference-status[data-state="error"] { color: #a12424; }
.reference-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.reference-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 18px;
  border: 1px solid #d9e0e9;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(35, 53, 83, .06);
}
.reference-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.reference-card-header > div { min-width: 0; }
.reference-card h2 { margin: 0 0 3px; font-size: 18px; }
.reference-location { overflow-wrap: anywhere; color: #68788e; font-size: 13px; }
.add-image-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #24418c;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.visual-fingerprint {
  display: grid;
  grid-template-columns: minmax(170px, .45fr) minmax(0, 1.55fr);
  gap: 14px;
  align-items: start;
  margin-top: 15px;
  padding: 13px;
  border-radius: 10px;
  background: #f4f7fb;
}
.visual-fingerprint label { display: block; font-size: 13px; font-weight: 800; }
.visual-fingerprint small { display: block; margin-top: 3px; color: #718096; line-height: 1.35; }
.fingerprint-editor { display: flex; min-width: 0; gap: 8px; align-items: flex-start; }
.fingerprint-editor textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid #bdc8d6;
  border-radius: 8px;
  background: #fff;
  color: #20324d;
  line-height: 1.4;
}
.fingerprint-save {
  min-height: 42px;
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: #31569f;
  color: #fff;
  font-weight: 750;
}
.fingerprint-save:disabled { opacity: .55; }
.reference-carousel {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 12px;
  margin-top: 15px;
  padding: 2px 1px 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.reference-image, .collage-tile {
  position: relative;
  flex: 0 0 150px;
  height: 112px;
  overflow: hidden;
  border: 1px solid #d3dbe6;
  border-radius: 10px;
  background: #e9edf3;
  scroll-snap-align: start;
}
.reference-image img, .collage-tile img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.collage-tile img { object-fit: contain; }
.delete-image {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(25, 33, 47, .82);
  color: #fff;
  font-size: 19px;
}
.collage-tile { border-style: dashed; }
.collage-label {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(24, 44, 83, .82);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}
.empty-references { margin-top: 14px; padding: 16px; border-radius: 9px; background: #f4f6f9; color: #718096; font-size: 14px; }
.card-meta { margin-top: 4px; color: #7a8798; font-size: 11px; }

.reference-lightbox {
  width: min(94vw, 1050px);
  max-width: none;
  padding: 44px 14px 14px;
  border: 0;
  border-radius: 14px;
  background: #111826;
  color: #fff;
}
.reference-lightbox::backdrop { background: rgba(4, 9, 18, .86); }
.reference-lightbox img { display: block; max-width: 100%; max-height: 78vh; margin: auto; object-fit: contain; }
.reference-lightbox button { position: absolute; top: 5px; right: 9px; border: 0; background: transparent; color: #fff; font-size: 34px; }
#lightbox-caption { padding-top: 10px; text-align: center; font-size: 13px; color: #d5dce8; }

@media (max-width: 700px) {
  .reference-header { display: block; padding: 20px 16px; }
  .header-actions { margin-top: 14px; justify-content: space-between; }
  main { width: min(100% - 20px, 1120px); margin-top: 10px; }
  .add-reference { grid-template-columns: 1fr; gap: 10px; padding: 15px; }
  .reference-card { padding: 15px; }
  .visual-fingerprint { grid-template-columns: 1fr; gap: 8px; }
  .fingerprint-editor { display: grid; }
  .fingerprint-save { width: 100%; }
  .reference-image, .collage-tile { flex-basis: 132px; height: 100px; }
}
