:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #111827;
  --panel-strong: #172033;
  --line: #2b3b56;
  --text: #f8fafc;
  --muted: #a9b8ce;
  --accent: #93c5fd;
  --accent-strong: #60a5fa;
  --danger: #ff9a8d;
  --warning: #ffd479;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(96, 165, 250, 0.16), transparent 31rem),
    linear-gradient(145deg, #080d18, var(--bg));
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.page-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 72px 0;
}

.intro {
  max-width: 760px;
}

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

h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 5.8rem);
  font-weight: 760;
  letter-spacing: -0.065em;
  line-height: 0.95;
}

.box-search {
  width: min(100%, 610px);
  margin-top: 34px;
}

.box-search > label,
.upload-label {
  display: block;
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.search-control {
  display: flex;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(17, 24, 39, 0.9);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.2);
}

.search-control:focus-within {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.13);
}

.search-control input {
  min-width: 0;
  flex: 1;
  padding: 12px 13px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  text-transform: uppercase;
}

.search-control input::placeholder {
  color: #71819a;
  text-transform: none;
}

.search-control button {
  min-width: 108px;
  padding: 11px 20px;
  border: 0;
  border-radius: 12px;
  color: #07111f;
  background: var(--accent);
  font-weight: 800;
}

.search-control button:hover:not(:disabled) {
  background: #bfdbfe;
}

.search-message {
  min-height: 20px;
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-message.working {
  color: var(--accent-strong);
}

.search-message.error {
  color: var(--danger);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  gap: clamp(30px, 6vw, 76px);
  align-items: center;
  margin-bottom: 24px;
}

.upload-card,
.result-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 24, 39, 0.88);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
}

.upload-card {
  display: flex;
  min-height: 330px;
  flex-direction: column;
  gap: 18px;
}

.upload-label {
  margin: 1px 4px -7px;
}

.result-card {
  min-height: 310px;
}

.drop-zone {
  display: flex;
  min-height: 225px;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 24px 20px;
  border: 1.5px dashed #3b506e;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent-strong);
  background: rgba(96, 165, 250, 0.08);
  transform: translateY(-2px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-zone strong {
  color: var(--text);
  font-size: 1.12rem;
}

.drop-zone small {
  margin-top: 10px;
}

.upload-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 7px;
  place-items: center;
  border-radius: 18px;
  color: #0a1628;
  background: var(--accent);
  font-size: 1.65rem;
  font-weight: 700;
}

.preview-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #080d18;
}

.file-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel-strong);
}

.file-meta div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.file-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta span {
  color: var(--muted);
  font-size: 0.82rem;
}

.text-button {
  border: 0;
  color: var(--accent-strong);
  background: transparent;
}

.form-message {
  min-height: 20px;
  margin: 0 2px;
  color: var(--danger);
  font-size: 0.88rem;
}

.form-message.working {
  color: var(--accent-strong);
}

.result-card.empty {
  display: grid;
  place-items: center;
}

.empty-state {
  max-width: 330px;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  margin: 20px 0 8px;
  color: var(--text);
  font-size: 1.15rem;
}

.empty-state p {
  margin: 0;
}

.result-placeholder {
  display: inline-grid;
  width: 82px;
  height: 82px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--accent-strong);
  background: var(--panel-strong);
  font-size: 2.8rem;
  font-weight: 800;
}

.result-content {
  height: 100%;
}

.result-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 8px 4px 18px;
}

.result-heading .eyebrow {
  margin-bottom: 5px;
}

.result-heading h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -0.035em;
}

.result-heading > p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

.results-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.result-item {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-strong);
}

.result-item > img,
.image-link img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: contain;
  background: #080d18;
}

.image-link {
  display: grid;
  height: 190px;
  place-items: center;
  color: inherit;
  background: #080d18;
  text-decoration: none;
}

.image-link img {
  grid-area: 1 / 1;
}

.image-link img[hidden] {
  display: none;
}

.image-placeholder {
  grid-area: 1 / 1;
  padding: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.box-result.image-ready .image-link:hover img {
  opacity: 0.86;
}

.result-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.result-details strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-identity {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.result-identity strong {
  color: var(--text);
}

.result-identity span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lookup-status {
  flex: none;
  color: var(--accent-strong);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.lookup-status.error {
  color: var(--danger);
}

.box-result-value.pending {
  font-size: 0.67rem;
  letter-spacing: 0.06em;
}

.box-result-value.error {
  color: var(--danger);
}

.no-results {
  grid-column: 1 / -1;
  margin: 0;
  padding: 45px 20px;
  color: var(--muted);
  text-align: center;
}

.result-value {
  color: var(--text);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

@media (max-width: 820px) {
  .page-shell {
    padding: 44px 0;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .upload-card,
  .result-card {
    min-height: auto;
  }

  .drop-zone {
    min-height: 220px;
  }

  .result-heading {
    align-items: start;
    flex-direction: column;
    gap: 7px;
  }

  .result-heading > p {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 22px, 1120px);
    padding: 28px 0;
  }

  h1 {
    font-size: 3rem;
  }

  .box-search {
    margin-top: 27px;
  }

  .search-control button {
    min-width: auto;
    padding-inline: 16px;
  }

  .upload-card,
  .result-card {
    padding: 14px;
    border-radius: 17px;
  }

  .drop-zone {
    min-height: 210px;
    padding: 20px 14px;
  }
}
