:root {
  color-scheme: light;
  --bg: #f6f8f6;
  --surface: #ffffff;
  --surface-soft: #eef7f4;
  --ink: #101715;
  --muted: #5d6b66;
  --line: #dce5e0;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e2f3f0;
  --rose: #be123c;
  --shadow: 0 18px 45px rgba(17, 24, 22, 0.08);
}

:root[data-theme="dark"] {
  --bg: #0f1513;
  --surface: #141d1a;
  --surface-soft: #172823;
  --ink: #edf5f2;
  --muted: #a9bab4;
  --line: #2b3b36;
  --accent: #2dd4bf;
  --accent-strong: #7ddfd3;
  --accent-soft: #153a34;
  --rose: #fb7185;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

:root[data-theme="dark"] .empty-list {
  color: #c7d8d2;
  background: rgba(20, 29, 26, 0.78);
  border-color: var(--line);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  filter: brightness(1.08);
}

:root[data-theme="dark"] #query-input {
  background: #101815;
}

:root[data-theme="dark"] .hero-search {
  background: #121b18;
}

:root[data-theme="dark"] .status,
:root[data-theme="dark"] .footer-inner {
  background: rgba(20, 29, 26, 0.78);
}

:root[data-theme="dark"] .result-image {
  background: #10201c;
}

:root[data-theme="dark"] .hero-pills span,
:root[data-theme="dark"] .example-group button,
:root[data-theme="dark"] .examples button,
:root[data-theme="dark"] .result-score {
  border-color: #23534b;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.page-shell {
  width: min(1320px, calc(100% - clamp(16px, 4vw, 40px)));
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px) 0 48px;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}


.site-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(4px, 1.5vw, 12px);
}

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

.top-action-button,
.top-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 11px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
}

.top-action-button {
  cursor: pointer;
}

.top-action-button:hover,
.top-action-button:focus-visible,
.top-action-link:hover,
.top-action-link:focus-visible {
  filter: brightness(1.08);
  text-decoration: none;
}

@media (max-width: 560px) {
  .site-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.product-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
  gap: clamp(22px, 4vw, 52px);
  align-items: center;
  padding: clamp(20px, 4vw, 44px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-search,
.primary-column,
.support-column,
.answer-panel,
.commentary-panel,
.debug-panel,
.support-section {
  min-width: 0;
}

.hero-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.faq-link,
.faq-cta a {
  color: var(--accent-strong);
  font-weight: 850;
  text-decoration: none;
}

.faq-link {
  font-size: 0.84rem;
  white-space: nowrap;
}

.faq-link:hover,
.faq-link:focus-visible,
.faq-cta a:hover,
.faq-cta a:focus-visible {
  text-decoration: underline;
}

.product-hero h1 {
  margin: 10px 0 14px;
  max-width: 15ch;
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.hero-intro {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.25vw, 1.1rem);
  line-height: 1.58;
}

.universe-link-row {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.universe-link-row a {
  color: var(--accent-strong);
  font-weight: 850;
  text-decoration: none;
}

.universe-link-row a:hover,
.universe-link-row a:focus-visible {
  text-decoration: underline;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.hero-pills span {
  padding: 6px 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid #cbe5df;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

/* ==========================================================================
   Search form
   ========================================================================== */

.hero-search {
  padding: clamp(16px, 2vw, 22px);
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.chat-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 750;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 10px;
  align-items: stretch;
}

#query-input {
  width: 100%;
  min-width: 0;
  min-height: 60px;
  height: 60px;
  max-height: 150px;
  padding: 10px 18px 8px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1.35;
  outline: none;
  resize: none;
  overflow: hidden;
  scrollbar-width: none;
}

#query-input.is-scrollable {
  overflow-y: auto;
}

#query-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}


#submit-button {
  min-height: 60px;
  height: auto;
  align-self: stretch;
  padding: 0 24px;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
  font-weight: 850;
}

#submit-button:hover,
#submit-button:focus-visible {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

@media (max-width: 560px) {
  .input-row {
    grid-template-columns: 1fr;
  }

  #submit-button {
    width: 100%;
  }
}

/* ==========================================================================
   Query rewrites
   ========================================================================== */

.query-rewrites {
  margin-top: 10px;
  padding: 9px 11px;
  color: var(--muted);
  background: #f4faf8;
  border: 1px solid #d4e6e1;
  border-radius: 8px;
  font-size: 0.9rem;
}

.query-rewrite-row + .query-rewrite-row {
  margin-top: 4px;
}

.query-rewrites span {
  color: var(--accent-strong);
  font-weight: 850;
}

.query-rewrites strong {
  color: var(--ink);
  font-weight: 650;
}

/* ==========================================================================
   Examples
   ========================================================================== */

.example-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.example-panel-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  align-items: baseline;
}

.example-heading,
.example-label {
  margin: 0;
  font-weight: 850;
}

.example-heading {
  color: var(--ink);
  font-size: 0.92rem;
}

.example-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.example-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 10px;
  margin-top: 10px;
}

.example-group {
  min-width: 0;
}

.example-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.example-group button {
  width: 100%;
  min-height: 38px;
  margin: 0 0 6px;
  padding: 7px 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid #cbe5df;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 750;
  text-align: left;
}

.example-group button:hover,
.example-group button:focus-visible {
  background: #d4ece7;
}

/* Compatibility if an older HTML still uses .examples */
.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.examples button {
  min-height: 36px;
  padding: 7px 11px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid #cbe5df;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 750;
}

/* ==========================================================================
   Status and response layout
   ========================================================================== */

.status {
  min-height: 42px;
  margin: 18px 0;
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.status.error {
  color: var(--rose);
  background: #fff1f3;
  border-color: #fac7d2;
}

.status.loading {
  color: var(--accent-strong);
  background: var(--surface-soft);
  border-color: #cbe5df;
}

.response-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 22px;
  align-items: start;
}

.primary-column,
.support-column {
  display: grid;
  gap: 18px;
}

.answer-panel {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.commentary-panel {
  padding: 18px 20px;
  background: var(--surface-soft);
  border: 1px solid #cbe5df;
  border-radius: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

.truth-note,
.count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.answer-text {
  font-size: 1rem;
  line-height: 1.62;
  font-weight: 450;
}

.answer-text p {
  margin: 0 0 0.85rem;
}

.answer-text h2,
.answer-text h3,
.answer-text h4 {
  margin: 1.15rem 0 0.45rem;
  line-height: 1.25;
  font-weight: 820;
}

.answer-text h2 {
  font-size: 1.22rem;
}

.answer-text h3 {
  font-size: 1.08rem;
}

.answer-text h4 {
  font-size: 1rem;
}

.answer-text ul,
.answer-text ol {
  margin: 0.4rem 0 0.9rem;
  padding-left: 1.35rem;
}

.answer-text li {
  margin: 0.25rem 0;
}

.answer-text strong {
  font-weight: 780;
}

.commentary-text {
  margin: 0;
  color: #173d39;
  font-size: 1.02rem;
}

/* ==========================================================================
   Debug panel
   ========================================================================== */

.debug-panel {
  padding: 14px 16px;
  color: #25302d;
  background: #fbfdfb;
  border: 1px dashed #b8c8c2;
  border-radius: 12px;
}

.debug-panel summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  cursor: pointer;
}

.debug-panel summary small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.debug-fields {
  display: grid;
  grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
  gap: 6px 12px;
  margin: 12px 0 0;
  font-size: 0.9rem;
}

.debug-fields dt {
  color: var(--muted);
  font-weight: 850;
}

.debug-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.debug-attempts {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.debug-attempts-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

/* ==========================================================================
   Character cards
   ========================================================================== */

.support-section {
  padding-top: 4px;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.empty-list {
  padding: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed #cfdad5;
  border-radius: 12px;
}

.result-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-width: 0;
  min-height: 132px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.result-card.no-image {
  grid-template-columns: 1fr;
  min-height: auto;
}

.result-image {
  display: block;
  width: 96px;
  height: 128px;
  max-height: 128px;
  object-fit: contain;
  object-position: center top;
  align-self: start;
  border-radius: 8px;
  background: #edf5f2;
}

.result-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  padding: 2px 4px 2px 0;
}

.result-title {
  margin: 0 0 5px;
  font-size: 1rem;
  font-weight: 830;
  line-height: 1.18;
}

.result-title a,
.result-title a:link,
.result-title a:visited {
  color: inherit;
  text-decoration: none;
}

.result-title a::after {
  content: " ↗";
  color: var(--accent-strong);
  font-size: 0.82em;
}

.result-title a:hover,
.result-title a:focus-visible {
  color: var(--accent-strong);
}

.result-summary {
  display: -webkit-box;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.38;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-badges,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.result-score {
  display: inline-block;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dff4ef;
  color: #00665e;
  font-size: 0.76rem;
  font-weight: 850;
}

.near-miss-title {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
}

/* ==========================================================================
   Search modes section
   ========================================================================== */

.product-section {
  margin: 18px 0;
}

.compact-intro {
  margin-bottom: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(17, 24, 22, 0.04);
}

.compact-intro h2 {
  margin: 5px 0 0;
  font-size: 1.32rem;
  line-height: 1.2;
}

.compact-intro p:not(.eyebrow) {
  margin: 8px 0 0;
  max-width: 86ch;
  color: var(--muted);
  line-height: 1.55;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}

.mode-card {
  min-width: 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(17, 24, 22, 0.04);
}

.mode-number {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
}

.mode-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.25;
}

.mode-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.48;
}

.mode-example {
  margin-top: 12px !important;
  padding-top: 10px;
  color: var(--accent-strong) !important;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 750;
}

.faq-cta {
  margin: 12px 0 0;
  padding: 13px 15px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* ==========================================================================
   FAQ page
   ========================================================================== */

.faq-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 24px;
  align-items: start;
  padding: clamp(24px, 4vw, 44px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.faq-hero h1 {
  max-width: 14ch;
  margin: 10px 0 12px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.faq-hero p:not(.eyebrow) {
  max-width: 76ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.faq-back-link {
  align-self: start;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 14px;
  margin-top: 18px;
}

.faq-card {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(17, 24, 22, 0.04);
}

.faq-card h2 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.25;
}

.faq-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 560px) {
  .faq-actions {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   Small screens only
   ========================================================================== */

@media (max-width: 560px) {
  .product-hero h1,
  .faq-hero h1 {
    max-width: none;
    font-size: 2rem;
    letter-spacing: -0.04em;
  }

  .hero-topline,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  #submit-button {
    width: 100%;
  }

  .answer-text {
    font-size: 1.06rem;
  }

  .debug-fields {
    grid-template-columns: 1fr;
  }

  .result-card {
    grid-template-columns: 76px minmax(0, 1fr);
    min-height: 108px;
  }

  .result-image {
    width: 76px;
    height: 104px;
    max-height: 104px;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  width: min(1320px, calc(100% - clamp(16px, 4vw, 40px)));
  margin: 0 auto;
  padding: 0 0 36px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px 24px;
  padding: 16px 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.footer-text {
  margin: 0;
  font-size: 0.92rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.footer-links a {
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 850;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 560px) {
  .footer-inner {
    flex-direction: column;
  }

  .footer-links {
    align-items: flex-start;
  }
}