.faq-chat-section {
  padding: 64px 32px;
  background: #fff;
}

.faq-chat-inner {
  max-width: 920px;
  margin: 0 auto;
  text-align: center;
}

.faq-chat-inner .section-title { margin: 0 0 20px; }
.faq-chat { width: 100%; }
.faq-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 360px;
  margin-bottom: 18px;
  overflow-y: auto;
  text-align: left;
}

.faq-chat-modal {
  width: min(680px, calc(100% - 48px));
  max-width: none;
  max-height: min(720px, calc(100dvh - 48px));
  margin-right: auto;
  margin-left: auto;
  padding: 28px;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: #fff;
  color: var(--color-ink);
  box-shadow: var(--shadow-subtle-hover);
}

.faq-chat-modal[open] {
  display: flex;
  flex-direction: column;
}

.faq-chat-modal::backdrop { background: rgba(8, 38, 62, .42); }

.faq-chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.faq-chat-modal-header h2 { margin: 0; font-size: var(--font-subsection-title); font-weight: 900; }
.faq-chat-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #eff7fd;
  color: #0874c7;
  cursor: pointer;
}

.faq-chat-modal .faq-chat-messages {
  flex: 1 1 auto;
  min-height: 260px;
  margin-bottom: 20px;
  padding: 6px 4px;
}

.faq-chat-modal-form { flex: 0 0 auto; }
.faq-chat-modal-note { margin: 12px 0 0; color: var(--color-text); font-size: var(--font-note); line-height: 1.6; text-align: center; }

.faq-chat-message {
  max-width: 86%;
  padding: 13px 20px;
  border-radius: 26px;
  font-size: var(--font-body);
  line-height: 1.8;
  white-space: pre-wrap;
}

.faq-chat-message p { margin: 0; }
.faq-chat-message--assistant { align-self: flex-start; background: #eff7fd; color: var(--color-ink); }
.faq-chat-message--user { align-self: flex-end; background: #0874c7; color: #fff; }
.faq-chat-message--error { color: #8b3a2b; }
.faq-chat-sources {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 82%;
  margin-top: -6px;
  padding: 0 14px 4px;
  font-size: 12px;
  line-height: 1.5;
}
.faq-chat-sources-label { color: var(--color-text); font-weight: 700; }
.faq-chat-sources a {
  color: #075c9f;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.faq-chat-sources a:hover { text-decoration-thickness: 2px; }

/* 回答できなかったときの導線 */
.faq-chat-contact {
  align-self: stretch;
  max-width: 86%;
  margin-top: 4px;
  padding: 14px 18px;
  border: 1px solid #d7eaf8;
  border-radius: 18px;
  background: #fff;
}
.faq-chat-contact-text {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--color-text);
}
.faq-chat-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.faq-chat-contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.2;
}
.faq-chat-contact-btn--tel { background: #0874c7; color: #fff; }
.faq-chat-contact-btn--tel:hover { background: #075c9f; }
.faq-chat-contact-btn--form { border: 2px solid #0874c7; background: #fff; color: #0874c7; }
.faq-chat-contact-btn--form:hover { background: #eff7fd; }

.faq-chat-form {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 2px solid #0874c7;
  border-radius: 100px;
  background: #fff;
}

.faq-chat-form textarea {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  max-height: 120px;
  padding: 12px 20px;
  resize: none;
  overflow-y: auto;
  border: 0;
  border-radius: 100px;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  line-height: 1.5;
}

.faq-chat-form textarea:focus { outline: none; }
.faq-chat-form:focus-within { outline: 3px solid rgba(8, 116, 199, .18); }

.faq-chat-form button {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 28px;
  border: 0;
  border-radius: 100px;
  background: #0874c7;
  color: #fff;
  font: inherit;
  font-size: var(--font-ui);
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s;
}

.faq-chat-form button:hover { background: #075c9f; }
.faq-chat-form button:disabled { opacity: .6; cursor: wait; }
.faq-chat-trap { position: absolute !important; left: -9999px !important; }
.faq-chat-note { margin: 12px 0 0; color: var(--color-text); font-size: var(--font-note); line-height: 1.7; }
.faq-chat-note a { color: #075c9f; text-decoration: underline; text-underline-offset: 3px; }

.faq-chat-turnstile {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #c8e2f5;
  border-radius: 14px;
  background: #f3f8fc;
}

.faq-chat-turnstile p {
  margin: 0 0 10px;
  color: var(--color-text);
  font-size: 13px;
  line-height: 1.6;
}

.faq-chat-turnstile > div { margin: 0 auto; }

@media (max-width: 767px) {
  .faq-chat-section { padding: 64px 18px; }
  .faq-chat-inner .section-title { margin-bottom: 26px; font-size: var(--font-section-title); }
  .faq-chat-form { padding: 6px; }
  .faq-chat-form textarea { min-height: 46px; padding: 11px 12px; font-size: 14px; }
  .faq-chat-form button { min-height: 46px; padding: 0 18px; }
  .faq-chat-message { max-width: 94%; font-size: 14px; }
  .faq-chat-sources { max-width: 94%; padding-right: 10px; padding-left: 10px; }
  .faq-chat-modal {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    padding: 20px 16px 16px;
    border-radius: 20px;
  }
  .faq-chat-modal .faq-chat-messages { min-height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .faq-chat-form button { transition: none; }
}
