:root {
  color-scheme: light;
  --bg-0: #eef3ee;
  --bg-1: #dde5dd;
  --bg-2: #c8d3ca;
  --surface: rgba(249, 252, 248, 0.58);
  --surface-strong: rgba(252, 255, 251, 0.74);
  --surface-soft: rgba(236, 241, 236, 0.58);
  --line: rgba(87, 109, 95, 0.18);
  --line-strong: rgba(74, 96, 83, 0.26);
  --ink: #1c2821;
  --muted: #5c6a61;
  --accent: #5e7567;
  --accent-strong: #43594c;
  --accent-soft: #8da694;
  --white-glow: rgba(255, 255, 255, 0.58);
  --shadow-soft: 0 18px 40px rgba(78, 93, 82, 0.1), inset 1px 1px 0 rgba(255, 255, 255, 0.68), inset -1px -1px 0 rgba(116, 138, 123, 0.06);
  --shadow-lg: 0 34px 90px rgba(66, 80, 70, 0.16), inset 1px 1px 0 rgba(255, 255, 255, 0.66), inset -1px -1px 0 rgba(122, 144, 130, 0.06);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Sora", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 18%, rgba(177, 196, 184, 0.78), transparent 26%),
    radial-gradient(circle at 84% 10%, rgba(217, 225, 218, 0.88), transparent 24%),
    radial-gradient(circle at 82% 76%, rgba(182, 202, 188, 0.44), transparent 22%),
    linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 46%, var(--bg-2) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 800'%3E%3Cpath fill='%23dbe6dc' fill-opacity='0.65' d='M0,544L34.3,506.7C68.6,469,137,395,206,341.3C274.3,288,343,256,411,245.3C480,235,549,245,617,277.3C685.7,309,754,363,823,389.3C891.4,416,960,416,1029,394.7C1097.1,373,1166,331,1234,346.7C1302.9,363,1371,437,1406,474.7L1440,512L1440,801L1405.7,801C1371.4,801,1303,801,1234,801C1165.7,801,1097,801,1029,801C960,801,891,801,823,801C754.3,801,686,801,617,801C548.6,801,480,801,411,801C342.9,801,274,801,206,801C137.1,801,69,801,34,801L0,801Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: cover;
  opacity: 0.6;
}

body::after {
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.22), transparent 30%),
    radial-gradient(circle at 66% 60%, rgba(117, 142, 128, 0.1), transparent 24%);
  mix-blend-mode: screen;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
}

.topbar,
.layout {
  width: min(calc(100% - 32px), var(--max-width));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 0 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy strong,
.hero-copy h1,
.best-match h2,
.results-panel h2,
.preview-head h2,
.preview-header h3 {
  font-family: "Fraunces", serif;
}

.header-pills {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-pill,
.hero-kicker,
.eyebrow,
.confidence-pill,
.panel-count,
.preview-category,
.chip,
.tag {
  letter-spacing: 0.02em;
}

.header-pill,
.hero-kicker,
.confidence-pill,
.panel-count,
.chip,
.github-login,
.preview-action,
.ghost-action,
.shortcut-row span,
.tag {
  border: 1px solid var(--line);
  background: rgba(251, 253, 250, 0.5);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
}

.header-pill {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
}

.github-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: #f6f8fa;
  background: #24292f;
  border: 1px solid rgba(27, 31, 36, 0.15);
  box-shadow: 0 1px 0 rgba(27, 31, 36, 0.04), 0 1px 3px rgba(27, 31, 36, 0.12);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.github-login:hover {
  background: #2f363d;
  transform: translateY(-1px);
}

.github-login:focus-visible {
  outline: 3px solid rgba(9, 105, 218, 0.28);
  outline-offset: 3px;
}

.github-login-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.crypto-donate {
  position: relative;
}

.crypto-donate summary {
  list-style: none;
}

.crypto-donate summary::-webkit-details-marker {
  display: none;
}

.crypto-donate-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: #f6f8fa;
  background: linear-gradient(135deg, #394c40 0%, #506557 55%, #748a7c 100%);
  border: 1px solid rgba(67, 87, 74, 0.22);
  box-shadow: 0 1px 0 rgba(27, 31, 36, 0.04), 0 1px 3px rgba(27, 31, 36, 0.12);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  user-select: none;
}

.crypto-donate[open] .crypto-donate-summary,
.crypto-donate-summary:hover {
  transform: translateY(-1px);
}

.crypto-donate-summary:focus-visible {
  outline: 3px solid rgba(120, 151, 133, 0.28);
  outline-offset: 3px;
}

.crypto-caret {
  width: 14px;
  height: 14px;
  display: block;
}

.crypto-donate-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(92vw, 460px);
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(243, 247, 242, 0.38)),
    rgba(244, 248, 244, 0.46);
  backdrop-filter: blur(28px);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 10px;
  z-index: 10;
}

.crypto-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(250, 252, 250, 0.62);
  box-shadow: var(--shadow-soft);
}

.crypto-logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
}

.crypto-logo-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.crypto-eth {
  color: #627eea;
}

.crypto-btc {
  color: #f7931a;
}

.crypto-ltc {
  color: #345d9d;
}

.crypto-trx {
  color: #ef0027;
}

.crypto-address {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-family: "Courier New", monospace;
}

.layout {
  padding: 34px 0 72px;
}

.error-layout {
  min-height: calc(100vh - 34px);
  display: grid;
  place-items: center;
}

.error-card {
  width: min(100%, 680px);
  padding: 42px 34px;
  text-align: center;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(243, 247, 242, 0.36)),
    rgba(244, 248, 244, 0.4);
  backdrop-filter: blur(30px);
  box-shadow: var(--shadow-lg);
}

.error-card h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2.6rem, 5vw, 4.3rem);
  line-height: 1;
  font-weight: 600;
}

.error-code {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.22rem);
}

.error-action {
  min-width: 180px;
  margin-top: 28px;
  text-decoration: none;
}

.hero-copy {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  animation: float-up 0.9s ease both;
}

.hero-kicker {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  margin-bottom: 16px;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2.8rem, 5.6vw, 5.2rem);
  line-height: 0.98;
  font-weight: 600;
}

.hero-copy p {
  max-width: 690px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.14rem);
  line-height: 1.7;
}

.search-lab {
  margin-top: 34px;
  animation: float-up 1s ease both 0.08s;
}

.search-surface,
.card,
.preview-card {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(243, 247, 242, 0.36)),
    rgba(244, 248, 244, 0.4);
  backdrop-filter: blur(30px);
  box-shadow: var(--shadow-lg);
}

.search-surface {
  border-radius: var(--radius-xl);
  padding: 20px;
}

.search-surface:focus-within {
  border-color: rgba(103, 130, 115, 0.38);
  box-shadow: 0 38px 90px rgba(69, 87, 74, 0.18), 0 0 0 8px rgba(132, 160, 144, 0.12), inset 1px 1px 0 rgba(255, 255, 255, 0.7), inset -1px -1px 0 rgba(117, 139, 126, 0.06);
}

.search-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 0 18px;
  border-radius: 24px;
  border: 1px solid rgba(100, 122, 109, 0.16);
  background: rgba(250, 252, 250, 0.62);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.84), inset -1px -1px 0 rgba(126, 150, 136, 0.08);
}

.search-icon {
  color: var(--accent);
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.search-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: clamp(1rem, 1.6vw, 1.16rem);
}

.search-field input::placeholder {
  color: rgba(92, 106, 97, 0.72);
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ghost-action,
.search-action,
.chip,
.result-card,
.preview-action {
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease, opacity 180ms ease;
}

.ghost-action,
.preview-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 18px;
  color: var(--muted);
  cursor: pointer;
}

.ghost-action {
  min-width: 96px;
}

.ghost-action:hover,
.preview-action:hover,
.chip:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: var(--accent-strong);
}

.search-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 60px;
  padding: 0 24px;
  border: 0;
  border-radius: 20px;
  color: #f5faf6;
  cursor: pointer;
  background: linear-gradient(135deg, #748a7c 0%, #4d6254 55%, #394c40 100%);
  box-shadow: 0 18px 28px rgba(67, 87, 74, 0.24);
}

.search-action:hover,
.search-action:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 22px 32px rgba(67, 87, 74, 0.28);
}

.search-action:focus-visible,
.ghost-action:focus-visible,
.chip:focus-visible,
.result-card:focus-visible {
  outline: 3px solid rgba(120, 151, 133, 0.3);
  outline-offset: 3px;
}

.loading-dots {
  display: none;
  align-items: center;
  gap: 5px;
}

.loading-dots span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(248, 253, 249, 0.9);
  animation: pulse 0.9s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

body.searching .search-action-label {
  opacity: 0.72;
}

body.searching .loading-dots {
  display: inline-flex;
}

.search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.search-meta p {
  margin: 0;
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.shortcut-row span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.chip {
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--accent-strong);
  cursor: pointer;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.25fr);
  gap: 18px;
  margin-top: 18px;
}

.card,
.preview-card {
  border-radius: var(--radius-xl);
  padding: 24px;
}

.best-match {
  position: relative;
  overflow: hidden;
}

.best-match::before,
.preview-card::before {
  content: "";
  position: absolute;
  inset: -24% auto auto -8%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(171, 193, 180, 0.4), transparent 64%);
  pointer-events: none;
}

.card-topline,
.panel-topline,
.preview-head,
.preview-header,
.preview-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow,
.preview-category {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.eyebrow::before,
.preview-category::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8aa28f, #50665a);
  box-shadow: 0 0 0 4px rgba(138, 162, 143, 0.14);
}

.confidence-pill,
.panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
}

.best-match h2,
.results-panel h2,
.preview-head h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 600;
}

.best-match h2 {
  margin-top: 18px;
  font-size: clamp(1.8rem, 2.5vw, 2.3rem);
  max-width: 12ch;
  line-height: 1.06;
}

.best-match p,
.preview-summary,
.result-card p {
  color: var(--muted);
  line-height: 1.65;
}

.signal-wrap {
  margin-top: 22px;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.signal-track {
  width: 100%;
  height: 10px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(244, 248, 244, 0.66);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.78), inset -1px -1px 0 rgba(110, 131, 118, 0.08);
}

.signal-track span {
  display: block;
  width: 48%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #93ab98 0%, #667d6d 45%, #475e52 100%);
  transition: width 220ms ease;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
}

.results-panel {
  min-height: 100%;
}

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

.result-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(250, 252, 250, 0.6);
  padding: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.result-card:hover,
.result-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(92, 116, 102, 0.34);
  background: rgba(252, 255, 252, 0.76);
}

.result-card.is-empty {
  cursor: default;
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.result-card h3 {
  margin: 10px 0 8px;
  font-size: 1.02rem;
  line-height: 1.35;
}

.result-card p {
  margin: 0;
  font-size: 0.92rem;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.result-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(238, 244, 239, 0.8);
  color: var(--accent-strong);
  font-size: 0.74rem;
}

.doc-preview {
  margin-top: 18px;
  animation: float-up 1.05s ease both 0.16s;
}

.preview-head {
  margin-bottom: 18px;
}

.preview-card {
  position: relative;
  overflow: hidden;
}

.preview-header {
  align-items: flex-start;
  flex-direction: column;
}

.preview-header h3 {
  margin: 12px 0 8px;
  font-size: clamp(1.7rem, 2.8vw, 2.3rem);
  font-weight: 600;
  line-height: 1.1;
}

.preview-summary {
  margin: 0;
  max-width: 780px;
  font-size: 1rem;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
}

.preview-block {
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(249, 252, 250, 0.56);
  box-shadow: var(--shadow-soft);
}

.preview-block h4 {
  margin: 0 0 14px;
  font-size: 0.95rem;
}

.preview-block ul,
.preview-block ol {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.code-block {
  margin: 0;
  overflow-x: auto;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(31, 45, 38, 0.94);
  box-shadow: var(--shadow-soft);
}

.code-block code {
  display: block;
  color: #e9f1ea;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre;
}

.preview-footer {
  align-items: center;
  margin-top: 22px;
}

.preview-footer .tag-row {
  margin-top: 0;
}

.libraries-page {
  display: grid;
  gap: 24px;
}

.library-sections {
  display: grid;
  gap: 16px;
  margin-top: 6px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.library-link {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(250, 252, 250, 0.6);
  box-shadow: var(--shadow-soft);
  color: var(--accent-strong);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.library-link:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: rgba(252, 255, 252, 0.78);
  color: var(--ink);
}

.inline-link {
  color: var(--accent-strong);
  font-weight: 600;
}

.inline-link:hover {
  color: var(--ink);
}

@keyframes pulse {
  0%,
  80%,
  100% {
    transform: scale(0.75);
    opacity: 0.45;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes float-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .topbar {
    padding-top: 18px;
  }

  .brand-mark {
    width: 78px;
    height: 78px;
  }

  .results-grid,
  .preview-grid,
  .library-grid {
    grid-template-columns: 1fr;
  }

  .best-match h2 {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .topbar,
  .layout {
    width: min(calc(100% - 22px), var(--max-width));
  }

  .brand-mark {
    width: 68px;
    height: 68px;
  }

  .topbar,
  .search-row,
  .search-meta,
  .preview-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .header-pills,
  .shortcut-row {
    justify-content: flex-start;
  }

  .search-actions {
    width: 100%;
  }

  .ghost-action,
  .search-action {
    flex: 1;
  }

  .search-field {
    min-height: 70px;
  }

  .search-surface,
  .card,
  .preview-card {
    border-radius: 26px;
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .layout {
    padding-bottom: 46px;
  }

  .hero-copy h1 {
    font-size: 2.7rem;
  }

  .search-actions {
    flex-direction: column-reverse;
  }

  .ghost-action,
  .search-action {
    width: 100%;
  }

  .preview-block {
    padding: 18px;
  }
}
