:root {
  --ink: #15201c;
  --muted: #61716b;
  --paper: #fbf7ed;
  --panel: rgba(255, 252, 244, 0.86);
  --panel-strong: #fffaf0;
  --line: rgba(31, 59, 49, 0.16);
  --green: #234d3c;
  --green-bright: #2f7a55;
  --amber: #d88a28;
  --clay: #bb614b;
  --blue: #245d73;
  --shadow: 0 24px 80px rgba(23, 38, 32, 0.16);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 12% 12%, rgba(216, 138, 40, 0.24), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(36, 93, 115, 0.20), transparent 30rem),
    linear-gradient(135deg, #f7ecd7 0%, #eff4e8 52%, #dce9e1 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  background-image:
    linear-gradient(rgba(21, 32, 28, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 32, 28, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 76%);
}

button,
input,
select {
  font: inherit;
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 70px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.api-card,
.search-panel,
.status-strip,
.summary,
.result-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  border-radius: var(--radius-xl);
  padding: clamp(28px, 5vw, 58px);
  overflow: hidden;
  position: relative;
}

.hero-copy::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  right: -80px;
  bottom: -110px;
  border-radius: 999px;
  background: rgba(47, 122, 85, 0.14);
  border: 1px solid rgba(47, 122, 85, 0.2);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--green-bright);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.lede {
  max-width: 720px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.6;
}

.api-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  border-radius: var(--radius-xl);
  padding: 26px;
  background:
    linear-gradient(160deg, rgba(35, 77, 60, 0.96), rgba(21, 32, 28, 0.92)),
    var(--green);
  color: #fff7e8;
}

.api-card span {
  color: rgba(255, 247, 232, 0.66);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.api-card code {
  overflow-wrap: anywhere;
  font-size: 0.94rem;
  line-height: 1.5;
}

.search-panel {
  border-radius: var(--radius-xl);
  padding: 22px;
}

.query-label,
.filters span {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.query-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(31, 59, 49, 0.22);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input:focus,
select:focus {
  border-color: rgba(47, 122, 85, 0.7);
  box-shadow: 0 0 0 4px rgba(47, 122, 85, 0.14);
  background: #fffdf8;
}

input {
  min-height: 58px;
  padding: 0 18px;
  font-size: 1.08rem;
}

select {
  min-height: 46px;
  padding: 0 12px;
}

button {
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

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

button:disabled {
  cursor: wait;
  opacity: 0.66;
  transform: none;
}

#search-button {
  min-width: 138px;
  padding: 0 24px;
  color: #fff9ef;
  background: linear-gradient(135deg, var(--green), var(--green-bright));
  box-shadow: 0 16px 32px rgba(35, 77, 60, 0.24);
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.status-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 18px 0;
  border-radius: var(--radius-lg);
  padding: 14px 16px 14px 20px;
  color: var(--muted);
}

#clear-button {
  padding: 10px 16px;
  color: var(--green);
  background: rgba(35, 77, 60, 0.08);
}

.summary {
  margin-bottom: 18px;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.summary strong {
  color: var(--green);
}

.summary code {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(36, 93, 115, 0.10);
  color: var(--blue);
}

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.result-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 22px;
  animation: rise 420ms ease both;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(var(--amber), var(--green-bright));
}

.result-topline,
.result-topline div,
.matched-tokens {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.result-topline {
  justify-content: space-between;
  margin-bottom: 16px;
}

.system-badge,
.version-badge,
.score-badge,
.token {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

.system-badge,
.version-badge,
.score-badge {
  padding: 8px 10px;
}

.system-badge {
  color: #fffaf0;
  background: var(--blue);
}

.version-badge {
  color: var(--green);
  background: rgba(47, 122, 85, 0.12);
}

.score-badge {
  color: #7a3b22;
  background: rgba(216, 138, 40, 0.16);
}

.code {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 2.2rem;
  letter-spacing: -0.04em;
}

.description {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
}

.short-description {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.matched-tokens {
  margin-top: 16px;
}

.token {
  padding: 7px 9px;
  color: var(--green);
  background: rgba(47, 122, 85, 0.10);
}

.empty-state,
.error-state {
  grid-column: 1 / -1;
  border: 1px dashed rgba(31, 59, 49, 0.28);
  border-radius: var(--radius-lg);
  padding: 30px;
  background: rgba(255, 252, 244, 0.62);
  color: var(--muted);
  text-align: center;
}

.error-state {
  color: #8a3328;
  border-color: rgba(187, 97, 75, 0.42);
  background: rgba(255, 236, 230, 0.72);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .hero,
  .query-row,
  .results {
    grid-template-columns: 1fr;
  }

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

  #search-button {
    min-height: 54px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .hero-copy,
  .api-card,
  .search-panel {
    border-radius: 22px;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .status-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  #clear-button {
    width: 100%;
  }
}
