@font-face {
  font-family: "Google Sans Flex";
  src: url("/assets/fonts/google-sans-flex-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Google Sans Flex";
  src: url("/assets/fonts/google-sans-flex-medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Google Sans Flex";
  src: url("/assets/fonts/google-sans-flex-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --blue: #4285f4;
  --red: #ea4335;
  --yellow: #fbbc05;
  --green: #34a853;
  --page: #ffffff;
  --surface: #ffffff;
  --section: #f8f9fa;
  --ink: #202124;
  --muted: #5f6368;
  --subtle: #80868b;
  --icon: #9aa0a6;
  --hairline: #dfe1e5;
  --soft: #f8f9fa;
  --button-text: #3c4043;
  --accent: #1a73e8;
  --accent-hover: #1765cc;
  --accent-text: #ffffff;
  --operator: #1558d6;
  --quote: #137333;
  --exclude: #c5221f;
  --logic: #9334e6;
  --error: #b3261e;
  --success: #137333;
  --shadow: rgba(60, 64, 67, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: "Google Sans Flex", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
  touch-action: manipulation;
}

.topbar {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  width: 100%;
  padding: 22px 28px;
}

.about-link {
  color: var(--button-text);
  font-size: 14px;
  text-decoration: none;
}

.about-link:hover {
  text-decoration: underline;
}

.search-stage {
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 88px 24px 56px;
}

.wordmark {
  margin: -34px 0 32px;
  font-size: clamp(48px, 7vw, 76px);
  font-variation-settings: "ROND" 100;
  font-weight: 500;
  letter-spacing: -0.07em;
  line-height: 1;
  white-space: nowrap;
}

.wordmark span {
  display: inline-block;
}

.wordmark .blue {
  color: var(--blue);
}

.wordmark .red {
  color: var(--red);
}

.wordmark .yellow {
  color: var(--yellow);
}

.wordmark .green {
  color: var(--green);
}

.wordmark .ink {
  color: var(--ink);
  margin-left: 0.08em;
}

#search-form {
  width: 100%;
  max-width: 640px;
  min-width: 0;
}

.search-box {
  display: flex;
  min-height: 54px;
  align-items: center;
  border: 1px solid var(--hairline);
  border-radius: 28px;
  background: var(--surface);
  padding: 8px 14px 8px 17px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.search-box:hover,
.search-box:focus-within,
.search-box.is-dragging {
  border-color: var(--icon);
  box-shadow: 0 1px 3px var(--shadow);
}

.search-box.is-dragging {
  outline: 2px solid rgba(66, 133, 244, 0.35);
  outline-offset: 3px;
}

.search-icon {
  width: 21px;
  flex: 0 0 auto;
  margin-right: 13px;
  fill: none;
  stroke: var(--icon);
  stroke-linecap: round;
  stroke-width: 1.8;
}

#query {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  max-height: 116px;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  line-height: 28px;
}

#query::placeholder {
  color: var(--subtle);
}

.clear-button {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  cursor: pointer;
  border: 0;
  border-left: 1px solid var(--hairline);
  background: transparent;
  padding: 8px 0 8px 12px;
  visibility: hidden;
  pointer-events: none;
}

.clear-button.is-visible {
  visibility: visible;
  pointer-events: auto;
}

.clear-button svg {
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.syntax-preview {
  display: flex;
  height: 30px;
  min-height: 30px;
  overflow: hidden;
  padding: 10px 18px 0;
  color: var(--icon);
  font-size: 13px;
}

.status-message[hidden] {
  display: none;
}

#query-preview {
  overflow: hidden;
  color: var(--subtle);
  font-family: inherit;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#query-preview .keyword,
.example-card .keyword {
  color: var(--operator);
  font-weight: 700;
}

#query-preview .quote,
.example-card .quote {
  color: var(--quote);
  font-weight: 600;
}

#query-preview .exclude,
.example-card .exclude {
  color: var(--exclude);
  font-weight: 700;
}

#query-preview .logic {
  color: var(--logic);
  font-weight: 700;
}

.toolbelt {
  margin-top: 13px;
}

.toolbelt > p {
  margin: 0 0 9px 2px;
  color: var(--subtle);
  font-size: 12px;
}

.mobile-tool-hint {
  display: none;
}

.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.query-tool {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  cursor: grab;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--surface);
  padding: 5px 12px 5px 8px;
  color: var(--muted);
  font-size: 12px;
  transition: background 120ms ease, border-color 120ms ease;
}

.query-tool:hover {
  border-color: var(--operator);
  background: var(--soft);
  color: var(--operator);
}

.query-tool:active {
  cursor: grabbing;
}

.tool-symbol {
  display: inline-grid;
  min-width: 25px;
  height: 22px;
  place-items: center;
  border-radius: 11px;
  background: var(--soft);
  padding: 0 6px;
  color: var(--operator);
  font-size: 11px;
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 11px;
  margin-top: 28px;
}

.actions button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0 17px;
  font-size: 14px;
}

.primary-action {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 500;
}

.primary-action:hover {
  background: var(--accent-hover);
}

.actions button:disabled {
  cursor: progress;
  opacity: 0.78;
}

.secondary-action {
  background: var(--soft);
  color: var(--button-text);
}

.secondary-action:hover {
  border-color: var(--hairline);
}

.button-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, currentColor 38%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.actions button.is-loading .button-spinner {
  display: inline-block;
}

.shortcut-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 14px;
  margin: 11px 0 0;
  color: var(--subtle);
  font-size: 11px;
}

.shortcut-hints kbd {
  min-width: 19px;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  background: var(--surface);
  padding: 1px 4px;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  text-align: center;
}

.shortcut-hints kbd + kbd {
  margin-left: 3px;
}

.nano-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 13px 0 0;
  color: var(--subtle);
  font-size: 11px;
  text-align: center;
}

.nano-option[hidden],
.nano-button[hidden] {
  display: none;
}

.nano-option.is-ready {
  color: var(--success);
}

.feedback-region {
  min-height: 44px;
}

.nano-button {
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 2px;
  color: var(--accent);
  font-size: inherit;
  font-weight: 500;
}

.nano-button:hover {
  text-decoration: underline;
}

.nano-button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.status-message {
  margin: 13px 0 0;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.status-message.is-error {
  color: var(--error);
}

.status-message.is-success {
  color: var(--success);
}

.privacy-note {
  width: min(100%, 640px);
  margin: 29px 0 0;
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 7px;
  border: 1px solid var(--hairline);
  border-radius: 11px;
  background: var(--surface);
  padding: 2px 8px;
  color: var(--muted);
  white-space: nowrap;
}

.model-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.model-badge[data-mode="nano"] .model-dot {
  background: var(--success);
}

.model-select {
  max-width: 170px;
  cursor: pointer;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.model-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.model-select:disabled {
  cursor: progress;
}

.explainer {
  display: grid;
  min-height: 70vh;
  grid-template-columns: 0.9fr 1.1fr;
  align-items: center;
  gap: clamp(40px, 8vw, 130px);
  background: var(--section);
  padding: clamp(70px, 10vw, 140px) max(24px, calc((100vw - 1100px) / 2));
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--operator);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.explainer h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(34px, 4.4vw, 58px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.example-card {
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--surface);
  padding: clamp(24px, 4vw, 42px);
}

.example-card p {
  margin: 0;
  color: var(--button-text);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.5;
}

.example-card .example-label {
  margin-bottom: 9px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.example-card code {
  color: var(--button-text);
  font-family: inherit;
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.6;
}

.example-arrow {
  margin: 20px 0;
  color: var(--blue);
  font-size: 24px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--hairline);
  padding: 22px max(24px, calc((100vw - 1100px) / 2));
  color: var(--muted);
  font-size: 12px;
}

.info-page {
  min-height: 100svh;
  background: var(--page);
}

.info-header {
  display: flex;
  width: min(100% - 40px, 760px);
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  border-bottom: 1px solid var(--hairline);
  padding: 22px 0;
}

.info-brand,
.info-back {
  color: var(--button-text);
  text-decoration: none;
}

.info-brand {
  font-size: 18px;
  font-weight: 500;
}

.info-back {
  font-size: 13px;
}

.info-brand:hover,
.info-back:hover,
.info-content a:hover {
  text-decoration: underline;
}

.info-content {
  width: min(100% - 40px, 760px);
  margin: 0 auto;
  padding: 58px 0 90px;
}

.info-content h1 {
  margin: 0 0 14px;
  font-size: clamp(38px, 7vw, 58px);
  font-weight: 500;
  letter-spacing: -0.04em;
}

.info-intro {
  max-width: 620px;
  margin: 0 0 52px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.info-section {
  border-top: 1px solid var(--hairline);
  padding: 28px 0;
}

.info-section h2 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 500;
}

.info-section p,
.info-section li {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.info-section p {
  margin: 0 0 12px;
}

.info-section p:last-child {
  margin-bottom: 0;
}

.info-section ul {
  margin: 0;
  padding-left: 20px;
}

.info-content a {
  color: var(--accent);
}

.info-updated {
  margin: 30px 0 0;
  color: var(--subtle);
  font-size: 12px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

@media (prefers-color-scheme: dark) {
  :root {
    --page: #202124;
    --surface: #303134;
    --section: #171717;
    --ink: #e8eaed;
    --muted: #bdc1c6;
    --subtle: #9aa0a6;
    --icon: #9aa0a6;
    --hairline: #5f6368;
    --soft: #303134;
    --button-text: #e8eaed;
    --accent: #8ab4f8;
    --accent-hover: #aecbfa;
    --accent-text: #202124;
    --operator: #8ab4f8;
    --quote: #81c995;
    --exclude: #f28b82;
    --logic: #c58af9;
    --error: #f28b82;
    --success: #81c995;
    --shadow: rgba(0, 0, 0, 0.22);
  }
}

@media (max-width: 720px) {
  .search-page {
    height: 100svh;
    overflow: hidden;
  }

  .search-page main {
    height: 100%;
  }

  .topbar {
    gap: 14px;
    padding: 14px 16px;
  }

  .about-link {
    font-size: 13px;
  }

  .search-stage {
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: clamp(108px, 19svh, 164px) 18px 16px;
  }

  .wordmark {
    margin: 0 0 28px;
    font-size: clamp(34px, 10vw, 42px);
    letter-spacing: -0.07em;
  }

  .search-box {
    min-height: 48px;
    border-radius: 24px;
    padding: 6px 11px 6px 15px;
  }

  .search-icon {
    width: 20px;
    margin-right: 12px;
  }

  #query {
    height: 25px !important;
    min-height: 25px;
    max-height: 25px;
    overflow-x: auto;
    overflow-y: hidden;
    font-size: 16px;
    line-height: 25px;
    scrollbar-width: none;
    white-space: pre;
  }

  #query::-webkit-scrollbar {
    display: none;
  }

  .clear-button {
    width: 34px;
    height: 34px;
    padding-left: 10px;
  }

  .toolbelt {
    display: none;
  }

  .syntax-preview {
    display: none;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
  }

  .actions button {
    min-width: 0;
    min-height: 40px;
    padding-inline: 12px;
  }

  #search-button {
    background: var(--soft);
    color: var(--button-text);
    font-weight: 400;
  }

  #search-button:hover {
    border-color: var(--hairline);
    background: var(--soft);
  }

  #generate-button {
    background: var(--soft);
    color: var(--button-text);
    font-weight: 400;
  }

  #example-button {
    display: none;
  }

  .shortcut-hints {
    display: none;
  }

  .nano-option {
    flex-wrap: wrap;
    margin-top: 11px;
  }

  .status-message {
    margin-top: 11px;
  }

  .feedback-region {
    min-height: 48px;
  }

  .privacy-note {
    margin-top: 6px;
    padding-inline: 6px;
  }

  .model-badge {
    margin: 0;
  }

  .privacy-copy {
    display: none;
  }

  .explainer {
    grid-template-columns: 1fr;
    gap: 32px;
    min-height: auto;
    padding: 64px 20px;
    contain-intrinsic-size: auto 780px;
  }

  .explainer h2 {
    font-size: clamp(31px, 10vw, 42px);
  }

  .example-card {
    border-radius: 14px;
    padding: 22px;
  }

  .info-content {
    padding: 42px 0 64px;
  }

  footer {
    flex-direction: column;
    padding: 20px;
  }
}

@media (max-width: 720px) and (max-height: 560px) {
  .search-page .topbar,
  .search-page .feedback-region,
  .search-page .privacy-note {
    display: none;
  }

  .search-stage {
    padding-top: 52px;
  }

  .wordmark {
    margin-bottom: 18px;
    font-size: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
