/* ===========================================
   JTC AI 商品コンシェルジュ - チャットボット CSS
   ブランドカラー: 黒・赤・白
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&family=Edu+VIC+WA+NT+Hand:wght@700&display=swap');

:root {
  /* ブランドカラー */
  --jtc-black: #1a1a1a;
  --jtc-red: #d32f2f;
  --jtc-red-hover: #b71c1c;
  --jtc-red-light: rgba(211, 47, 47, 0.08);
  --jtc-white: #ffffff;
  --jtc-gray-bg: #f5f5f5;
  --jtc-gray-100: #f0f0f0;
  --jtc-gray-200: #e0e0e0;
  --jtc-gray-300: #bdbdbd;
  --jtc-gray-500: #757575;
  --jtc-gray-700: #424242;

  /* シャドウ */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.18);
  --shadow-xl: 0 12px 48px rgba(0,0,0,0.22);

  /* レイアウト */
  --chat-width: 400px;
  --chat-height: 600px;
  --chat-radius: 16px;
  --btn-radius: 12px;

  /* トランジション */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/*
* {
  box-sizing: border-box;
}
*/

/* サイト本体のスタイルを壊さないよう、グローバル body リセットはしない */

.chat-launcher,
.chat-trigger,
.chat-window,
.chat-messages,
.chat-input,
.chat-bubble {
  font-family: 'Noto Sans JP', sans-serif;
}

/* ===========================================
   チャット起動ランチャー（吹き出し＋ロボット）
   ※「チェックした商品を比較する」ボタンの上に配置
   =========================================== */
.chat-launcher {
  position: fixed;
  bottom: 72px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  /* JS が非レスポンシブ縮小表示時にサイズを補正する */
  -webkit-tap-highlight-color: transparent;
  transition: bottom 0.25s ease;
}

/* 関連商品バー展開時はバーの上へ退避（比較ボタンと同様） */
body.has-recomend-fixed:not(.recomend-bar-collapsed) .chat-launcher {
  bottom: calc(var(--recomend-bar-height, 245px) + 72px);
}

.chat-launcher.is-hidden {
  display: none;
}

.chat-launcher-teaser {
  position: relative;
  display: block;
  width: max-content;
  max-width: none;
  margin-bottom: 4px;
  padding-right: 4px;
  overflow: visible;
  animation: chat-teaser-in 0.35s ease;
  box-sizing: border-box;
}

.chat-launcher-teaser.is-hidden {
  display: none;
}

.chat-launcher-bubble {
  display: block;
  box-sizing: border-box;
  width: max-content;
  max-width: none;
  min-width: 0;
  background: var(--jtc-white);
  color: var(--jtc-black);
  border-radius: 14px;
  padding: 12px 16px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: visible;
  white-space: normal;
  text-align: left;
}

.chat-launcher-bubble-line {
  display: block;
  white-space: nowrap;
}

.chat-launcher-dismiss {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  background: #3a3a3a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition-fast), background var(--transition-fast);
  z-index: 2;
}

.chat-launcher-dismiss:hover {
  background: var(--jtc-black);
  transform: scale(1.08);
}

.chat-launcher-dismiss svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.chat-trigger {
  position: relative;
  width: 72px;
  height: 72px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  overflow: visible;
  touch-action: manipulation;
}

.chat-trigger-plate {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff 0%, #fff 55%, #ffe8e8 100%);
  border: 3px solid var(--jtc-red);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.28),
    0 0 0 0 rgba(211, 47, 47, 0.45);
  animation: chat-trigger-pulse 2.4s ease-out infinite;
  z-index: 0;
  pointer-events: none;
}

.chat-trigger-robot {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
  transition: filter var(--transition-normal), transform var(--transition-normal);
  animation: chat-robot-float 2.8s ease-in-out infinite;
}

.chat-trigger-cta {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  z-index: 2;
  white-space: nowrap;
  background: var(--jtc-black);
  color: #fff;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.chat-trigger:hover .chat-trigger-robot {
  filter: drop-shadow(0 4px 8px rgba(211, 47, 47, 0.35));
  animation: none;
  transform: translateY(-3px) scale(1.04);
}

.chat-trigger:hover .chat-trigger-plate {
  border-color: var(--jtc-red-hover);
  box-shadow: 0 8px 22px rgba(211, 47, 47, 0.4);
}

@keyframes chat-teaser-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chat-robot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes chat-trigger-pulse {
  0% {
    box-shadow:
      0 6px 18px rgba(0, 0, 0, 0.28),
      0 0 0 0 rgba(211, 47, 47, 0.45);
  }
  70% {
    box-shadow:
      0 6px 18px rgba(0, 0, 0, 0.28),
      0 0 0 14px rgba(211, 47, 47, 0);
  }
  100% {
    box-shadow:
      0 6px 18px rgba(0, 0, 0, 0.28),
      0 0 0 0 rgba(211, 47, 47, 0);
  }
}

/* スマホ（JS付与）: 背景が賑やかでも埋もれないよう強調 */
.chat-launcher.chat-launcher--mobile {
  gap: 20px;
  z-index: 10050;
}

.chat-launcher.chat-launcher--mobile .chat-launcher-teaser {
  margin-bottom: 6px;
  padding-right: 6px;
}

.chat-launcher.chat-launcher--mobile .chat-launcher-bubble {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  padding: 12px 14px;
  border: 2px solid var(--jtc-red);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.chat-launcher.chat-launcher--mobile .chat-launcher-dismiss {
  width: 26px;
  height: 26px;
  top: -8px;
  right: -6px;
}

.chat-launcher.chat-launcher--mobile .chat-trigger-plate {
  inset: -6px;
  border-width: 3px;
}

.chat-launcher.chat-launcher--mobile .chat-trigger-cta {
  bottom: -20px;
  font-size: 11px;
  padding: 4px 10px;
  background: var(--jtc-red);
}

/* ===========================================
   チャットウィンドウ
   =========================================== */
.chat-window {
  position: fixed;
  bottom: 180px;
  right: 20px;
  z-index: 9998;
  width: var(--chat-width);
  height: var(--chat-height);
  background: var(--jtc-white);
  border-radius: var(--chat-radius);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all var(--transition-slow);
  text-align: left;
}

.chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  /* アイコン非表示時は下余白を詰める */
  bottom: 24px;
}

/* ===========================================
   ヘッダー
   =========================================== */
.chat-header {
  background: linear-gradient(135deg, var(--jtc-black) 0%, #2d2d2d 100%);
  color: var(--jtc-white);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header-icon {
  width: 40px;
  height: 40px;
  background: var(--jtc-red);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Edu VIC WA NT Hand', cursive;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: #fff;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.chat-ai .chat-avatar {
  background: transparent;
  color: var(--jtc-white);
  font-family: 'Edu VIC WA NT Hand', cursive;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.chat-ai .chat-avatar--robot {
  overflow: visible;
  background: transparent;
  border-radius: 0;
}

.chat-avatar-robot {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}

.chat-user .chat-avatar {
  background: var(--jtc-gray-200);
  color: var(--jtc-gray-700);
}

.product-card {
  text-align: left;
}

.product-card-image.is-empty {
  display: none;
}

.chat-header-info {
  flex: 1;
}

.chat-header-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.chat-header-status {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.chat-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #4caf50;
  border-radius: 50%;
  display: inline-block;
}

.chat-header-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--jtc-white);
}

.chat-header-close svg {
  width: 20px;
  height: 20px;
}

/* ===========================================
   メッセージエリア
   =========================================== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background: var(--jtc-gray-bg);
  text-align: left;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--jtc-gray-300);
  border-radius: 2px;
}

/* メッセージ共通 */
.chat-message {
  display: flex;
  gap: 8px;
  max-width: 90%;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ユーザーメッセージ */
.chat-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-user .chat-bubble {
  background: var(--jtc-red);
  color: var(--jtc-white);
  border-radius: 16px 16px 4px 16px;
}

/* AIメッセージ（吹き出し・商品カードの横幅を統一） */
.chat-ai {
  align-self: flex-start;
  width: 90%;
  max-width: 90%;
  box-sizing: border-box;
}

.chat-ai .chat-bubble,
.chat-ai .product-card {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-ai .chat-bubble {
  background: var(--jtc-white);
  color: var(--jtc-black);
  border-radius: 16px 16px 16px 4px;
  box-shadow: var(--shadow-sm);
}

.chat-bubble {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  text-align: left;
}

.chat-bubble img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 8px 0;
}

.chat-bubble img[src=""],
.chat-bubble img:not([src]) {
  display: none;
}

.chat-bubble .chat-md-h1,
.chat-bubble .chat-md-h2,
.chat-bubble .chat-md-h3 {
  font-weight: 700;
  color: var(--jtc-black);
  margin: 12px 0 6px;
  line-height: 1.4;
  text-align: left;
}

.chat-bubble .chat-md-h1:first-child,
.chat-bubble .chat-md-h2:first-child,
.chat-bubble .chat-md-h3:first-child {
  margin-top: 0;
}

.chat-bubble .chat-md-h1 {
  font-size: 16px;
}

.chat-bubble .chat-md-h2 {
  font-size: 15px;
}

.chat-bubble .chat-md-h3 {
  font-size: 14px;
}

.chat-bubble .chat-md-hr {
  border: 0;
  border-top: 1px solid #e0e0e0;
  margin: 12px 0;
}

/* ===========================================
   候補ボタン（クイックリプライ）
   =========================================== */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chat-suggestion-btn {
  background: var(--jtc-white);
  border: 1px solid var(--jtc-gray-200);
  color: var(--jtc-gray-700);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}

.chat-suggestion-btn:hover {
  background: var(--jtc-red-light);
  border-color: var(--jtc-red);
  color: var(--jtc-red);
}

/* ===========================================
   解決確認（フィードバック）
   =========================================== */
.chat-feedback-label {
  font-size: 13px;
  color: var(--jtc-gray-700);
  margin-bottom: 10px;
  font-weight: 500;
}

.chat-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-feedback-btn {
  background: var(--jtc-white);
  border: 1px solid var(--jtc-gray-200);
  color: var(--jtc-gray-700);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  line-height: 1.3;
}

.chat-feedback-btn:hover:not(:disabled) {
  background: var(--jtc-red-light);
  border-color: var(--jtc-red);
  color: var(--jtc-red);
}

.chat-feedback-btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.chat-feedback-btn.is-selected {
  opacity: 1;
  background: var(--jtc-red-light);
  border-color: var(--jtc-red);
  color: var(--jtc-red);
  font-weight: 600;
}

/* ===========================================
   問い合わせ誘導（エスカレーション）
   =========================================== */
.chat-escalate-bubble p {
  margin: 0 0 0.75em;
  line-height: 1.6;
}

.chat-escalate-bubble p:last-of-type {
  margin-bottom: 0.5em;
}

.chat-escalate-channels {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  background: var(--jtc-gray-bg);
  border-radius: 8px;
  border: 1px solid var(--jtc-gray-100);
}

.chat-escalate-channels li {
  margin: 0;
  padding: 4px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--jtc-gray-700);
}

.chat-escalate-channels a {
  color: var(--jtc-red);
  text-decoration: underline;
}

.chat-escalate-channels a:hover {
  color: var(--jtc-red-hover);
}

/* ===========================================
   商品カード
   =========================================== */
.product-card {
  background: var(--jtc-white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-top: 0;
  border: 1px solid var(--jtc-gray-100);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-align: left;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.product-card-image {
  width: 100%;
  height: 160px;
  padding: 16px 20px;
  box-sizing: border-box;
  background: var(--jtc-white);
  border-bottom: 1px solid var(--jtc-gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.product-card-body {
  padding: 14px 16px;
}

.product-card-no {
  font-size: 11px;
  color: var(--jtc-red);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.product-card-name {
  font-size: 14px;
  font-weight: 600;
  margin: 4px 0;
  color: var(--jtc-black);
}

.product-card-desc {
  font-size: 12px;
  color: var(--jtc-gray-500);
  margin-bottom: 8px;
}

.product-card-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--jtc-red);
  line-height: 1.4;
}

.product-card-price.product-card-shikiri {
  font-size: 16px;
  margin-top: 2px;
}

.product-card-price small {
  font-size: 12px;
  font-weight: 400;
  color: var(--jtc-gray-500);
}

.product-card-stock {
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.product-card-stock.in-stock {
  color: #2e7d32;
}

.product-card-stock.low-stock {
  color: #f57c00;
}

.product-card-stock.out-of-stock {
  color: var(--jtc-red);
}

.product-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.product-card-actions a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.product-card-actions .btn-product {
  background: var(--jtc-red);
  color: var(--jtc-white);
}

.product-card-actions .btn-product:hover {
  background: var(--jtc-red-hover);
}

.product-card-actions .btn-pdf {
  background: var(--jtc-gray-100);
  color: var(--jtc-gray-700);
}

.product-card-actions .btn-pdf:hover {
  background: var(--jtc-gray-200);
}

.product-card-actions .btn-video {
  background: var(--jtc-gray-100);
  color: var(--jtc-gray-700);
}

.product-card-actions .btn-video:hover {
  background: var(--jtc-gray-200);
}

/* ===========================================
   出典表示
   =========================================== */
.chat-sources {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--jtc-gray-200);
}

.chat-sources-title {
  font-size: 11px;
  color: var(--jtc-gray-500);
  margin-bottom: 4px;
}

.chat-sources a {
  display: inline-block;
  font-size: 11px;
  color: var(--jtc-red);
  text-decoration: none;
  margin-right: 8px;
  transition: color var(--transition-fast);
}

.chat-sources a:hover {
  color: var(--jtc-red-hover);
  text-decoration: underline;
}

/* ===========================================
   ローディング
   =========================================== */
.chat-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-loading .chat-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 20px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: var(--jtc-gray-300);
  border-radius: 50%;
  animation: loadingBounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes loadingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.loading-text {
  font-size: 12px;
  color: var(--jtc-gray-500);
  margin-left: 4px;
}

/* ===========================================
   入力エリア
   =========================================== */
.chat-input-area {
  padding: 12px 16px;
  background: var(--jtc-white);
  border-top: 1px solid var(--jtc-gray-100);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--jtc-gray-bg);
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
}

.chat-input-wrapper:focus-within {
  border-color: var(--jtc-red);
  background: var(--jtc-white);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  padding: 8px 0;
  color: var(--jtc-black);
}

.chat-input::placeholder {
  color: var(--jtc-gray-300);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--jtc-red);
  color: var(--jtc-white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: var(--jtc-red-hover);
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  background: var(--jtc-gray-200);
  cursor: not-allowed;
  transform: none;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ===========================================
   レスポンシブ（スマホ対応）
   =========================================== */
@media (max-width: 768px) {
  .chat-window {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .chat-launcher {
    bottom: 88px;
    right: 16px;
  }

  body.has-recomend-fixed:not(.recomend-bar-collapsed) .chat-launcher {
    bottom: calc(var(--recomend-bar-height, 245px) + 88px);
  }

  .chat-trigger,
  .chat-trigger-robot {
    width: 76px;
    height: 76px;
  }

  .chat-launcher-bubble {
    font-size: 15px;
    font-weight: 700;
    padding: 14px 18px;
  }
}

/* JS が付与するモバイル全画面クラス（viewport幅に依存しない） */
.chat-window.chat-window--mobile-full {
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important;
  transform: none !important;
  /* JS が --chat-mobile-scale を設定（縮小表示時は > 1） */
  --cms: var(--chat-mobile-scale, 1);
  font-size: calc(16px * var(--cms));
}

/* スマホ向け：文字・余白・タップ領域を読みやすく */
.chat-window--mobile-full .chat-header {
  padding: calc(14px * var(--cms)) calc(16px * var(--cms));
  gap: calc(12px * var(--cms));
  min-height: calc(56px * var(--cms));
}

.chat-window--mobile-full .chat-header-icon {
  width: calc(44px * var(--cms));
  height: calc(44px * var(--cms));
  font-size: calc(16px * var(--cms));
  border-radius: calc(10px * var(--cms));
}

.chat-window--mobile-full .chat-header-title {
  font-size: calc(17px * var(--cms));
}

.chat-window--mobile-full .chat-header-status {
  font-size: calc(13px * var(--cms));
  gap: calc(6px * var(--cms));
}

.chat-window--mobile-full .chat-header-status::before {
  width: calc(8px * var(--cms));
  height: calc(8px * var(--cms));
}

.chat-window--mobile-full .chat-header-close {
  padding: calc(8px * var(--cms));
}

.chat-window--mobile-full .chat-header-close svg {
  width: calc(24px * var(--cms));
  height: calc(24px * var(--cms));
}

.chat-window--mobile-full .chat-messages {
  padding: calc(14px * var(--cms));
  gap: calc(14px * var(--cms));
}

.chat-window--mobile-full .chat-message {
  gap: calc(10px * var(--cms));
}

.chat-window--mobile-full .chat-avatar {
  width: calc(36px * var(--cms));
  height: calc(36px * var(--cms));
  font-size: calc(13px * var(--cms));
}

.chat-window--mobile-full .chat-bubble {
  padding: calc(12px * var(--cms)) calc(16px * var(--cms));
  font-size: calc(16px * var(--cms));
  line-height: 1.7;
  border-radius: calc(16px * var(--cms));
}

.chat-window--mobile-full .chat-bubble .chat-md-h1 {
  font-size: calc(18px * var(--cms));
}

.chat-window--mobile-full .chat-bubble .chat-md-h2 {
  font-size: calc(17px * var(--cms));
}

.chat-window--mobile-full .chat-bubble .chat-md-h3 {
  font-size: calc(16px * var(--cms));
}

.chat-window--mobile-full .chat-suggestion-btn {
  padding: calc(10px * var(--cms)) calc(16px * var(--cms));
  font-size: calc(15px * var(--cms));
  border-radius: calc(22px * var(--cms));
  min-height: calc(40px * var(--cms));
}

.chat-window--mobile-full .chat-suggestions {
  gap: calc(8px * var(--cms));
}

.chat-window--mobile-full .chat-feedback-label {
  font-size: calc(15px * var(--cms));
  margin-bottom: calc(10px * var(--cms));
}

.chat-window--mobile-full .chat-feedback-btn {
  padding: calc(10px * var(--cms)) calc(16px * var(--cms));
  font-size: calc(15px * var(--cms));
  border-radius: calc(22px * var(--cms));
  min-height: calc(40px * var(--cms));
}

.chat-window--mobile-full .chat-escalate-channels {
  padding: calc(10px * var(--cms)) calc(12px * var(--cms));
}

.chat-window--mobile-full .chat-escalate-channels li {
  font-size: calc(15px * var(--cms));
  padding: calc(4px * var(--cms)) 0;
}

.chat-window--mobile-full .product-card-body {
  padding: calc(14px * var(--cms)) calc(16px * var(--cms));
}

.chat-window--mobile-full .product-card-no {
  font-size: calc(13px * var(--cms));
}

.chat-window--mobile-full .product-card-name {
  font-size: calc(16px * var(--cms));
}

.chat-window--mobile-full .product-card-desc {
  font-size: calc(14px * var(--cms));
}

.chat-window--mobile-full .product-card-price {
  font-size: calc(18px * var(--cms));
}

.chat-window--mobile-full .product-card-price small,
.chat-window--mobile-full .product-card-stock {
  font-size: calc(13px * var(--cms));
}

.chat-window--mobile-full .product-card-actions a {
  padding: calc(10px * var(--cms)) calc(14px * var(--cms));
  font-size: calc(13px * var(--cms));
}

.chat-window--mobile-full .product-card-image {
  height: calc(180px * var(--cms));
}

.chat-window--mobile-full .chat-sources-title,
.chat-window--mobile-full .chat-sources a {
  font-size: calc(13px * var(--cms));
}

.chat-window--mobile-full .loading-text {
  font-size: calc(14px * var(--cms));
}

.chat-window--mobile-full .loading-dot {
  width: calc(10px * var(--cms));
  height: calc(10px * var(--cms));
}

.chat-window--mobile-full .chat-input-area {
  padding: calc(12px * var(--cms)) calc(14px * var(--cms));
}

.chat-window--mobile-full .chat-input-wrapper {
  padding: calc(6px * var(--cms)) calc(6px * var(--cms)) calc(6px * var(--cms)) calc(16px * var(--cms));
  border-radius: calc(28px * var(--cms));
  gap: calc(8px * var(--cms));
}

.chat-window--mobile-full .chat-input {
  font-size: calc(16px * var(--cms));
  padding: calc(10px * var(--cms)) 0;
  /* iOS で入力時の自動ズームを防ぐ */
  min-height: calc(24px * var(--cms));
}

.chat-window--mobile-full .chat-send-btn {
  width: calc(44px * var(--cms));
  height: calc(44px * var(--cms));
}

.chat-window--mobile-full .chat-send-btn svg {
  width: calc(20px * var(--cms));
  height: calc(20px * var(--cms));
}

/* ===========================================
   デモページ用スタイル
   =========================================== */
.demo-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
}

.demo-header {
  background: var(--jtc-black);
  color: var(--jtc-white);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.demo-logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.demo-logo span {
  color: var(--jtc-red);
}

.demo-hero {
  background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
  color: var(--jtc-white);
  padding: 48px 32px;
  text-align: center;
}

.demo-hero h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.demo-hero p {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  max-width: 500px;
  margin: 0 auto;
}

.demo-content {
  background: var(--jtc-white);
  padding: 40px 32px;
  border-radius: 0 0 12px 12px;
}

.demo-content h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--jtc-black);
}

.demo-content p {
  color: var(--jtc-gray-500);
  font-size: 14px;
  line-height: 1.8;
}

.demo-badge {
  display: inline-block;
  background: var(--jtc-red-light);
  color: var(--jtc-red);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}
