.querymesh-home .title {
  width: auto !important;
  height: auto !important;
  margin: 0 auto 1.25rem !important;
  background: none !important;
  -webkit-mask: none !important;
  mask: none !important;
}

.querymesh-home .title h1 {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: visible !important;
  gap: clamp(0.55rem, 2.5vw, 0.9rem);
  color: var(--color-base-font, #222);
  font-size: clamp(1.8rem, 7vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  text-indent: 0;
  letter-spacing: -0.04em;
}

.querymesh-brand-mark {
  display: block;
  flex: 0 0 auto;
  width: clamp(2.65rem, 11vw, 3.75rem);
  height: auto;
}

.querymesh-search-progress {
  position: fixed;
  z-index: 2147483647;
  inset: 0 0 auto;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
}

.querymesh-search-progress[hidden] {
  display: none;
}

.querymesh-search-progress::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: clamp(64px, 28vw, 280px);
  height: 100%;
  border-radius: 999px;
  background: #a9ccff;
  box-shadow: 0 0 4px rgb(120 170 255 / 70%);
  animation: querymesh-search-sweep 1.05s linear infinite;
}

@keyframes querymesh-search-sweep {
  from { transform: translate3d(-100%, 0, 0); }
  to { transform: translate3d(100vw, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .querymesh-search-progress::before {
    width: clamp(64px, 28vw, 280px);
    transform: none;
    animation: none;
  }
}

.querymesh-ai-summary {
  margin: 1.5rem 0 1.25rem;
  padding: 1rem 1.1rem;
  color: var(--color-base-font, #222);
  background: var(--color-base-background, #fff);
  border: 1px solid var(--color-base-background-hover, #d7dbe2);
  border-radius: 12px;
}

.querymesh-ai-summary__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.querymesh-ai-summary h2 {
  margin: 0 auto 0 0;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1.35;
}

.querymesh-ai-settings button {
  min-height: 2.4rem;
  padding: 0.45rem 0.85rem;
  color: #17213a;
  font: inherit;
  font-weight: 600;
  background: #5685ff;
  border: 1px solid #5685ff;
  border-radius: 7px;
  cursor: pointer;
}

.querymesh-ai-settings button:hover:not(:disabled) {
  background: #6a94ff;
  border-color: #6a94ff;
}

.querymesh-ai-settings button:focus-visible,
.querymesh-ai-settings input:focus-visible,
.querymesh-ai-settings select:focus-visible,
.querymesh-ai-settings a:focus-visible {
  outline: 2px solid var(--color-base-font, #315efb);
  outline-offset: 2px;
}

.querymesh-ai-settings button:disabled {
  cursor: not-allowed;
  background: #40527d;
  border-color: #8299c7;
  color: #f2f5ff;
}

.querymesh-ai-summary__status,
.querymesh-ai-settings__intro,
.querymesh-ai-settings__note,
.querymesh-ai-settings__provider-status,
.querymesh-ai-settings__status {
  margin: 0.6rem 0 0;
  color: var(--color-base-font, #4b5563);
  font-size: 0.92rem;
  line-height: 1.5;
}

.querymesh-ai-summary__status:empty {
  display: none;
}

.querymesh-ai-summary__answer {
  max-width: 72ch;
  margin-top: 0.85rem;
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.querymesh-ai-summary__answer > :first-child {
  margin-top: 0;
}

.querymesh-ai-summary__answer > :last-child {
  margin-bottom: 0;
}

.querymesh-ai-summary__answer p {
  margin: 0.7em 0;
}

.querymesh-ai-summary__answer h1,
.querymesh-ai-summary__answer h2,
.querymesh-ai-summary__answer h3,
.querymesh-ai-summary__answer h4 {
  margin: 1.1em 0 0.45em;
  color: inherit;
  line-height: 1.3;
}

.querymesh-ai-summary__answer h1 { font-size: 1.35rem; }
.querymesh-ai-summary__answer h2 { font-size: 1.2rem; }
.querymesh-ai-summary__answer h3,
.querymesh-ai-summary__answer h4 { font-size: 1.08rem; }

.querymesh-ai-summary__answer ul,
.querymesh-ai-summary__answer ol {
  margin: 0.65em 0;
  padding-left: 1.55rem;
}

.querymesh-ai-summary__answer li + li {
  margin-top: 0.25em;
}

.querymesh-ai-summary__answer blockquote {
  margin: 0.8em 0;
  padding: 0.15em 0 0.15em 1em;
  color: var(--color-base-font, #4b5563);
  border-left: 2px solid var(--color-base-background-hover, #aeb5c2);
}

.querymesh-ai-summary__answer pre {
  max-width: 100%;
  padding: 0.8rem 0.95rem;
  overflow: auto;
  background: var(--color-base-background-hover, #edf0f5);
  border-radius: 7px;
}

.querymesh-ai-summary__answer code {
  padding: 0.08em 0.28em;
  background: var(--color-base-background-hover, #edf0f5);
  border-radius: 4px;
  font-size: 0.92em;
}

.querymesh-ai-summary__answer pre code {
  padding: 0;
  background: transparent;
}

.querymesh-ai-summary__answer table {
  display: block;
  max-width: 100%;
  margin: 0.8em 0;
  overflow-x: auto;
  border-collapse: collapse;
}

.querymesh-ai-summary__answer th,
.querymesh-ai-summary__answer td {
  padding: 0.4rem 0.65rem;
  text-align: left;
  border: 1px solid var(--color-base-background-hover, #d7dbe2);
}

.querymesh-ai-summary__answer th {
  font-weight: 650;
  background: var(--color-base-background-hover, #edf0f5);
}

.querymesh-ai-summary__answer hr {
  margin: 1rem 0;
  border: 0;
  border-top: 1px solid var(--color-base-background-hover, #d7dbe2);
}

.querymesh-citation {
  position: relative;
  display: inline-block;
  margin: 0 0.06em;
  color: var(--color-base-font, #315efb);
  font-size: 0.88em;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  white-space: nowrap;
}

.querymesh-citation:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 2px;
}

.querymesh-citation__card {
  position: absolute;
  z-index: 50;
  top: calc(100% + 0.55rem);
  left: 0;
  display: none;
  width: min(21rem, calc(100vw - 2rem));
  padding: 0.85rem 0.95rem;
  color: var(--color-base-font, #222);
  white-space: normal;
  text-align: left;
  background: var(--color-base-background, #fff);
  border: 1px solid var(--color-base-background-hover, #cfd4df);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgb(12 18 32 / 22%);
  cursor: default;
}

.querymesh-citation[data-side="left"] .querymesh-citation__card {
  right: 0;
  left: auto;
}

.querymesh-citation:hover .querymesh-citation__card,
.querymesh-citation:focus-visible .querymesh-citation__card,
.querymesh-citation[data-preview-open="true"] .querymesh-citation__card {
  display: grid;
  gap: 0.45rem;
}

.querymesh-citation__title {
  font-size: 0.94rem;
  line-height: 1.35;
}

.querymesh-citation__snippet {
  display: -webkit-box;
  overflow: hidden;
  color: var(--color-base-font, #4b5563);
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.querymesh-citation__domain {
  color: var(--color-base-font, #4b5563);
  font-size: 0.78rem;
  font-weight: 500;
}

.querymesh-ai-summary__header a,
.querymesh-ai-settings a {
  color: var(--color-base-font, #315efb);
  text-underline-offset: 0.18em;
}

.querymesh-ai-settings {
  box-sizing: border-box;
  width: min(100% - 2rem, 48rem);
  margin: 2rem auto 4rem;
  color: var(--color-base-font, #222);
}

.querymesh-ai-settings-page {
  min-height: 100vh;
  margin: 0;
  color: #20232b;
  background: #f6f7fa;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  .querymesh-ai-settings-page {
    color: #e7eaf2;
    background: #202331;
    --color-base-font: #e7eaf2;
    --color-base-background: #292d3e;
    --color-base-background-hover: #41465b;
  }
}

.querymesh-ai-settings__back {
  display: inline-block;
  margin-bottom: 1.25rem;
}

.querymesh-ai-settings h1 {
  margin: 0;
  color: inherit;
  font-size: clamp(1.7rem, 5vw, 2.35rem);
  line-height: 1.2;
}

.querymesh-ai-settings__intro {
  max-width: 68ch;
  margin: 0.75rem 0 1.5rem;
  line-height: 1.6;
}

.querymesh-ai-settings__form {
  display: grid;
  gap: 0.65rem;
  max-width: 42rem;
}

.querymesh-ai-settings__form > label:not(.querymesh-ai-settings__toggle) {
  margin-top: 0.8rem;
  font-weight: 650;
}

.querymesh-ai-settings__form select,
.querymesh-ai-settings__form textarea,
.querymesh-ai-settings__form input[type="number"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.65rem;
  padding: 0.45rem 0.65rem;
  color: var(--color-base-font, #222);
  font: inherit;
  background: var(--color-base-background, #fff);
  border: 1px solid var(--color-base-background-hover, #aeb5c2);
  border-radius: 6px;
}

.querymesh-ai-settings__form textarea {
  min-height: 7rem;
  line-height: 1.5;
  resize: vertical;
}

.querymesh-ai-settings__toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: fit-content;
  font-weight: 650;
}

.querymesh-ai-settings__toggle input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: #536dfe;
}

.querymesh-ai-settings__model-row {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
}

.querymesh-ai-settings__model-row select {
  flex: 1 1 auto;
  min-width: 0;
}

.querymesh-ai-settings__provider-status[data-ready="true"] {
  color: #18794e;
}

.querymesh-ai-settings__provider-status[data-ready="false"] {
  color: #9b5c00;
}

.querymesh-ai-settings__note {
  line-height: 1.55;
}

.querymesh-ai-settings__note code {
  overflow-wrap: anywhere;
}

.querymesh-ai-settings__save {
  justify-self: start;
  margin-top: 0.8rem;
}

@media (max-width: 600px) {
  .querymesh-ai-summary {
    margin: 1rem 0;
    padding: 0.85rem;
  }

  .querymesh-ai-summary__header {
    align-items: stretch;
  }

  .querymesh-ai-summary h2 {
    flex-basis: 100%;
  }

  .querymesh-ai-settings__model-row {
    flex-direction: column;
  }

  .querymesh-ai-settings__model-row button {
    width: 100%;
  }
}

