:root {
  color-scheme: light;
  --page-bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --footer-bg: #f2f2f2;
  --text: #202124;
  --text-muted: #5f6368;
  --line: #dadce0;
  --line-strong: #d2d5da;
  --focus-ring: rgba(26, 115, 232, 0.22);
  --shadow-soft: 0 1px 6px rgba(32, 33, 36, 0.16);
  --shadow-strong: 0 8px 24px rgba(32, 33, 36, 0.12);
  --accent: #1a73e8;
  --accent-soft: #e8f0fe;
  --ask-bg: #f7f8fb;
  --ask-pill: #eef2ff;
  --success: #137333;
  --error: #b3261e;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #202124;
  --surface: #202124;
  --surface-muted: #303134;
  --footer-bg: #171717;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --line: #5f6368;
  --line-strong: #73777b;
  --focus-ring: rgba(138, 180, 248, 0.22);
  --shadow-soft: 0 1px 6px rgba(0, 0, 0, 0.45);
  --shadow-strong: 0 12px 28px rgba(0, 0, 0, 0.35);
  --accent: #8ab4f8;
  --accent-soft: #2d3f5e;
  --ask-bg: #2b2c2f;
  --ask-pill: #3a3c40;
  --success: #9ad69a;
  --error: #f28b82;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, sans-serif;
  overflow-x: hidden;
  transition:
    background-color 160ms ease,
    color 160ms ease;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header,
.results-header {
  padding: 16px 24px 0;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.header-spacer {
  min-height: 1px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.theme-toggle:hover {
  box-shadow: var(--shadow-soft);
}

.theme-toggle__icon {
  position: relative;
  display: inline-flex;
  width: 18px;
  height: 18px;
}

.theme-toggle__icon svg {
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-moon {
  opacity: 0;
}

html[data-theme="dark"] .icon-sun {
  opacity: 0;
}

html[data-theme="dark"] .icon-moon {
  opacity: 1;
}

.theme-toggle__text {
  font-size: 14px;
}

.home-main,
.results-main {
  flex: 1;
}

.home-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 24px 56px;
}

.home-hero {
  width: min(100%, 780px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding-top: clamp(10px, 8vh, 72px);
}

.hero-logo {
  width: min(88vw, 520px);
  height: auto;
  display: block;
}

.search-row {
  width: min(100%, 760px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.ask-launch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px 0 20px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(
      90deg,
      rgba(255, 169, 156, 0.95) 0%,
      rgba(255, 220, 163, 0.9) 14%,
      rgba(171, 239, 188, 0.88) 29%,
      rgba(132, 214, 255, 0.96) 51%,
      rgba(78, 154, 255, 0.98) 73%,
      rgba(144, 122, 255, 0.96) 87%,
      rgba(255, 169, 156, 0.95) 100%
    )
    border-box;
  color: #515c68;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    0 10px 26px rgba(113, 166, 255, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.42) inset;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.ask-launch:hover,
.download-card__button:hover,
.tool-button:hover,
.ai-submit:hover,
.ai-panel__close:hover {
  box-shadow: var(--shadow-soft);
}

.ask-launch__icon,
.ask-launch__icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.ask-launch span:last-child {
  letter-spacing: -0.02em;
}

html[data-theme="dark"] .ask-launch {
  background:
    linear-gradient(rgba(43, 44, 47, 0.96), rgba(43, 44, 47, 0.96)) padding-box,
    linear-gradient(
      90deg,
      rgba(255, 169, 156, 0.92) 0%,
      rgba(255, 220, 163, 0.88) 14%,
      rgba(171, 239, 188, 0.84) 29%,
      rgba(132, 214, 255, 0.92) 51%,
      rgba(78, 154, 255, 0.96) 73%,
      rgba(144, 122, 255, 0.96) 87%,
      rgba(255, 169, 156, 0.92) 100%
    )
    border-box;
  color: #d8dfeb;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.download-card {
  width: min(100%, 760px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-muted);
}

.download-card__brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.download-card__brand > div {
  min-width: 0;
}

.download-card__logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--surface);
}

.download-card h2,
.ai-panel h2,
.ai-response h3,
.ai-sources h3 {
  margin: 0;
  font-size: 16px;
}

.download-card p,
.ai-panel__eyebrow,
.ai-status,
.ai-answer p,
.ai-sources li {
  margin: 0;
}

.download-card p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.download-card__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.ai-panel {
  width: min(100%, 760px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--ask-bg);
  box-shadow: var(--shadow-strong);
}

.ai-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.ai-panel__eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-panel__header h2 {
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.2;
}

.ai-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.ai-panel__close svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.ai-form {
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
}

.ai-form:focus-within {
  border-color: transparent;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.ai-prompt {
  width: 100%;
  min-height: 60px;
  resize: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 30px;
  line-height: 1.35;
  outline: none;
}

.ai-prompt::placeholder {
  color: var(--text-muted);
}

.ai-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.ai-toolbar__left,
.ai-toolbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-button,
.image-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.tool-button svg,
.tool-button span {
  pointer-events: none;
}

.tool-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.tool-button.is-active,
.tool-button[aria-pressed="true"] {
  background: var(--ask-pill);
  color: var(--accent);
}

.image-chip {
  border-color: var(--line);
  background: var(--surface-muted);
  cursor: default;
}

.ai-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--line-strong);
  color: var(--surface);
  cursor: pointer;
}

html[data-theme="dark"] .ai-submit {
  color: #202124;
}

.ai-submit svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.ai-status {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

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

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

.ai-response {
  display: grid;
  gap: 18px;
  margin-top: 16px;
}

.ai-response__body,
.ai-sources {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.ai-answer {
  margin-top: 12px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

.ai-answer p + p {
  margin-top: 12px;
}

.ai-answer ul {
  margin: 12px 0 0;
  padding-left: 18px;
}

.ai-sources ul {
  margin: 12px 0 0;
  padding-left: 18px;
}

.ai-sources li + li {
  margin-top: 10px;
}

.ai-sources a {
  color: var(--accent);
  text-decoration: none;
}

.ai-sources a:hover {
  text-decoration: underline;
}

.results-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

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

.results-brand__logo {
  width: 140px;
  height: auto;
  display: block;
}

.results-header__search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.results-main {
  width: min(100%, 1220px);
  margin: 0 auto;
  padding: 22px 24px 48px;
}

.ai-panel--results {
  margin: 0 0 24px 154px;
  width: min(100%, 840px);
}

.results-content {
  min-height: 420px;
  margin-left: 154px;
  max-width: 840px;
}

.site-footer {
  margin-top: auto;
  padding: 0 24px;
  border-top: 1px solid var(--line);
  background: var(--footer-bg);
}

.footer-links {
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.footer-links a {
  text-decoration: none;
}

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

.search-form {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 10px 0 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.search-form:hover,
.search-form:focus-within {
  border-color: transparent;
  box-shadow: var(--shadow-soft);
}

.search-form__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.search-form__input::placeholder {
  color: var(--text-muted);
}

.search-form__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.search-form__submit:hover {
  background: var(--surface-muted);
}

.search-form__submit svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

html[data-theme="dark"] .search-form__submit:hover {
  background: #3a3c40;
}

body .gsc-control-cse,
body .gsc-control-cse-es {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: Arial, sans-serif;
}

body .gsc-control-wrapper-cse {
  width: 100%;
}

body .gsc-above-wrapper-area {
  padding: 0;
  border-bottom: 0;
}

body .gsc-wrapper {
  width: 100%;
}

body .gsc-results-wrapper-overlay,
body .gsc-results-wrapper-visible,
body .gsc-resultsbox-visible {
  position: static !important;
  inset: auto !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body .gsc-modal-background-image,
body .gsc-results-close-btn {
  display: none !important;
}

body .gsc-orderby-container {
  color: var(--text-muted);
}

body .gsc-result-info {
  color: var(--text-muted);
}

body .gsc-results .gsc-cursor-box {
  margin: 30px 0 0;
}

body .gsc-webResult.gsc-result,
body .gsc-results .gsc-imageResult {
  margin: 0 0 26px;
  padding: 0;
  border: 0;
  background: transparent;
}

body .gs-webResult .gs-title,
body .gs-webResult .gs-title * {
  color: var(--accent) !important;
  font-size: 20px;
  font-weight: 400;
  text-decoration: none !important;
}

body .gs-webResult .gs-title {
  margin-bottom: 6px;
}

body .gs-webResult .gs-visibleUrl,
body .gs-webResult .gs-visibleUrl-long,
body .gs-webResult .gs-promotion-image-anchor + .gs-visibleUrl {
  color: var(--success) !important;
}

body .gs-webResult .gs-snippet,
body .gsc-table-result,
body .gsc-thumbnail-inside,
body .gsc-url-top,
body .gcsc-find-more-on-google-root,
body .gcsc-more-maybe-branding-root,
body .gcsc-branding {
  color: var(--text-muted);
}

body .gsc-cursor-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  margin-right: 6px;
  color: var(--accent);
  text-decoration: none;
}

body .gsc-cursor-current-page {
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 1100px) {
  .results-header {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .results-header__search {
    width: 100%;
  }

  .ai-panel--results,
  .results-content {
    margin-left: 0;
    max-width: 100%;
  }
}

@media (max-width: 860px) {
  .search-row,
  .results-header__search {
    grid-template-columns: 1fr;
  }

  .ask-launch,
  .ask-launch--results {
    width: 100%;
  }

  .download-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .download-card__button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .site-header,
  .results-header,
  .results-main,
  .home-main,
  .site-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-logo {
    width: min(260px, calc(100vw - 96px));
    max-width: 100%;
  }

  .home-main,
  .home-hero {
    width: 100%;
    max-width: 100%;
  }

  .search-row,
  .download-card,
  .ai-panel {
    width: 100%;
    max-width: 100%;
  }

  .ai-panel {
    padding: 16px;
    border-radius: 20px;
  }

  .ai-panel__header h2 {
    font-size: 18px;
  }

  .ai-form {
    padding: 14px 14px 12px;
    border-radius: 20px;
  }

  .ai-prompt {
    min-height: 52px;
    font-size: 22px;
  }

  .ai-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-toolbar__left,
  .ai-toolbar__right {
    width: 100%;
  }

  .ai-toolbar__right {
    justify-content: space-between;
  }

  .tool-button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .results-brand__logo {
    width: 118px;
  }

  .footer-links {
    padding: 14px 0;
    gap: 12px 18px;
  }
}

@media (max-width: 520px) {
  .theme-toggle {
    width: 100%;
  }

  .site-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tool-button span {
    display: none;
  }

  .tool-button {
    flex: 0 0 auto;
    width: 42px;
    padding: 0;
  }

  .ai-toolbar__left {
    justify-content: flex-start;
  }

  .download-card__brand {
    align-items: flex-start;
  }

}
