/* General web search tool MVP */
.web-search-entry-chip {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #075985;
}

.web-search-entry-chip:hover,
.web-search-entry-chip:focus-visible {
  border-color: #38bdf8;
  box-shadow: 0 clamp(0.35rem, 1.5vw, 0.65rem) clamp(1rem, 3vw, 1.5rem) rgba(14, 165, 233, 0.12);
}

.web-search-active-header {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1rem);
}

.web-search-scroll-pane {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1rem);
}

.web-search-panel {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1rem);
  width: var(--shopping-composer-width);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.5rem) 0;
  border: 0.0625rem solid #bae6fd;
  border-radius: clamp(1rem, 3vw, 1.5rem);
  background: linear-gradient(180deg, #f0f9ff 0%, #f8fcff 58%, #ffffff 100%);
  box-shadow: 0 clamp(0.5rem, 2vw, 1rem) clamp(1.5rem, 5vw, 2.5rem) rgba(14, 165, 233, 0.08);
}

.web-search-copy {
  display: flex;
  flex-direction: column;
  gap: clamp(0.35rem, 1vw, 0.5rem);
}

.web-search-main-copy,
.web-search-sub-copy,
.web-search-label,
.web-search-status,
.web-search-empty,
.web-search-result-snippet,
.web-search-result-source {
  margin: 0;
  color: #475569;
  line-height: 1.65;
  font-size: clamp(0.88rem, 2vw, 1rem);
}

.web-search-main-copy {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 600;
}

.web-search-form {
  display: flex;
  flex-direction: column;
  gap: var(--shopping-composer-row-gap);
  width: 100%;
  padding: var(--shopping-composer-padding-block) var(--shopping-composer-padding-inline);
  border: 0.0625rem solid #bae6fd;
  border-radius: var(--shopping-composer-radius);
  background: #ffffff;
  box-shadow: 0 clamp(0.35rem, 1vw, 0.55rem) clamp(1rem, 3vw, 1.4rem) rgba(14, 165, 233, 0.08);
}

.web-search-composer-top,
.web-search-composer-bottom,
.web-search-composer-left-actions,
.web-search-composer-actions {
  display: flex;
  align-items: center;
  width: 100%;
}

.web-search-composer-top {
  min-width: 0;
}

.web-search-composer-bottom {
  justify-content: space-between;
  gap: var(--shopping-composer-control-gap);
  flex-wrap: nowrap;
}

.web-search-composer-left-actions,
.web-search-composer-actions {
  gap: var(--shopping-composer-control-gap);
  width: auto;
  min-width: 0;
  flex-wrap: nowrap;
}

.web-search-composer-left-actions {
  flex: 1 1 auto;
  justify-content: flex-start;
}

.web-search-composer-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.web-search-label {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.web-search-input {
  flex: 1;
  min-width: 0;
  padding: clamp(0.7rem, 2vw, 0.9rem) 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #1e293b;
  font-family: inherit;
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
}

.web-search-input:focus {
  outline: none;
}

.web-search-plus-wrap {
  position: relative;
  flex: 0 0 auto;
}

.web-search-plus-button,
.web-search-help-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: var(--shopping-composer-left-button-size);
  block-size: var(--shopping-composer-left-button-size);
  padding: 0;
  border: 0;
  border-radius: 999rem;
  background: #f1f5f9;
  color: #64748b;
  font-family: inherit;
  font-size: clamp(1.45rem, 4vw, 1.8rem);
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.web-search-plus-button:hover,
.web-search-plus-button:focus-visible,
.web-search-help-button:hover,
.web-search-help-button:focus-visible,
.web-search-help-button[aria-expanded="true"] {
  background: #e0f2fe;
  color: #0369a1;
  outline: none;
}

.web-search-help-button {
  border: 0.0625rem solid #bfdbfe;
  background: #ffffff;
  color: #2563eb;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  font-weight: 800;
}

.web-search-plus-button:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

/* Keep help controls with the right-side mic/action group while preserving the left + edge. */
.document-ai-help-button,
.instant-answer-help-button,
.web-search-help-button,
.loveme-help-button,
.home-meal-help-button {
  margin-left: auto;
  inline-size: var(--shopping-composer-right-button-size);
  block-size: var(--shopping-composer-right-button-size);
}

.web-search-help-panel {
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.4vw, 0.75rem);
  padding: clamp(0.75rem, 2vw, 1rem);
  border: 0.0625rem solid #dbeafe;
  border-radius: clamp(0.85rem, 2vw, 1rem);
  background: #ffffff;
}

.web-search-help-panel[hidden] {
  display: none;
}

.web-search-help-title {
  margin: 0;
  color: #0369a1;
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-weight: 800;
}

.web-search-help-examples {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.45rem, 1.2vw, 0.65rem);
}

.web-search-help-examples button {
  padding: clamp(0.5rem, 1.4vw, 0.65rem) clamp(0.7rem, 2vw, 0.9rem);
  border: 0.0625rem solid #bae6fd;
  border-radius: 999rem;
  background: #f0f9ff;
  color: #075985;
  font-family: inherit;
  font-size: clamp(0.82rem, 1.8vw, 0.95rem);
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  text-align: left;
}

.web-search-help-examples button:hover,
.web-search-help-examples button:focus-visible {
  border-color: #38bdf8;
  background: #e0f2fe;
  color: #0369a1;
  outline: none;
}

.web-search-submit {
  flex: 0 0 auto;
  padding: clamp(0.7rem, 2vw, 0.85rem) clamp(1rem, 3vw, 1.35rem);
  border: 0;
  border-radius: 999rem;
  background: #0284c7;
  color: #ffffff;
  font-family: inherit;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 800;
  cursor: pointer;
}

.web-search-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.web-search-results {
  display: flex;
  flex-direction: column;
  gap: clamp(0.65rem, 2vw, 0.9rem);
}

.web-search-results:empty {
  display: none;
}

.web-search-sections {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1.25rem);
}

.web-search-section-block {
  display: flex;
  flex-direction: column;
  gap: clamp(0.35rem, 1vw, 0.5rem);
  padding: clamp(0.75rem, 2vw, 1.1rem);
  border: 0.0625rem solid #bae6fd;
  border-radius: clamp(0.75rem, 2vw, 1rem);
  background: #ffffff;
  box-shadow: 0 clamp(0.2rem, 0.8vw, 0.4rem) clamp(0.6rem, 2.2vw, 1rem) rgba(14, 165, 233, 0.03);
}

.web-search-section-header {
  display: flex;
  flex-direction: column;
  gap: clamp(0.15rem, 0.5vw, 0.25rem);
  border-bottom: 0.0625rem solid #f0f9ff;
  padding-bottom: clamp(0.35rem, 1vw, 0.5rem);
}

.web-search-section-title {
  margin: 0;
  color: #075985;
  font-size: clamp(0.98rem, 2.4vw, 1.08rem);
  font-weight: 800;
}

.web-search-section-subtitle {
  color: #64748b;
  font-size: clamp(0.78rem, 1.8vw, 0.88rem);
  font-weight: 400;
}

.web-search-section-results {
  display: flex;
  flex-direction: column;
}

.web-search-section-results .web-search-result-row {
  padding: clamp(0.6rem, 1.6vw, 0.8rem) 0;
  border-bottom: 0.0625rem solid #f8fcff;
  background: transparent;
}

.web-search-section-results .web-search-result-row:last-child {
  border-bottom: 0;
}

.web-search-flat-results-header {
  margin-top: clamp(1rem, 2.5vw, 1.5rem);
  margin-bottom: clamp(0.45rem, 1.2vw, 0.65rem);
  padding: 0 clamp(0.5rem, 1.5vw, 0.75rem);
  color: #075985;
  font-size: clamp(1.05rem, 2.6vw, 1.2rem);
  font-weight: 800;
  border-left: 0.1875rem solid #0284c7;
}

.web-search-flat-results {
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
}

.web-search-result-row {
  display: flex;
  flex-direction: column;
  gap: clamp(0.25rem, 1vw, 0.4rem);
  padding: clamp(0.9rem, 2vw, 1.1rem);
  border: 0;
  border-bottom: 0.0625rem solid #e5e7eb;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.web-search-result-title {
  color: #075985;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 800;
  line-height: 1.45;
  text-decoration: none;
}

.web-search-result-title:hover,
.web-search-result-title:focus-visible {
  color: #0369a1;
  text-decoration: underline;
  outline: none;
}

.web-search-result-source {
  color: #64748b;
  font-size: clamp(0.8rem, 1.8vw, 0.9rem);
  overflow-wrap: anywhere;
}

/* Mobile Shopping search results keep the search context visible while only results scroll. */
@media (min-width: 641px) {
  body.shopping-desktop-active-shell.search-mode:not(.ai-tool-mode) {
    block-size: 100dvh;
    min-block-size: 100dvh;
    overflow: hidden;
  }

  @supports not (block-size: 100dvh) {
    body.shopping-desktop-active-shell.search-mode:not(.ai-tool-mode) {
      block-size: 100vh;
      min-block-size: 100vh;
    }
  }

  body.shopping-desktop-active-shell.search-mode:not(.ai-tool-mode) .app-main {
    flex: 1 1 auto;
    min-block-size: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(0.5rem, 1vw, 0.8rem);
    overflow: hidden;
  }

  body.shopping-desktop-active-shell.search-mode:not(.ai-tool-mode) .shopping-desktop-active-header {
    flex: 0 0 auto;
    width: min(100%, var(--shopping-composer-width));
    margin: 0 auto;
    padding: clamp(0.35rem, 0.8vw, 0.55rem) 0 0;
  }

  body.shopping-desktop-active-shell.search-mode:not(.ai-tool-mode) .shopping-desktop-active-header .search-wrap {
    margin-top: 0;
  }

  body.shopping-desktop-active-shell.search-mode:not(.ai-tool-mode) #landing {
    display: none;
  }

  body.shopping-desktop-active-shell.search-mode:not(.ai-tool-mode) .shopping-desktop-results-pane {
    flex: 1 1 auto;
    min-block-size: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.shopping-desktop-active-shell.search-mode:not(.ai-tool-mode) .shopping-desktop-results-pane .results-view {
    flex: 1 1 auto;
    min-block-size: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(0.75rem, 1.2vw, 1.1rem) 0 clamp(1rem, 2vw, 1.35rem);
  }

  body.shopping-desktop-active-shell.search-mode:not(.ai-tool-mode) .app-footer {
    flex: 0 0 auto;
  }

  .web-search-panel.is-active {
    width: min(100%, clamp(20rem, 95vw, 56.25rem));
    margin: 0 auto;
  }

  .web-search-panel.is-active .web-search-desktop-active-shell {
    display: flex;
    flex-direction: column;
    block-size: 100dvh;
    min-block-size: 0;
    overflow: hidden;
  }

  @supports not (block-size: 100dvh) {
    .web-search-panel.is-active .web-search-desktop-active-shell {
      block-size: 100vh;
    }
  }

  .web-search-panel.is-active .web-search-desktop-active-header {
    flex: 0 0 auto;
    min-block-size: 0;
    background: #ffffff;
    z-index: 2;
  }

  .web-search-panel.is-active .web-search-desktop-results-pane {
    flex: 1 1 auto;
    min-block-size: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .web-search-panel.is-active .web-search-desktop-results-pane > .web-search-scroll-pane {
    min-block-size: 0;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  body.search-mode:not(.ai-tool-mode) {
    block-size: 100dvh;
    min-block-size: 100dvh;
    overflow: hidden;
  }

  @supports not (block-size: 100dvh) {
    body.search-mode:not(.ai-tool-mode) {
      block-size: 100vh;
      min-block-size: 100vh;
    }
  }

  body.search-mode:not(.ai-tool-mode) .app-header,
  body.search-mode:not(.ai-tool-mode) .ai-shared-mobile-mode-nav,
  body.search-mode:not(.ai-tool-mode) .landing-view {
    flex: 0 0 auto;
  }

  body.search-mode:not(.ai-tool-mode) .ai-shared-mobile-mode-nav {
    position: relative;
    z-index: calc(var(--z-header) - 1);
  }

  body.search-mode:not(.ai-tool-mode) .app-main {
    flex: 1 1 auto;
    align-items: stretch;
    min-block-size: 0;
    overflow: hidden;
  }

  body.search-mode:not(.ai-tool-mode) .landing-view {
    position: relative;
    top: auto;
    z-index: calc(var(--z-header) - 2);
    max-width: 100%;
    padding: clamp(0.5rem, 2.5vw, 0.75rem) 0 clamp(0.55rem, 2.5vw, 0.85rem);
    background: #ffffff;
    border-bottom: 1px solid var(--color-border);
  }

  body.search-mode:not(.ai-tool-mode) .results-view {
    flex: 1 1 auto;
    min-block-size: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: clamp(0.75rem, 3vw, 1rem) clamp(0.75rem, 4vw, 1rem) max(clamp(1rem, 4vw, 1.25rem), env(safe-area-inset-bottom));
    scroll-padding-top: clamp(0.75rem, 3vw, 1rem);
  }

  body.search-mode:not(.ai-tool-mode) #msgContainer {
    width: min(100%, clamp(20rem, 95vw, 56.25rem));
  }

  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .results-view {
    padding-inline: clamp(0.45rem, 1.9vw, 0.62rem);
  }

  body.shopping-results-mode.search-mode:not(.ai-tool-mode) #msgContainer {
    width: min(100%, calc(100vw - clamp(0.9rem, 3.8vw, 1.2rem)));
    max-width: 100%;
  }

  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .ai-result,
  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .general-results-wrap,
  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .ai-recommendation-wrap,
  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .pick-list,
  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .pick-row-link,
  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .pick-row {
    width: 100%;
    max-width: 100%;
  }

  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .ai-result {
    padding-inline: clamp(0.05rem, 0.4vw, 0.12rem);
  }

  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .pick-list {
    gap: clamp(0.35rem, 1.8vw, 0.55rem);
  }

  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .pick-row {
    gap: clamp(0.35rem, 1.8vw, 0.55rem);
    padding: clamp(0.45rem, 1.8vw, 0.58rem) clamp(0.4rem, 1.7vw, 0.52rem);
  }

  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .row-info {
    gap: clamp(0.1rem, 0.9vw, 0.22rem);
  }

  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .row-thumb {
    width: clamp(68px, 20vw, 80px);
    height: clamp(68px, 20vw, 80px);
  }

  body.shopping-results-mode.search-mode:not(.ai-tool-mode) .row-price-area {
    width: clamp(82px, 22vw, 96px);
    gap: clamp(3px, 0.8vw, 5px);
  }

  body.search-mode:not(.ai-tool-mode) .welcome-section,
  body.search-mode:not(.ai-tool-mode) .rounded-headline,
  body.search-mode:not(.ai-tool-mode) .trending-section {
    display: none !important;
  }

  body.search-mode:not(.ai-tool-mode) .landing-view {
    padding-top: clamp(0.35rem, 1.8vw, 0.5rem);
    padding-bottom: clamp(0.35rem, 1.8vw, 0.5rem);
  }

  body.search-mode:not(.ai-tool-mode) .shopping-home-container {
    gap: clamp(0.35rem, 1.8vw, 0.6rem);
    padding-top: 0;
    padding-bottom: 0;
    min-height: 0;
  }

  body.search-mode:not(.ai-tool-mode) .search-wrap {
    order: 1;
    margin-top: 0;
    padding-top: 0;
  }

  body.search-mode:not(.ai-tool-mode) .app-footer {
    display: block;
    width: 100%;
    margin-top: clamp(0.75rem, 3vw, 1rem);
    padding-bottom: max(clamp(1rem, 4vw, 1.25rem), env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .ai-shared-mobile-mode-nav,
  body.search-mode .ai-shared-mobile-mode-nav {
    display: block;
    width: 100%;
    padding: clamp(0.55rem, 2.5vw, 0.8rem) clamp(0.75rem, 4vw, 1rem) 0;
    background: #ffffff;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(0.32rem, 1.5vw, 0.48rem);
    width: 100%;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab {
    --mode-nav-border: #dbeafe;
    --mode-nav-bg: #f8fbff;
    --mode-nav-text: #334155;
    --mode-nav-hover-border: #93c5fd;
    --mode-nav-hover-bg: #eff6ff;
    --mode-nav-hover-text: #1d4ed8;
    --mode-nav-active-border: #60a5fa;
    --mode-nav-active-bg: #eaf3ff;
    --mode-nav-active-text: #1d4ed8;
    --mode-nav-shadow-rgb: 37, 99, 235;
    min-inline-size: 0;
    min-block-size: clamp(2.1rem, 8.6vw, 2.4rem);
    padding: clamp(0.4rem, 1.8vw, 0.52rem) clamp(0.22rem, 1.2vw, 0.36rem);
    border-color: var(--mode-nav-border);
    border-radius: clamp(0.65rem, 2.8vw, 0.85rem);
    background: var(--mode-nav-bg);
    color: var(--mode-nav-text);
    box-shadow: 0 clamp(0.18rem, 0.9vw, 0.32rem) clamp(0.55rem, 2.4vw, 0.8rem) rgba(var(--mode-nav-shadow-rgb), 0.07);
    font-size: clamp(0.78rem, 3.25vw, 0.9rem);
    font-weight: 750;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.18rem, 0.8vw, 0.26rem);
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.95em, 3vw, 1.1em);
    line-height: 1;
    flex: 0 0 auto;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab-label {
    display: inline-block;
    min-inline-size: 0;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab-world-icon {
    inline-size: clamp(0.75rem, 3vw, 0.875rem);
    block-size: clamp(0.75rem, 3vw, 0.875rem);
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab[data-ai-mode-tab="shopping"] {
    --mode-nav-border: #bfdbfe;
    --mode-nav-bg: #eff6ff;
    --mode-nav-hover-border: #60a5fa;
    --mode-nav-hover-bg: #dbeafe;
    --mode-nav-hover-text: #1e40af;
    --mode-nav-active-border: #60a5fa;
    --mode-nav-active-bg: #dbeafe;
    --mode-nav-active-text: #1d4ed8;
    --mode-nav-shadow-rgb: 37, 99, 235;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab[data-ai-mode-tab="document-ai"] {
    --mode-nav-border: #bfdbfe;
    --mode-nav-bg: #eff6ff;
    --mode-nav-hover-border: #60a5fa;
    --mode-nav-hover-bg: #dbeafe;
    --mode-nav-hover-text: #1d4ed8;
    --mode-nav-active-border: #60a5fa;
    --mode-nav-active-bg: #eaf3ff;
    --mode-nav-active-text: #1d4ed8;
    --mode-nav-shadow-rgb: 37, 99, 235;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab[data-ai-mode-tab="instant-answer"] {
    --mode-nav-border: #fde68a;
    --mode-nav-bg: #fffbeb;
    --mode-nav-hover-border: #fbbf24;
    --mode-nav-hover-bg: #fef3c7;
    --mode-nav-hover-text: #92400e;
    --mode-nav-active-border: #fbbf24;
    --mode-nav-active-bg: #fef3c7;
    --mode-nav-active-text: #92400e;
    --mode-nav-shadow-rgb: 245, 158, 11;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab[data-ai-mode-tab="web-search"] {
    --mode-nav-border: #bae6fd;
    --mode-nav-bg: #f0f9ff;
    --mode-nav-hover-border: #38bdf8;
    --mode-nav-hover-bg: #e0f2fe;
    --mode-nav-hover-text: #075985;
    --mode-nav-active-border: #38bdf8;
    --mode-nav-active-bg: #e0f2fe;
    --mode-nav-active-text: #075985;
    --mode-nav-shadow-rgb: 14, 165, 233;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab[data-ai-mode-tab="loveme"] {
    --mode-nav-border: #fecdd3;
    --mode-nav-bg: #fff1f2;
    --mode-nav-hover-border: #fb7185;
    --mode-nav-hover-bg: #ffe4e6;
    --mode-nav-hover-text: #be123c;
    --mode-nav-active-border: #fb7185;
    --mode-nav-active-bg: #ffe4e6;
    --mode-nav-active-text: #be123c;
    --mode-nav-shadow-rgb: 244, 63, 94;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab[data-ai-mode-tab="home-meal"] {
    --mode-nav-border: #bbf7d0;
    --mode-nav-bg: #f0fdf4;
    --mode-nav-hover-border: #4ade80;
    --mode-nav-hover-bg: #dcfce7;
    --mode-nav-hover-text: #15803d;
    --mode-nav-active-border: #4ade80;
    --mode-nav-active-bg: #dcfce7;
    --mode-nav-active-text: #15803d;
    --mode-nav-shadow-rgb: 34, 197, 94;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab[data-ai-mode-tab="babsim"] {
    --mode-nav-border: #fed7aa;
    --mode-nav-bg: #fff7ed;
    --mode-nav-hover-border: #fb923c;
    --mode-nav-hover-bg: #ffedd5;
    --mode-nav-hover-text: #c2410c;
    --mode-nav-active-border: #fb923c;
    --mode-nav-active-bg: #ffedd5;
    --mode-nav-active-text: #c2410c;
    --mode-nav-shadow-rgb: 249, 115, 22;
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab:hover,
  .ai-shared-mobile-mode-nav .ai-mode-tab:focus-visible {
    border-color: var(--mode-nav-hover-border);
    background: var(--mode-nav-hover-bg);
    color: var(--mode-nav-hover-text);
    box-shadow: 0 clamp(0.24rem, 1.1vw, 0.38rem) clamp(0.7rem, 2.8vw, 1rem) rgba(var(--mode-nav-shadow-rgb), 0.11);
    transform: translateY(-0.0625rem);
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab[aria-current="page"] {
    border-color: var(--mode-nav-active-border);
    background: var(--mode-nav-active-bg);
    color: var(--mode-nav-active-text);
    box-shadow: inset 0 0 0 0.0625rem rgba(var(--mode-nav-shadow-rgb), 0.2), 0 clamp(0.24rem, 1.1vw, 0.38rem) clamp(0.75rem, 3vw, 1.05rem) rgba(var(--mode-nav-shadow-rgb), 0.14);
  }

  .ai-shared-mobile-mode-nav .ai-mode-tab[aria-current="page"]:hover,
  .ai-shared-mobile-mode-nav .ai-mode-tab[aria-current="page"]:focus-visible {
    background: var(--mode-nav-active-bg);
    color: var(--mode-nav-active-text);
    transform: none;
  }

  body.ai-tool-mode .document-ai-panel > .ai-mode-tabs,
  body.ai-tool-mode .instant-answer-panel > .ai-mode-tabs,
  body.ai-tool-mode .web-search-panel > .ai-mode-tabs,
  body.ai-tool-mode .loveme-panel > .ai-mode-tabs,
  body.ai-tool-mode .home-meal-panel > .ai-mode-tabs,
  body.ai-tool-mode .babsim-panel > .ai-mode-tabs,
  body.ai-tool-mode .cafe-panel > .ai-mode-tabs {
    display: none;
  }

  .ai-mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: clamp(0.28rem, 1.4vw, 0.45rem);
    padding: clamp(0.28rem, 1.4vw, 0.4rem);
    border-radius: clamp(1rem, 4vw, 1.35rem);
  }

  .ai-mode-tab {
    flex: none;
    min-inline-size: 0;
    min-block-size: clamp(2.35rem, 10vw, 2.85rem);
    padding: clamp(0.55rem, 2.3vw, 0.7rem) 0.25rem;
    font-size: clamp(0.86rem, 3.5vw, 0.95rem);
    width: 100%;
  }

  .web-search-panel.is-initial {
    display: block;
    height: auto;
  }

  .web-search-panel.is-initial .web-search-scroll-pane {
    display: block;
    overflow: visible;
  }

  .web-search-panel.is-active {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    gap: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .web-search-panel.is-active .web-search-intro {
    display: none;
  }

  .web-search-panel.is-active .web-search-active-header {
    flex: 0 0 auto;
    gap: clamp(0.45rem, 2vw, 0.65rem);
    padding: clamp(0.35rem, 1.8vw, 0.5rem) 0;
    border-bottom: 1px solid var(--color-border);
    background: #ffffff;
    z-index: 2;
  }

  .web-search-panel.is-active .web-search-form.is-compact {
    margin: 0;
  }

  .web-search-panel.is-active .web-search-scroll-pane {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: clamp(0.75rem, 3vw, 1rem) 0 max(clamp(1rem, 4vw, 1.25rem), env(safe-area-inset-bottom));
  }

  .web-search-panel {
    width: 95%;
    padding: clamp(0.9rem, 4vw, 1.15rem) 0;
  }

  .web-search-form {
    gap: var(--shopping-composer-row-gap);
    padding: var(--shopping-composer-padding-block) var(--shopping-composer-padding-inline);
  }

  .web-search-composer-bottom {
    gap: var(--shopping-composer-control-gap);
  }

  .web-search-composer-actions {
    gap: var(--shopping-composer-control-gap);
  }

  .web-search-submit {
    padding-right: clamp(0.75rem, 3vw, 1rem);
    padding-left: clamp(0.75rem, 3vw, 1rem);
  }

  .web-search-form .ai-tool-mic-button,
  .web-search-help-button,
  .loveme-help-button,
  .home-meal-help-button,
  .loveme-panel .ai-tool-mic-button,
  .home-meal-panel .ai-tool-mic-button,
  .document-ai-help-button,
  .instant-answer-help-button {
    inline-size: var(--shopping-composer-right-button-size);
    block-size: var(--shopping-composer-right-button-size);
  }

  .web-search-plus-button,
  .loveme-plus-button,
  .home-meal-plus-button,
  .babsim-plus-button,
  .document-ai-upload-action,
  .instant-answer-plus-button {
    inline-size: var(--shopping-composer-left-button-size);
    block-size: var(--shopping-composer-left-button-size);
  }

  body.ai-tool-mode .results-view {
    padding-top: 20px;
  }
}

/* Match AI tool utility icons to the main shopping search composer's clean inline controls. */
.document-ai-upload-action,
.document-ai-help-button,
.instant-answer-plus-button,
.instant-answer-help-button,
.web-search-plus-button,
.web-search-help-button,
.loveme-plus-button,
.home-meal-plus-button,
.babsim-plus-button,
.loveme-help-button,
.home-meal-help-button,
.loveme-panel .ai-tool-mic-button,
.home-meal-panel .ai-tool-mic-button,
.document-ai-panel .ai-tool-mic-button,
.instant-answer-panel .ai-tool-mic-button,
.web-search-form .ai-tool-mic-button {
  border: 0;
  border-radius: clamp(0.5rem, 1.5vw, 0.875rem);
  background: transparent;
  color: var(--color-text-light);
  box-shadow: none;
  transition: color 160ms ease, transform 160ms ease;
}

.document-ai-upload-action,
.instant-answer-plus-button,
.web-search-plus-button,
.loveme-plus-button,
.home-meal-plus-button,
.babsim-plus-button {
  color: var(--color-primary);
  font-size: clamp(1.75rem, 4.8vw, 2.1rem);
  font-weight: 900;
}

.document-ai-help-button,
.instant-answer-help-button,
.web-search-help-button,
.loveme-help-button,
.home-meal-help-button {
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-weight: 800;
}

.document-ai-upload-action:hover,
.document-ai-upload-action:focus-visible,
.document-ai-help-button:hover,
.document-ai-help-button:focus-visible,
.document-ai-help-button[aria-expanded="true"],
.instant-answer-plus-button:hover,
.instant-answer-plus-button:focus-visible,
.instant-answer-plus-button[aria-expanded="true"],
.instant-answer-help-button:hover,
.instant-answer-help-button:focus-visible,
.instant-answer-help-button[aria-expanded="true"],
.web-search-plus-button:hover,
.web-search-plus-button:focus-visible,
.web-search-plus-button[aria-expanded="true"],
.web-search-help-button:hover,
.web-search-help-button:focus-visible,
.web-search-help-button[aria-expanded="true"],
.loveme-plus-button:hover,
.loveme-plus-button:focus-visible,
.loveme-plus-button[aria-expanded="true"],
.babsim-plus-button:hover,
.babsim-plus-button:focus-visible,
.babsim-plus-button[aria-expanded="true"],
.loveme-help-button:hover,
.loveme-help-button:focus-visible,
.loveme-help-button[aria-expanded="true"],
.loveme-panel .ai-tool-mic-button:hover,
.loveme-panel .ai-tool-mic-button:focus-visible,
.document-ai-panel .ai-tool-mic-button:hover,
.document-ai-panel .ai-tool-mic-button:focus-visible,
.instant-answer-panel .ai-tool-mic-button:hover,
.instant-answer-panel .ai-tool-mic-button:focus-visible,
.home-meal-panel .ai-tool-mic-button:hover,
.home-meal-panel .ai-tool-mic-button:focus-visible,
.web-search-form .ai-tool-mic-button:hover,
.web-search-form .ai-tool-mic-button:focus-visible,
.ai-tool-mic-button.is-listening {
  border: 0;
  background: transparent;
  color: var(--color-primary);
  box-shadow: none;
  outline: none;
}

/* Image-based starting point for 디스원 서치 */
.web-search-image-start {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1rem);
  width: 100%;
  padding: clamp(0.875rem, 2.6vw, 1.25rem);
  border: 0.0625rem solid #dbeafe;
  border-radius: clamp(1rem, 3vw, 1.4rem);
  background: linear-gradient(135deg, #f8fbff 0%, #f1f5f9 100%);
}

.web-search-image-copy {
  display: flex;
  flex-direction: column;
  gap: clamp(0.25rem, 1vw, 0.4rem);
}

.web-search-image-copy h3,
.web-search-image-copy p,
.web-search-suggestion-title,
.web-search-image-fallback,
.web-search-image-preview-info p,
.web-search-image-action,
.web-search-suggestion-chip,
.web-search-image-remove {
  margin: 0;
  font-size: clamp(0.82rem, 2.4vw, 0.96rem);
}

.web-search-image-copy h3 {
  color: #1e40af;
  font-weight: 750;
}

.web-search-image-copy p,
.web-search-image-preview-info p,
.web-search-image-fallback {
  color: #64748b;
  line-height: 1.55;
}

.web-search-image-actions,
.web-search-suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 1.6vw, 0.75rem);
}

.web-search-image-action,
.web-search-suggestion-chip,
.web-search-image-remove {
  border: max(0.0625rem, 0.06vw) solid #bfdbfe;
  border-radius: 50vw;
  background: #ffffff;
  color: #1d4ed8;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.web-search-image-action,
.web-search-suggestion-chip {
  padding: clamp(0.58rem, 1.6vw, 0.72rem) clamp(0.8rem, 2.2vw, 1rem);
}

.web-search-image-action:hover,
.web-search-image-action:focus-visible,
.web-search-suggestion-chip:hover,
.web-search-suggestion-chip:focus-visible,
.web-search-image-remove:hover,
.web-search-image-remove:focus-visible {
  background: #eff6ff;
  border-color: #60a5fa;
  color: #1e3a8a;
}

.web-search-image-input {
  display: none;
}

.web-search-image-preview {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1rem);
  width: 100%;
  padding: clamp(0.65rem, 2vw, 0.9rem);
  border: 0.0625rem solid #e2e8f0;
  border-radius: clamp(0.8rem, 2.4vw, 1rem);
  background: #ffffff;
}

.web-search-image-preview[hidden],
.web-search-image-suggestions[hidden] {
  display: none;
}

.web-search-image-preview img {
  flex: 0 0 clamp(4.75rem, 15vw, 6.5rem);
  width: clamp(4.75rem, 15vw, 6.5rem);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: clamp(0.65rem, 2vw, 0.85rem);
  background: #e2e8f0;
}

.web-search-image-preview-info {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.5rem, 1.6vw, 0.75rem);
}

.web-search-image-preview-info p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-search-image-remove {
  flex: 0 0 auto;
  padding: clamp(0.42rem, 1.4vw, 0.55rem) clamp(0.62rem, 1.8vw, 0.8rem);
  color: #475569;
  border-color: #e2e8f0;
}

.web-search-image-suggestions {
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.5vw, 0.7rem);
}

.web-search-suggestion-title {
  color: #334155;
  font-weight: 750;
}

@media (max-width: 640px) {
  .web-search-image-preview {
    align-items: flex-start;
  }

  .web-search-image-preview-info {
    flex-direction: column;
    align-items: flex-start;
  }
}

.loveme-entry-chip {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.loveme-entry-chip:hover,
.loveme-entry-chip:focus-visible {
  border-color: #fb7185;
  box-shadow: 0 clamp(0.35rem, 1.5vw, 0.65rem) clamp(1rem, 3vw, 1.5rem) rgba(244, 63, 94, 0.12);
}

