:root {
  color-scheme: light;
  --page: #f4f1eb;
  --surface: #ffffff;
  --ink: #142023;
  --soft-ink: #35484a;
  --muted: #697879;
  --line: #dde3de;
  --teal: #0f766e;
  --deep: #17324d;
  --amber: #e7ad35;
  --coral: #e76f61;
  --teal-soft: #e3f3ef;
  --amber-soft: #fff3d6;
  --shadow: 0 18px 42px rgba(23, 50, 77, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 420px),
    var(--page);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--deep);
  font-size: 1.12rem;
  font-weight: 780;
  text-decoration: none;
}

.brand img {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.status-pill {
  min-width: 86px;
  border: 1px solid rgba(23, 50, 77, 0.12);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--deep);
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.82rem;
  font-weight: 730;
  text-align: center;
}

.status-pill.busy {
  color: #735110;
  background: var(--amber-soft);
}

.status-pill.error {
  color: #9a2519;
  background: #ffe1dc;
}

.search-surface {
  margin-top: 34px;
  border: 1px solid rgba(23, 50, 77, 0.12);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.query-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

#queryInput {
  width: 100%;
  min-width: 0;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font-size: 1.06rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

#queryInput:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 124px;
  height: 56px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  color: #fff;
  background: var(--deep);
  font-weight: 760;
  transition: transform 150ms ease, background 150ms ease;
}

.search-button:hover {
  background: var(--teal);
}

.search-button:active {
  transform: translateY(1px);
}

.search-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.search-icon {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-row button {
  min-height: 34px;
  border: 1px solid rgba(23, 50, 77, 0.12);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--soft-ink);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 720;
}

.quick-row button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.results-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-top: 30px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.28rem, 1rem + 1vw, 1.9rem);
  line-height: 1.16;
  letter-spacing: 0;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 720;
}

.notice {
  margin-top: 16px;
  border: 1px solid rgba(231, 111, 97, 0.28);
  border-radius: 8px;
  padding: 13px 15px;
  color: #762016;
  background: #ffeae6;
  font-size: 0.94rem;
  line-height: 1.45;
}

.notice.info {
  border-color: rgba(15, 118, 110, 0.22);
  color: var(--deep);
  background: var(--teal-soft);
}

.results {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.result-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 16px;
  border: 1px solid rgba(23, 50, 77, 0.1);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(23, 50, 77, 0.06);
}

.rank-pill {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--deep);
  background: var(--teal-soft);
  font-size: 0.86rem;
  font-weight: 820;
}

.result-main {
  min-width: 0;
}

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

.result-title {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 780;
  line-height: 1.33;
  text-decoration: none;
}

.result-title:hover {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.source-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.source-line span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.source-line span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 8px 2px 0;
  border-radius: 50%;
  background: #a7b1ae;
}

.score-box {
  min-width: 74px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--deep);
  background: var(--teal-soft);
  text-align: center;
}

.score-value {
  display: block;
  font-size: 1.12rem;
  font-weight: 840;
  line-height: 1;
}

.score-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary {
  margin: 12px 0 0;
  color: var(--soft-ink);
  line-height: 1.52;
  overflow-wrap: anywhere;
}

.signals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.signal {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fbfaf7;
}

.signal span,
.detail-row span {
  display: block;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 830;
  text-transform: uppercase;
}

.signal p,
.detail-row p {
  margin: 6px 0 0;
  color: var(--soft-ink);
  font-size: 0.86rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.details {
  margin-top: 12px;
}

.details summary {
  width: max-content;
  color: var(--deep);
  font-size: 0.84rem;
  font-weight: 780;
  cursor: pointer;
}

.details-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.detail-row {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.action-link,
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid rgba(23, 50, 77, 0.14);
  border-radius: 8px;
  padding: 7px 11px;
  color: var(--deep);
  background: #fff;
  font-size: 0.84rem;
  font-weight: 760;
  text-decoration: none;
}

.action-link:hover,
.action-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.skeleton {
  min-height: 168px;
  overflow: hidden;
  position: relative;
}

.skeleton::before,
.skeleton::after {
  content: "";
  display: block;
  grid-column: 2;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(221, 227, 222, 0.58), rgba(255, 255, 255, 0.95), rgba(221, 227, 222, 0.58));
  background-size: 240% 100%;
  animation: shimmer 1.2s linear infinite;
}

.skeleton::before {
  width: 60%;
  height: 20px;
  margin-bottom: 16px;
}

.skeleton::after {
  width: 100%;
  height: 92px;
}

mark {
  border-radius: 4px;
  padding: 0 2px;
  color: inherit;
  background: rgba(231, 173, 53, 0.34);
}

.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 shimmer {
  to {
    background-position: -240% 0;
  }
}

@media (max-width: 820px) {
  .signals {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, 1120px);
    padding-top: 18px;
  }

  .topbar,
  .results-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics {
    justify-content: flex-start;
  }

  .query-row {
    grid-template-columns: 1fr;
  }

  .search-button {
    width: 100%;
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .rank-pill {
    width: 30px;
    height: 30px;
  }

  .result-head {
    grid-template-columns: 1fr;
  }

  .score-box {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .search-surface,
  .result-card {
    padding: 13px;
  }

  #queryInput,
  .search-button {
    height: 54px;
  }
}
