/* Shared AI tool intro copy alignment: 해석 / 즉답 / 서치 / 럽미 / 집밥 */
.document-ai-copy,
.instant-answer-copy,
.web-search-copy,
.loveme-copy,
.home-meal-copy {
  align-items: center;
  width: 100%;
  text-align: center;
}

.document-ai-main-copy,
.instant-answer-main-copy,
.web-search-main-copy,
.loveme-main-copy,
.home-meal-flow-title,
.home-meal-main-copy,
.document-ai-sub-copy,
.instant-answer-sub-copy,
.web-search-sub-copy,
.home-meal-sub-copy {
  text-align: center;
  line-height: 1.65;
}

.document-ai-main-copy,
.instant-answer-main-copy,
.web-search-main-copy,
.loveme-main-copy,
.home-meal-main-copy {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.home-meal-flow-title {
  font-size: clamp(0.92rem, 2.25vw, 1.08rem);
}

.document-ai-sub-copy,
.instant-answer-sub-copy,
.web-search-sub-copy,
.home-meal-sub-copy {
  font-size: clamp(0.88rem, 2vw, 1rem);
}


/* Shared compact image UX for every service composer */
.composer-img-preview {
  align-self: flex-start;
  margin-bottom: 0;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
}

.composer-img-preview .pv-item {
  width: clamp(3.5rem, 12vw, 4.375rem);
  height: clamp(3.5rem, 12vw, 4.375rem);
}


.composer-img-preview .pv-item.is-file-chip {
  width: min(100%, clamp(12rem, 55vw, 22rem));
  height: auto;
  min-height: clamp(3.5rem, 12vw, 4.375rem);
}

.composer-img-preview .pv-item.is-file-chip:hover {
  transform: none;
}

.composer-file-chip {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
  width: 100%;
  min-height: clamp(3.5rem, 12vw, 4.375rem);
  padding: clamp(0.7rem, 2vw, 0.9rem);
  border: 0.0625rem solid #bfdbfe;
  border-radius: clamp(0.75rem, 2vw, 1rem);
  background: #eff6ff;
  color: #1e293b;
}

.composer-file-chip[hidden] {
  display: none;
}

.composer-file-chip-icon {
  flex: 0 0 auto;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
}

.composer-file-chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: clamp(0.15rem, 0.6vw, 0.25rem);
}

.composer-file-chip-label,
.composer-file-chip-type {
  color: #64748b;
  font-size: clamp(0.72rem, 1.8vw, 0.82rem);
  line-height: 1.2;
}

.composer-file-chip-name {
  overflow: hidden;
  color: #1d4ed8;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-plus-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.composer-plus-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + clamp(0.4rem, 1.2vw, 0.6rem));
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: clamp(0.2rem, 0.8vw, 0.35rem);
  min-inline-size: max-content;
  padding: clamp(0.35rem, 1vw, 0.5rem);
  border: 0.0625rem solid #dbeafe;
  border-radius: clamp(0.75rem, 2vw, 0.95rem);
  background: #ffffff;
  box-shadow: 0 clamp(0.45rem, 1.4vw, 0.7rem) clamp(1.2rem, 3vw, 1.8rem) rgba(15, 23, 42, 0.14);
}

.composer-plus-menu[hidden] {
  display: none;
}

.composer-plus-menu-item {
  display: flex;
  align-items: center;
  gap: clamp(0.45rem, 1.2vw, 0.6rem);
  width: 100%;
  padding: clamp(0.55rem, 1.6vw, 0.7rem) clamp(0.75rem, 2vw, 0.95rem);
  border: 0;
  border-radius: clamp(0.55rem, 1.5vw, 0.75rem);
  background: transparent;
  color: #1e293b;
  font-family: inherit;
  font-size: clamp(0.88rem, 2vw, 0.98rem);
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.composer-plus-menu-item:hover,
.composer-plus-menu-item:focus-visible {
  background: #eff6ff;
  color: #0369a1;
  outline: none;
}

.composer-image-file-input {
  display: none;
}

/* Shared AI tool composer system: 해석 / 즉답 / 서치 / 럽미 / 집밥 */
.ai-tool-composer {
  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 #dbeafe;
  border-radius: var(--shopping-composer-radius);
  background: #ffffff;
  box-shadow: 0 clamp(0.35rem, 1vw, 0.55rem) clamp(1rem, 3vw, 1.4rem) rgba(37, 99, 235, 0.08);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ai-tool-composer:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 clamp(0.35rem, 1vw, 0.55rem) clamp(1rem, 3vw, 1.4rem) rgba(37, 99, 235, 0.08), 0 0 0 clamp(0.12rem, 0.5vw, 0.2rem) rgba(37, 99, 235, 0.12);
}

.ai-tool-input {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.ai-tool-control-row,
.ai-tool-left-controls,
.ai-tool-right-controls {
  display: flex;
  align-items: center;
  gap: var(--shopping-composer-control-gap);
  flex-wrap: nowrap;
  min-width: 0;
}

.ai-tool-control-row {
  justify-content: space-between;
  width: 100%;
}

.ai-tool-left-controls {
  flex: 1 1 auto;
  justify-content: flex-start;
}

.ai-tool-right-controls {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.ai-tool-icon-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: clamp(0.5rem, 1.5vw, 1rem);
  background: transparent;
  color: var(--color-text-light);
  box-shadow: none;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 160ms ease, filter 160ms ease;
}

.ai-tool-plus-button {
  inline-size: var(--shopping-composer-left-button-size);
  block-size: var(--shopping-composer-left-button-size);
  color: #334155;
  font-size: clamp(2.25rem, 4.8vw, 2.5625rem);
  font-weight: 400;
}

.ai-tool-help-button,
.ai-tool-mic-button {
  inline-size: var(--shopping-composer-right-button-size);
  block-size: var(--shopping-composer-right-button-size);
  color: var(--color-text-light);
  font-size: clamp(0.875rem, 1.6vw, 1rem);
  font-weight: 800;
}

.ai-tool-right-controls .ai-tool-help-button {
  margin-left: 0;
}

.ai-tool-icon-button:hover,
.ai-tool-icon-button:focus-visible,
.ai-tool-icon-button[aria-expanded="true"],
.ai-tool-mic-button.is-listening {
  border: 0;
  background: transparent;
  color: var(--color-primary);
  box-shadow: none;
  filter: none;
  outline: none;
}

.ai-tool-action-button {
  flex: 0 0 auto;
  padding: clamp(0.7rem, 2vw, 0.85rem) clamp(1rem, 3vw, 1.35rem);
  border: 0;
  border-radius: 999rem;
  background: #2563eb;
  color: #ffffff;
  font-family: inherit;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.ai-tool-action-button:hover,
.ai-tool-action-button:focus-visible {
  background: #1d4ed8;
  box-shadow: 0 clamp(0.25rem, 1vw, 0.45rem) clamp(0.65rem, 2vw, 0.95rem) rgba(37, 99, 235, 0.18);
  outline: none;
}

.ai-tool-action-button:disabled,
.ai-tool-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.document-ai-question,
.instant-answer-question,
.loveme-question,
.home-meal-question,
.babsim-question,
.web-search-input {
  width: 100%;
  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);
  line-height: 1.55;
  outline: none;
}

.document-ai-question:focus,
.instant-answer-question:focus,
.loveme-question:focus,
.home-meal-question:focus,
.babsim-question:focus,
.web-search-input:focus {
  outline: none;
}

.document-ai-question,
.instant-answer-question,
.loveme-question,
.home-meal-question,
.babsim-question {
  min-height: auto;
  block-size: auto;
  overflow: hidden;
  resize: none;
}

.document-ai-composer.is-drag-over {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 clamp(0.16rem, 0.7vw, 0.25rem) rgba(37, 99, 235, 0.14);
}

.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,
.ai-tool-mic-button {
  transform: none;
}

@media (max-width: 640px) {
  .ai-tool-composer {
    gap: var(--shopping-composer-row-gap);
    padding: var(--shopping-composer-padding-block) var(--shopping-composer-padding-inline);
  }

  .ai-tool-control-row,
  .ai-tool-right-controls {
    gap: var(--shopping-composer-control-gap);
  }

  .ai-tool-action-button {
    flex: 0 0 auto;
    width: auto;
    padding-right: clamp(0.75rem, 3vw, 1rem);
    padding-left: clamp(0.75rem, 3vw, 1rem);
  }
}

.ai-tool-right-controls .ai-tool-action-button {
  align-self: center;
}

.document-ai-composer.is-drag-over {
  transform: none;
}

/* Shared attachment composer foundation */
.composer-attachment-preview .pv-item.is-file-chip,
#imgPreview .pv-item.is-file-chip {
  width: min(100%, clamp(12rem, 55vw, 22rem));
  height: auto;
  min-height: clamp(3.5rem, 12vw, 4.375rem);
}

.composer-attachment-preview .pv-item.is-file-chip:hover,
#imgPreview .pv-item.is-file-chip:hover {
  transform: none;
}

#imgPreview .composer-file-chip {
  display: flex;
}

#imgPreview .composer-file-chip[hidden] {
  display: none;
}

.composer-attachment-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
  max-width: 100%;
}

.composer-attachment-item {
  flex: 0 1 auto;
}

.composer-attachment-item .composer-file-chip {
  position: relative;
  padding-right: clamp(2rem, 6vw, 2.5rem);
}

.composer-attachment-order {
  position: absolute;
  right: clamp(0.3rem, 1vw, 0.5rem);
  bottom: clamp(0.3rem, 1vw, 0.5rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: clamp(1.1rem, 3vw, 1.35rem);
  block-size: clamp(1.1rem, 3vw, 1.35rem);
  border-radius: 999rem;
  background: rgba(37, 99, 235, 0.9);
  color: #ffffff;
  font-size: clamp(0.65rem, 1.6vw, 0.75rem);
  font-weight: 800;
  line-height: 1;
}

.composer-attachment-item.is-file-chip .composer-attachment-order {
  top: clamp(0.45rem, 1.3vw, 0.65rem);
  bottom: auto;
}

@media (max-width: 640px) {
  .composer-attachment-list {
    gap: clamp(0.4rem, 2vw, 0.6rem);
  }
}

/* ===== Document AI Relay Follow-up ===== */
.document-ai-follow-up {
  margin-top: clamp(16px, 3vh, 24px);
  padding-top: clamp(16px, 2.5vh, 24px);
  border-top: 1px dashed var(--color-border);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vw, 16px);
  animation: fadeIn 0.4s ease-out;
}

.document-ai-follow-up-title {
  margin: 0;
  font-size: clamp(14px, 2vw, 16px);
  color: #334155;
  font-weight: 800;
}

.document-ai-follow-up-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-ai-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: clamp(12px, 1.5vw, 13px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.document-ai-chip:hover {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
}

/* (Removed: follow-up input row and action button — single composer flow) */

.document-ai-follow-up-form {
  display: flex;
  gap: clamp(8px, 1.5vw, 12px);
  align-items: flex-end;
}

.document-ai-follow-up-input {
  flex: 1 1 auto;
  min-height: clamp(2.25rem, 5vw, 3rem);
  max-height: clamp(8rem, 20vw, 12rem);
  padding: clamp(0.65rem, 1.6vw, 0.8rem) clamp(0.75rem, 1.8vw, 0.95rem);
  border: 1px solid #cbd5e1;
  border-radius: clamp(0.75rem, 2vw, 0.95rem);
  background: #fff;
  color: #0f172a;
  font-family: inherit;
  font-size: clamp(0.82rem, 1.8vw, 0.92rem);
  line-height: 1.45;
  resize: vertical;
}

.document-ai-follow-up-submit {
  flex-shrink: 0;
  padding: clamp(0.62rem, 1.5vw, 0.8rem) clamp(0.8rem, 2vw, 1.1rem);
  border: 1px solid #0ea5e9;
  border-radius: 999px;
  background: #0ea5e9;
  color: #fff;
  font-family: inherit;
  font-size: clamp(0.8rem, 1.6vw, 0.88rem);
  font-weight: 700;
  cursor: pointer;
}

.document-ai-follow-up-submit:hover {
  background: #0284c7;
  border-color: #0284c7;
}

.document-ai-reset-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.document-ai-reset-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: clamp(8px, 1.5vw, 10px) clamp(14px, 2.5vw, 20px);
  border: 1px solid #e8905d;
  border-radius: 999px;
  background: #fff7f3;
  color: #c4531a;
  font-family: inherit;
  font-size: clamp(13px, 1.8vw, 14px);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(255, 107, 53, 0.1);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.document-ai-reset-button svg {
  flex-shrink: 0;
}

.document-ai-reset-button:hover {
  background: #fff0e8;
  border-color: #ff6b35;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.18);
}

.document-ai-reset-button:active {
  transform: scale(0.97);
}

.document-ai-reset-helper {
  font-size: clamp(11px, 1.3vw, 12px);
  color: #94a3b8;
  text-align: right;
}

.document-ai-answer.interpret-result-card {
  margin-top: clamp(0.7rem, 2vw, 1rem);
  border: 1px solid #dbeafe;
  border-radius: clamp(0.9rem, 2.4vw, 1.1rem);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  overflow: hidden;
}

.interpret-result-header {
  padding: clamp(0.55rem, 1.8vw, 0.8rem) clamp(0.9rem, 2.5vw, 1.25rem);
  border-bottom: 1px solid #e2e8f0;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: clamp(0.8rem, 1.8vw, 0.92rem);
  font-weight: 800;
}

.interpret-result-body {
  padding: clamp(0.9rem, 2.5vw, 1.35rem);
  max-inline-size: 100%;
  max-block-size: min(62vh, 44rem);
  overflow: auto;
  font-size: clamp(0.9rem, 2.3vw, 1rem);
  line-height: 1.75;
  color: #0f172a;
}

.interpret-section-title {
  margin: clamp(0.8rem, 2vw, 1rem) 0 clamp(0.4rem, 1vw, 0.55rem);
  font-size: clamp(0.96rem, 2.1vw, 1.05rem);
  line-height: 1.5;
  font-weight: 800;
  color: #1e40af;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(0.35rem, 1vw, 0.5rem);
}

.interpret-section-title-text {
  flex: 1 1 auto;
}

.interpret-section-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: clamp(0.2rem, 0.8vw, 0.28rem) clamp(0.5rem, 1.5vw, 0.62rem);
  font-size: clamp(0.68rem, 1.6vw, 0.74rem);
  line-height: 1;
  font-weight: 800;
}

.interpret-section-badge-source {
  background: #dbeafe;
  color: #1d4ed8;
}

.interpret-section-badge-hanja {
  background: #fef3c7;
  color: #92400e;
}

.interpret-paragraph {
  margin: 0;
  color: #1e293b;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.interpret-paragraph-spacer {
  block-size: clamp(0.45rem, 1.4vw, 0.75rem);
}

.interpret-bullet-list {
  margin: clamp(0.4rem, 1.1vw, 0.6rem) 0 clamp(0.7rem, 1.8vw, 0.9rem);
  padding-left: clamp(1.1rem, 2.8vw, 1.35rem);
  display: flex;
  flex-direction: column;
  gap: clamp(0.35rem, 1vw, 0.5rem);
}

.interpret-bullet-list li {
  color: #334155;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.interpret-formula {
  margin: clamp(0.45rem, 1.2vw, 0.65rem) 0;
  padding: clamp(0.6rem, 1.8vw, 0.85rem);
  border: 1px solid #e2e8f0;
  border-radius: clamp(0.7rem, 2vw, 0.85rem);
  background: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: clamp(0.8rem, 1.9vw, 0.9rem);
  line-height: 1.6;
  color: #0f172a;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.interpret-callout {
  margin: clamp(0.5rem, 1.3vw, 0.7rem) 0;
  padding: clamp(0.55rem, 1.7vw, 0.75rem) clamp(0.7rem, 2vw, 0.95rem);
  border-left: clamp(0.16rem, 0.5vw, 0.2rem) solid #3b82f6;
  background: #eff6ff;
  border-radius: clamp(0.55rem, 1.5vw, 0.7rem);
  color: #1e3a8a;
  font-weight: 700;
}

.interpret-original-wrap {
  margin: 0 clamp(0.9rem, 2.5vw, 1.35rem) clamp(0.9rem, 2.5vw, 1.2rem);
  border-top: 1px dashed #cbd5e1;
  padding-top: clamp(0.55rem, 1.6vw, 0.75rem);
}

.interpret-original-summary {
  cursor: pointer;
  color: #334155;
  font-size: clamp(0.76rem, 1.7vw, 0.86rem);
  font-weight: 700;
}

.interpret-original-text {
  margin: clamp(0.5rem, 1.4vw, 0.7rem) 0 0;
  padding: clamp(0.65rem, 1.8vw, 0.85rem);
  border: 1px solid #e2e8f0;
  border-radius: clamp(0.6rem, 1.8vw, 0.78rem);
  background: #f8fafc;
  color: #0f172a;
  font-size: clamp(0.78rem, 1.75vw, 0.88rem);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .document-ai-follow-up-form {
    flex-direction: column;
    align-items: stretch;
  }

  .document-ai-follow-up-submit {
    width: 100%;
  }

  .document-ai-reset-wrap {
    align-items: center;
    margin-top: 4px;
  }

  .document-ai-reset-helper {
    text-align: center;
  }

  .interpret-result-body {
    padding: clamp(0.75rem, 3vw, 0.95rem);
    max-block-size: none;
    overflow: visible;
  }

  .interpret-original-wrap {
    margin-inline: clamp(0.75rem, 3vw, 0.95rem);
  }
}

