:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #e6e6e6;
  --soft: #f7f7f7;
  --button: #111111;
  --button-hover: #333333;
  --header-height: 74px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  overflow-x: hidden;
  overflow-y: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body.has-results {
  overflow-y: auto;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.fixed-header {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  min-height: var(--header-height);
  padding: 14px 18px;
  display: grid;
  place-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  text-align: center;
}

.fixed-header p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.fixed-header p + p {
  color: var(--muted);
}

.page {
  height: 100svh;
  padding: calc(var(--header-height) + 44px) 20px 24px;
  display: grid;
  grid-template-rows: auto auto;
  gap: 24px;
}

body.has-results .page {
  height: auto;
  min-height: 100svh;
}

.search-area {
  width: min(720px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 22px;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(56px, 13vw, 112px);
  line-height: 0.95;
  font-weight: 500;
  letter-spacing: 0;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 3.5vw, 28px);
  line-height: 1.3;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 12px;
}

.search-form input {
  width: 100%;
  min-height: 58px;
  padding: 0 22px;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  outline: none;
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.search-form input:focus {
  border-color: #999999;
  box-shadow: 0 3px 18px rgba(0, 0, 0, 0.12);
}

.search-form button {
  min-height: 58px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: #ffffff;
  font-weight: 600;
}

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

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

.scanner-panel,
.status-message {
  width: min(640px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
  text-align: left;
}

.scanner-panel {
  padding: 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #dddddd;
  border-top-color: #111111;
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.scanner-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.progress-track {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #dddddd;
}

.progress-track span {
  display: block;
  width: 18%;
  height: 100%;
  border-radius: inherit;
  background: #111111;
  transition: width 420ms ease;
}

.status-message {
  padding: 14px 16px;
  color: #b42318;
  background: #fff5f5;
}

.results-shell {
  width: min(980px, 100%);
  min-height: 180px;
  margin: 0 auto 48px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

body:not(.has-results) .results-shell {
  min-height: 130px;
  margin-bottom: 0;
}

.empty-state {
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
}

.empty-state strong {
  font-weight: 600;
}

.empty-state p {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.results-scroll {
  overflow: visible;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
}

.result-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.result-card > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.result-card.featured strong {
  display: block;
  font-size: clamp(24px, 5vw, 36px);
  line-height: 1.1;
  font-weight: 500;
}

.result-card.wide {
  grid-column: 1 / -1;
}

.result-card p {
  margin: 0;
  color: #222222;
  line-height: 1.55;
}

.result-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-card li {
  margin-top: 8px;
  color: #222222;
  line-height: 1.45;
}

.result-card li a {
  color: #111111;
  text-decoration: underline;
  text-decoration-color: #bdbdbd;
  text-underline-offset: 3px;
}

.result-card li a:hover {
  text-decoration-color: #111111;
}

.source-card {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.source-card strong {
  line-height: 1.35;
}

.source-card a {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #1a0dab;
  text-decoration: none;
}

.source-card span {
  width: max-content;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
}

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

.hidden {
  display: none !important;
}

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

@media (max-width: 680px) {
  :root {
    --header-height: 86px;
  }

  .fixed-header {
    padding: 12px 14px;
  }

  .fixed-header p {
    font-size: 13px;
  }

  .page {
    padding: calc(var(--header-height) + 42px) 14px 16px;
    gap: 28px;
  }

  .search-area {
    gap: 18px;
  }

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

  .search-form input,
  .search-form button {
    min-height: 54px;
  }

  .results-scroll {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .scanner-panel {
    grid-template-columns: 1fr;
  }
}
