:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef4f3;
  --text: #181a1f;
  --muted: #5f6673;
  --line: #d9dee7;
  --line-strong: #b8c1cc;
  --teal: #0f766e;
  --blue: #1d4ed8;
  --amber: #b45309;
  --shadow: 0 14px 34px rgba(24, 26, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 48px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--teal);
  border: 1px solid #b8d8d3;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.links a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 48px) 44px;
}

.search-band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.search-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.search-heading h2,
.results-head h2 {
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0;
}

.runtime-state,
#result-count {
  color: var(--muted);
  font-size: 13px;
}

.runtime-state.ready {
  color: var(--teal);
}

.runtime-state.warn {
  color: var(--amber);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
}

input[type="search"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  font: inherit;
  background: #fff;
}

input[type="search"]:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--teal);
}

button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

button svg {
  width: 18px;
  height: 18px;
}

.workspace {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.stats,
.results-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats {
  display: grid;
  gap: 0;
  overflow: hidden;
}

.stat {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.stat:last-child {
  border-bottom: 0;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.stat strong {
  min-width: 0;
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.results-shell {
  min-height: 430px;
  padding: 16px;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.results {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.result-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.result-title {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.score {
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.snippet {
  margin-top: 8px;
  color: #2d333d;
  font-size: 14px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.meta span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #f1f3f6;
}

.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;
}

@media (max-width: 780px) {
  .topbar,
  .search-heading,
  .result-top {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .search-heading {
    display: flex;
  }

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

  .links a,
  button {
    width: 100%;
  }
}
