:root {
  --bg: #f5f8fc;
  --bg-deep: #dbe6f2;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --text: #17263f;
  --muted: #5f708d;
  --line: rgba(35, 57, 96, 0.1);
  --brand: #233960;
  --brand-dark: #1b2d4d;
  --brand-soft: rgba(35, 57, 96, 0.1);
  --shadow: 0 24px 80px rgba(35, 57, 96, 0.14);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --sans: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(35, 57, 96, 0.16), transparent 34%),
    radial-gradient(circle at bottom right, rgba(84, 114, 168, 0.14), transparent 26%),
    linear-gradient(180deg, #fbfffd 0%, var(--bg) 54%, var(--bg-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(35, 57, 96, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 57, 96, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 86%);
}

.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.hero {
  width: min(920px, 100%);
  padding: 56px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(243, 255, 250, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-badge {
  display: inline-flex;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 10ch;
  margin: 22px 0 0;
  font-size: clamp(2.8rem, 7vw, 6rem);
  line-height: 0.92;
}

.hero-text {
  max-width: 44ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  margin-top: 34px;
}

input,
button {
  font: inherit;
}

.search-field {
  display: block;
}

input {
  width: 100%;
  height: 70px;
  padding: 0 26px;
  border: 1px solid rgba(35, 57, 96, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  font-size: 1.05rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus {
  outline: none;
  border-color: rgba(35, 57, 96, 0.4);
  box-shadow: 0 0 0 6px rgba(35, 57, 96, 0.12);
}

button {
  min-height: 70px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), #2f4d84);
  color: #f6fffc;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(35, 57, 96, 0.22);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

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

.loader,
.modal {
  position: fixed;
  inset: 0;
}

.loader {
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(7, 54, 47, 0.34);
  backdrop-filter: blur(10px);
}

.loader-card {
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  border-radius: 28px;
  background: rgba(248, 255, 252, 0.98);
  box-shadow: var(--shadow);
  text-align: center;
}

.loader-card h2 {
  margin: 18px 0 0;
}

.loader-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.loader-ring {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  border: 6px solid rgba(35, 57, 96, 0.18);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}

.modal {
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 54, 47, 0.42);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  width: min(940px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 28px;
  background: rgba(248, 255, 252, 0.98);
  box-shadow: 0 24px 80px rgba(0, 68, 58, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 24px 0;
}

.modal-kicker {
  margin: 0 0 8px;
  color: var(--brand-dark);
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.modal-header h2,
.modal-body h3 {
  margin: 0;
}

.modal-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.icon-button,
.copy-button {
  min-height: 44px;
  padding: 0 16px;
  background: rgba(35, 57, 96, 0.1);
  color: var(--brand-dark);
  box-shadow: none;
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 1.5rem;
}

.modal-body {
  padding: 24px;
  display: grid;
  gap: 22px;
}

.product-card,
.match-card,
.citation-card {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 18px;
}

.product-card h4,
.match-card h4 {
  margin: 0 0 10px;
}

.meta-line {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.5;
}

.spec-list,
.matches-list,
.citations-list {
  display: grid;
  gap: 14px;
}

.matches-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.match-card {
  box-shadow: 0 10px 30px rgba(35, 57, 96, 0.08);
}

.match-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 14px;
  background: #f5fbf8;
  margin-bottom: 14px;
}

.match-card a {
  color: var(--brand-dark);
  text-decoration: none;
  font-weight: 800;
}

.results-caption {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(17, 54, 46, 0.12);
}

.spec-item span:first-child {
  color: var(--muted);
}

.citation-card a {
  color: var(--brand-dark);
  text-decoration: none;
  font-weight: 800;
}

.citation-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.json-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.json-output {
  margin: 0;
  min-height: 240px;
  padding: 18px;
  border-radius: 16px;
  background: #10382f;
  color: #effff8;
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.65;
}

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .landing,
  .modal {
    padding: 16px;
  }

  .hero {
    padding: 24px;
  }

  .hero h1 {
    max-width: none;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  input,
  button {
    min-height: 60px;
    height: 60px;
  }

  .modal-header,
  .modal-body {
    padding: 18px;
  }

  .result-summary,
  .json-head {
    display: grid;
  }

  .matches-list {
    grid-template-columns: 1fr;
  }
}
