:root {
  color-scheme: light;
  --search-page: #f7f3eb;
  --search-ink: #363840;
  --search-muted: #746d65;
  --search-accent: #625f7b;
  --search-focus: #68617e;
  --search-line: #ded7cc;
  --search-panel: #fffdf8;
  --search-control: #f5f0e7;
  --search-raised: #ebe5db;
  --search-field: #fffcf6;
  --search-button-ink: #fffdf8;
  --search-success: #376b52;
  --search-error: #a33d50;
  --search-backdrop: #514a4266;
  --search-width: min(880px, 100%);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--search-ink);
  background: var(--search-page);
  font: 400 16px/1.6 "Orin Manrope", "Orin Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  isolation: isolate;
}
html:lang(km) body {
  font-family: "Orin Manrope", "Noto Sans Khmer", "Leelawadee UI", system-ui, sans-serif;
}
body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
}
body::before {
  background: var(--search-page) url('/assets/brand/ai-search-ivory-wave-20261119.webp') center bottom / 100% auto no-repeat;
  background-blend-mode: multiply;
  opacity: .36;
}
.is-chatting::before { opacity: .10; }

@media (max-width: 600px) {
  body::before { background-size: auto 38%; }
}

a { color: inherit; }
button, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--search-focus); outline-offset: 4px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.search-header {
  width: min(1500px, 100%);
  margin-inline: auto;
  padding: 22px clamp(20px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.search-brand { display: block; position: relative; flex: none; }
.search-brand img { display: block; width: clamp(126px, 12vw, 160px); height: auto; }
.search-nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 34px); }
.home-link { text-decoration: none; font-size: 14px; }
.home-link:hover { text-decoration: underline; text-underline-offset: 5px; }
.language-picker {
  position: relative;
  display: flex;
  align-items: center;
}
.language-picker img { position: absolute; inset-inline-start: 13px; pointer-events: none; opacity: .86; }
.language-picker img, .quick-links img { opacity: .72; }
.language-picker select {
  min-height: 44px;
  padding: 7px 12px 7px 36px;
  border: 1px solid var(--search-line);
  border-radius: 100px;
  background: transparent;
  font-size: 14px;
}

.search-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: calc(100% - 40px);
  flex: 1;
  margin-inline: auto;
  padding: 54px 0 clamp(84px, 13vh, 138px);
}
.search-intro { max-width: 820px; margin: 0 auto 38px; text-align: center; }
.search-intro h1 {
  margin: 0 0 13px;
  font-size: clamp(34px, 4.45vw, 58px);
  font-weight: 300;
  line-height: 1.16;
  letter-spacing: -.042em;
  text-wrap: balance;
}
html:lang(zh) .search-intro h1 { letter-spacing: -.025em; color: #4d4961; }
.search-intro p {
  margin: 0;
  color: var(--search-muted);
  font-size: clamp(14px, 1.25vw, 16px);
  text-wrap: balance;
}
.search-controls, .chat { width: var(--search-width); margin-inline: auto; }
body:not(.is-chatting) .search-controls { width: min(660px, 100%); }
.question-form { margin: 0; }
.question-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px 13px 25px;
  border: 1px solid var(--search-line);
  border-radius: 38px;
  background: var(--search-panel);
  box-shadow: 0 11px 26px -20px #7f6f5270;
}
.question-field:focus-within {
  border-color: var(--search-focus);
  box-shadow: 0 0 0 3px #eae4de, 0 11px 26px -20px #7f6f5270;
}
.question-form textarea {
  display: block;
  flex: 1;
  width: 0;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  max-height: 170px;
  padding: 8px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 16px;
  line-height: 26px;
}
.question-form textarea::placeholder { color: var(--search-muted); opacity: 1; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.search-attachments { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 18px; }
.search-action {
  max-width: 100%;
  min-height: 36px;
  padding: 5px 12px;
  border: 1px solid var(--search-line);
  border-radius: 100px;
  background: var(--search-control);
  color: var(--search-ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.search-action:hover { background: var(--search-raised); }
.search-action:disabled { opacity: .6; }
/* These page controls are also matched by the shared glass-button theme. */
#question-form .search-action, #messages .search-action, #messages .retry, #reset {
  --om-button-ink: var(--search-ink);
  --om-button-solid: var(--search-control);
  --om-button-paint: var(--search-control);
  --om-button-hover: var(--search-raised);
  border-color: var(--search-line) !important;
  box-shadow: none !important;
}
#question-form .search-attachments .search-action {
  --om-button-paint: transparent;
  --om-button-hover: var(--search-control);
  --om-button-ink: var(--search-muted);
  min-height: 40px;
  padding: 6px 8px;
  border-color: transparent !important;
  font-size: 13px;
}
#composer-status {
  margin: 6px 6px 0;
  color: var(--search-muted);
  font-size: 12px;
}
#composer-status:empty { display: none; }
.send {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--search-focus);
  color: var(--search-button-ink);
  font: 500 27px/1 system-ui, sans-serif;
}
#send {
  --om-button-ink: var(--search-button-ink);
  --om-button-solid: var(--search-focus);
  --om-button-paint: var(--search-focus);
  --om-button-hover: #5c566f;
  box-shadow: none !important;
}
#send:disabled { opacity: .65; box-shadow: none !important; }
.privacy-notice { margin: 11px 8px 0; color: var(--search-muted); font-size: 12px; text-align: center; }
.quick-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 31px auto 0;
}
.quick-links a,
.chat-header button,
.retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 17px;
  border: 1px solid var(--search-line);
  border-radius: 100px;
  background: var(--search-control);
  text-decoration: none;
  font-size: 14px;
}
.quick-links a:hover, .chat-header button:enabled:hover, .retry:enabled:hover { background: var(--search-raised); border-color: var(--search-focus); }
.chat-header button:disabled { opacity: .62; }

.search-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-inline: auto;
  padding: 15px 20px max(20px, env(safe-area-inset-bottom));
  color: var(--search-muted);
  font-size: 12px;
  text-align: center;
  background: var(--search-page);
}
.search-footer p { margin: 0; }
.search-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px 15px; }
.search-footer a { text-underline-offset: 3px; }

.is-chatting .search-main {
  display: flex;
  flex-direction: column;
  min-height: 410px;
  flex: 1 1 0;
  padding: 12px 0 18px;
}
.is-chatting .search-controls { flex: none; }
.chat { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--search-line);
}
.chat-header h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 19px; font-weight: 500; }
.chat-header button { color: var(--search-ink); }
.messages {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px 5px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--search-line) transparent;
}
.turn { margin-bottom: 23px; overflow-wrap: anywhere; }
.turn .label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--search-muted); }
.turn .bubble {
  width: fit-content;
  max-width: 100%;
  padding: 13px 17px;
  border: 1px solid var(--search-line);
  border-radius: 17px;
  background: var(--search-panel);
}
.turn.user { display: flex; flex-direction: column; align-items: flex-end; }
.turn.user .bubble { max-width: 85%; color: #4c465e; background: #ebe6ee; white-space: pre-wrap; border-color: #d8cfdc; }
.turn.error .bubble { color: var(--search-error); border-color: #d9b7bb; background: #fcf0ed; }
.turn.pending .bubble { color: var(--search-muted); }
.turn.pending .streaming-text { white-space: pre-wrap; color: var(--search-ink); }
.turn-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 4px; font-size: 12px; }
.turn > .search-action { margin-top: 4px; }
.search-references {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--search-line);
  font-size: 13px;
}
.search-references summary { cursor: pointer; color: var(--search-accent); }
.search-references li p { margin-top: 3px; color: var(--search-muted); }
.consultations {
  width: min(520px,calc(100% - 32px));
  max-height: 80dvh;
  padding: 22px;
  border: 1px solid var(--search-line);
  border-radius: 22px;
  background: var(--search-panel);
  color: var(--search-ink);
  box-shadow: 0 18px 55px #50432f26;
}
.consultations::backdrop { background: var(--search-backdrop); }
.consultations-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.consultations h2 { margin: 0; font-size: 20px; font-weight: 500; }
.consultations p { font-size: 13px; color: var(--search-muted); }
.consultations ul { margin: 0; padding: 0; list-style: none; }
.consultations li { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 8px; border-top: 1px solid var(--search-line); }
.consultations li > :first-child {
  flex: 1 1 140px;
  text-align: start;
  border-radius: 10px;
}
.consultations [aria-current="true"] { background: var(--search-raised); border-color: var(--search-focus); }
.turn p { margin: 0 0 .65em; }
.turn p:last-child { margin-bottom: 0; }
.turn ul, .turn ol { padding-inline-start: 1.35em; margin: .55em 0; }
.turn li + li { margin-top: .35em; }
.turn a { color: var(--search-accent); text-underline-offset: 3px; }
.turn code { padding: 1px 4px; background: var(--search-raised); border-radius: 4px; }
.turn .bubble:has(> .oli-answer-table) { width: 100%; }
.turn .oli-answer-table {
  max-width: 100%; margin-block: .8em; overflow-x: auto; overscroll-behavior-x: contain;
  border: 1px solid var(--search-line); border-radius: 10px; white-space: normal;
  scrollbar-width: thin; scrollbar-color: var(--search-line) var(--search-field);
}
.turn .oli-answer-table:first-child { margin-block-start: 0; }
.turn .oli-answer-table:last-child { margin-block-end: 0; }
.turn .oli-answer-table:focus-visible { outline: 2px solid var(--search-focus); outline-offset: 2px; }
.turn .oli-answer-table table { width: 100%; border-collapse: collapse; background: var(--search-field); }
.turn .oli-answer-table :is(th,td) {
  min-width: 8.5rem; padding: .66em .78em; vertical-align: top; text-align: start;
  border-block-end: 1px solid var(--search-line);
}
.turn .oli-answer-table th { background: var(--search-raised); color: var(--search-ink); font-weight: 600; }
.turn .oli-answer-table td:first-child { font-weight: 500; }
.turn .oli-answer-table tr:nth-child(even) td { background: var(--search-control); }
.turn .oli-answer-table tbody tr:last-child td { border-block-end: 0; }
.turn .oli-answer-table .align-center { text-align: center; }
.turn .oli-answer-table .align-end { text-align: end; }
.turn .sources { border-top: 1px solid var(--search-line); margin-top: 12px; padding-top: 9px; font-size: 13px; }
.turn .cutoff { margin-top: 10px; font-size: 13px; color: var(--search-muted); }
.turn .retry { color: var(--search-ink); margin-top: 9px; }
.is-chatting .question-field { border-radius: 26px; }

@media (max-width: 600px) {
  .search-header { padding: 14px 16px; }
  .search-nav { gap: 11px; }
  .home-link, .language-picker select { font-size: 12px; }
  .language-picker select { padding-left: 30px; padding-right: 4px; }
  .language-picker img { left: 9px; width: 15px; height: 15px; }
  .search-main { width: calc(100% - 32px); padding-top: 38px; padding-bottom: 78px; }
  .search-intro { margin-bottom: 27px; }
  .search-intro h1 { font-size: clamp(31px, 7.8vw, 43px); }
  html:lang(zh) .search-intro h1 { font-size: clamp(29px, 7.8vw, 43px); letter-spacing: -.025em; max-width: 7em; margin-inline: auto; }
  .search-intro p { line-height: 1.65; }
  html:lang(zh) .search-intro p { max-width: 16em; margin-inline: auto; text-wrap: wrap; }
  .question-field { padding: 10px 10px 10px 18px; border-radius: 34px; gap: 8px; }
  .question-form textarea { max-height: 142px; font-size: 16px; }
  .quick-links { margin-top: 25px; gap: 7px; }
  .quick-links a { padding-inline: 10px; font-size: 12px; gap: 5px; }
  .quick-links img { width: 16px; height: 16px; }
  .search-footer { font-size: 11px; }
  .is-chatting .search-main { padding-top: 7px; }
  .turn .bubble { padding: 11px 13px; }
}

@media (max-width: 350px) {
  .search-brand img { width: 104px; }
  .search-nav { gap: 7px; }
  .quick-links a { padding-inline: 8px; }
}

/* Feedback stays available in both the search and conversation views. */
.search-header { flex-wrap: wrap; }
.search-nav { flex: 1 1 300px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; max-width: 100%; row-gap: 6px; }
.feedback-open {
  min-height: 44px; padding: 7px 0; border: 0; background: transparent;
  color: inherit; font-size: 14px; line-height: 1.5; white-space: normal;
}
.feedback-open:enabled:hover { text-decoration: underline; text-underline-offset: 5px; }
.feedback-open:disabled { opacity: .55; }
.language-picker { min-width: 0; max-width: 100%; }
.language-picker select { max-width: 100%; }
.feedback-dialog {
  width: min(560px, calc(100% - 32px)); max-width: calc(100% - 32px);
  max-height: calc(100dvh - 32px); margin: auto; padding: 25px;
  overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere;
  border: 1px solid var(--search-line); border-radius: 24px;
  color: var(--search-ink); background: var(--search-panel);
  box-shadow: 0 22px 80px #50432f33; font-family: inherit;
}
.feedback-dialog::backdrop { background: var(--search-backdrop); backdrop-filter: blur(5px); }
.feedback-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.feedback-heading h2 { margin: 5px 0 0; font-size: 24px; font-weight: 500; line-height: 1.4; }
.feedback-close { flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--search-line); border-radius: 50%; background: var(--search-control); color: var(--search-ink); font-size: 25px; }
.feedback-help { margin: 12px 0 18px; color: var(--search-muted); font-size: 13px; line-height: 1.75; }
.feedback-dialog fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.feedback-dialog fieldset > label:not(.feedback-consent) { display: block; margin: 16px 0 7px; font-size: 14px; }
.feedback-dialog select, .feedback-dialog textarea, .feedback-dialog input[type=email] {
  display: block; width: 100%; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--search-line); border-radius: 12px; background: var(--search-field);
  color: var(--search-ink); font: inherit; font-size: 16px; line-height: 1.5;
}
.feedback-dialog textarea { min-height: 128px; resize: vertical; }
.feedback-dialog textarea::placeholder { color: var(--search-muted); opacity: 1; }
.feedback-count { display: block; margin-top: 5px; text-align: end; color: var(--search-muted); font-size: 11px; }
.feedback-consent { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.7; cursor: pointer; }
.feedback-consent input { flex: none; width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--search-focus); }
.feedback-trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.feedback-status { margin-top: 17px; color: var(--search-success); font-size: 13px; line-height: 1.7; }
.feedback-status:empty { display: none; }
.feedback-status.error { color: var(--search-error); }
.feedback-reference { margin: 6px 0 0; color: var(--search-ink); font-size: 13px; overflow-wrap: anywhere; }
.feedback-submit {
  display: block; width: 100%; min-height: 46px; margin-top: 20px; padding: 10px 15px;
  border: 1px solid var(--search-focus); border-radius: 100px;
  background: var(--search-focus); color: var(--search-button-ink); font-size: 15px;
}
.feedback-submit:enabled:hover { background: #5c566f; }
.feedback-submit:disabled { opacity: .65; cursor: wait; }
@media (max-width: 600px) {
  .search-header { gap: 8px; }
  .search-brand img { width: 98px; }
  .search-nav { flex: 0 1 auto; max-width: calc(100% - 106px); justify-content: flex-end; gap: 5px 9px; }
  .home-link, .feedback-open, .language-picker select { font-size: 11px; }
  .language-picker select { width: 104px; min-height: 40px; padding-inline-end: 4px; }
  .feedback-dialog { padding: 20px; border-radius: 20px; }
}
@media (max-width: 350px) {
  .search-brand img { width: 80px; }
  .search-nav { max-width: calc(100% - 88px); gap: 5px 7px; }
  .language-picker select { width: 99px; }
}
@media (pointer: coarse) {
  .send { width: 44px; height: 44px; }
  #question-form .search-attachments .search-action { min-height: 44px; }
}
