/* チャットさん ユーザー画面 CSS */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f0f0; padding-top: env(safe-area-inset-top); }

.header { position: fixed; top: 0; left: 0; right: 0; background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%); color: #fff; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 999; padding-top: calc(12px + env(safe-area-inset-top)); }
.header-title { font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.env-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 10px; background: rgba(255,255,255,0.25); display: none; }
.env-badge:not(:empty) { display: inline-block; }
.switch-link { color: #fff; text-decoration: none; font-size: 14px; margin-right: 12px; padding: 6px 14px; border-radius: 20px; background: rgba(255,255,255,0.18); border: none; white-space: nowrap; transition: transform 0.15s, background 0.15s; -webkit-tap-highlight-color: transparent; }
.switch-link:hover, .switch-link:active { background: rgba(255,255,255,0.35); }
.switch-link:active { transform: scale(0.92); }
.reset-btn, .ai-btn { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); color: #fff; padding: 6px 16px; border-radius: 20px; cursor: pointer; font-size: 14px; margin-left: 8px; white-space: nowrap; }
.reset-btn:hover, .ai-btn:hover { background: rgba(255,255,255,0.3); }

/* ハンバーガーメニュー（モバイル用） */
.hamburger-btn { display: none; background: rgba(255,255,255,0.18); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
.hamburger-btn:active { background: rgba(255,255,255,0.35); }
.mobile-menu-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 2000; }
.mobile-menu-overlay.show { display: block; }
.mobile-menu { position: fixed; top: 0; right: -280px; width: 280px; height: 100%; background: #fff; z-index: 2001; transition: right 0.3s ease; box-shadow: -4px 0 20px rgba(0,0,0,0.15); overflow-y: auto; }
.mobile-menu.show { right: 0; }
.mobile-menu-header { background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%); color: #fff; padding: 50px 20px 16px; display: flex; justify-content: space-between; align-items: center; }
.mobile-menu-header-title { font-size: 16px; font-weight: 600; }
.mobile-menu-close { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; padding: 4px 8px; }
.mobile-menu-section { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.mobile-menu-section:last-child { border-bottom: none; }
.mobile-menu-section-label { font-size: 11px; color: #aaa; padding: 8px 20px 4px; font-weight: 600; }
.mobile-menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; font-size: 14px; color: #333; cursor: pointer; border: none; background: none; width: 100%; text-align: left; }
.mobile-menu-item:active { background: #f5f5f5; }
.mobile-menu-item svg { flex-shrink: 0; color: #888; }
.mobile-menu-item.switch-app { color: #17a2b8; font-weight: 500; }
.mobile-menu-item.switch-app svg { color: #17a2b8; }
.mobile-menu-item.danger { color: #e53e3e; }
.mobile-menu-item.danger svg { color: #e53e3e; }
.mobile-menu-font-sizes { display: flex; gap: 6px; padding: 4px 20px 8px; }
.mobile-menu-font-opt { flex: 1; padding: 6px; border: 1px solid #ddd; border-radius: 8px; background: #f5f5f5; cursor: pointer; font-size: 13px; color: #333; text-align: center; }
.mobile-menu-font-opt.active { background: #17a2b8; color: #fff; border-color: #17a2b8; }

/* よくある質問 折りたたみ（モバイル用） */
.popular-toggle { display: none; }

/* スマホ対応 */
@media (max-width: 480px) {
  .header { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .header-title { font-size: 15px; font-weight: 600; }
  .header-title .env-badge { font-size: 10px; }
  /* PC用ボタンを隠してハンバーガー表示 */
  .header .switch-link, .header .fav-header-wrap, .header #resetBtn, .header .settings-wrap { display: none !important; }
  .hamburger-btn { display: flex; }
  /* コンテンツコンパクト化 */
  .message-bubble { padding: 10px 12px; }
  .message-text { font-size: 13px; line-height: 1.5; }
  .chat-container { padding: 60px 10px 80px 10px; }
  .choice-btn { font-size: 13px; padding: 7px 14px; }
  /* よくある質問 折りたたみ */
  .popular-toggle { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #17a2b8; font-weight: 600; cursor: pointer; padding: 4px 0; user-select: none; border: none; background: none; width: 100%; }
  .popular-toggle .chevron { margin-left: auto; font-size: 14px; color: #7dd3e0; transition: transform 0.2s; }
  .popular-toggle.open .chevron { transform: rotate(90deg); }
  .popular-grid-wrap { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
  .popular-grid-wrap.open { max-height: 600px; overflow-y: auto; }
  .popular-grid { grid-template-columns: 1fr !important; gap: 6px; }
  .popular-card { padding: 8px 10px; }
  .popular-breadcrumb { font-size: 10px; margin-bottom: 3px; }
  .popular-question { font-size: 12px; }
  /* カテゴリ選択 コンパクト */
  .choices { gap: 5px; }
  /* PC用よくある質問ラベルを非表示 */
  .popular-label-pc { display: none !important; }
}

.breadcrumb { position: fixed; top: 48px; left: 0; right: 0; background: #fff; padding: 8px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); z-index: 998; font-size: 13px; color: #666; display: none; }
.breadcrumb.visible { display: block; }
.breadcrumb-item { display: inline; }
.breadcrumb-item a { color: #17a2b8; text-decoration: none; cursor: pointer; }
.breadcrumb-item a:hover { text-decoration: underline; }
.breadcrumb-separator { margin: 0 8px; color: #999; }
.breadcrumb-current { color: #333; font-weight: 500; }

.chat-container { max-width: 100%; margin: 0 auto; padding: 70px 20px 100px 20px; }
.chat-container.with-breadcrumb { padding-top: 100px; }

.message { margin-bottom: 20px; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Bot message - left */
.message.bot { display: flex; justify-content: flex-start; }
.message.bot .message-bubble { background: #fff; }

/* User message - right */
.message.user { display: flex; justify-content: flex-end; }
.message.user .message-bubble { background: #e3f2fd; }

.message-content { max-width: 90%; }
.message-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #17a2b8; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.message.user .avatar { display: none; }
.message-name { font-size: 14px; color: #666; font-weight: 500; }
.message.user .message-name { display: none; }
.message-time { font-size: 10px; color: #999; margin-left: auto; }

.message-bubble { border-radius: 12px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); position: relative; }
.message-text { font-size: 14px; line-height: 1.6; color: #333; white-space: pre-wrap; }
.message-text a { color: #17a2b8; text-decoration: underline; cursor: pointer; }
.message-text a:hover { color: #20c997; }
.message-text img { max-width: 100%; height: auto; max-height: 400px; object-fit: contain; border-radius: 8px; margin: 8px 0; cursor: pointer; }
.message-text img:hover { opacity: 0.9; }

/* 画像拡大モーダル */
.image-modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.9); }
.image-modal img { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 90%; max-height: 90%; object-fit: contain; }
.image-modal-close { position: absolute; top: 20px; right: 35px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; }
.image-modal-close:hover { color: #ccc; }

.copy-url-btn, .copy-text-btn {
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  opacity: 0.8;
  margin-left: 8px;
}

.copy-url-btn:hover, .copy-text-btn:hover {
  background: rgba(0,0,0,0.1);
  opacity: 1;
}

.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #17a2b8;
  padding: 0 4px;
  vertical-align: middle;
  transition: transform 0.2s;
}
.fav-btn:hover { transform: scale(1.2); }

/* FAQ回答アクションバー */
.faq-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  margin: -4px 0 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.faq-action-bar strong { flex: 1; }

.action-btn {
  background: none;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 12px;
  color: #666;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  transition: all 0.2s;
  white-space: nowrap;
}
.action-btn:hover { background: rgba(0,0,0,0.04); color: #333; border-color: rgba(0,0,0,0.2); }
.action-btn svg { flex-shrink: 0; width: 14px; height: 14px; }

/* 液体星ボタン */
.star-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.star-svg { position: relative; z-index: 1; }
.star-liquid {
  position: absolute;
  top: 0; left: 0;
  width: 28px; height: 28px;
  clip-path: path('M14 2.5l3.5 7.1 7.8 1.1-5.65 5.5 1.33 7.8L14 20.2l-6.98 3.8 1.33-7.8L2.7 10.7l7.8-1.1z');
  overflow: hidden;
}
.star-liquid-inner {
  position: absolute;
  bottom: 0; left: -2px; right: -2px;
  height: 0;
  background: #f5c518;
  transition: height 0.5s cubic-bezier(0.4,0,0.2,1);
  transform: rotate(5deg);
  transform-origin: bottom center;
}
.star-wrap:hover .star-liquid-inner { height: 63%; }
.star-wrap.active .star-liquid-inner { height: 100%; transform: rotate(0deg); transition: height 0.3s ease; }
.star-wrap.active .star-svg { opacity: 0; transition: opacity 0.2s; }

@keyframes starPop { 0%{transform:scale(1)} 15%{transform:scale(1.35)} 30%{transform:scale(0.9)} 50%{transform:scale(1.15)} 70%{transform:scale(0.95)} 100%{transform:scale(1)} }
.star-wrap.pop { animation: starPop 0.5s ease; }
@keyframes sparkle { 0%{opacity:1;transform:scale(0) translate(var(--tx),var(--ty))} 50%{opacity:1;transform:scale(1) translate(var(--tx),var(--ty))} 100%{opacity:0;transform:scale(0.5) translate(calc(var(--tx)*2),calc(var(--ty)*2))} }
.sparkle { position:absolute; border-radius:50%; pointer-events:none; animation:sparkle 0.55s ease forwards; z-index:2; }

/* ヘッダーお気に入りボタン */
.fav-header-wrap { position: relative; }
.fav-header-btn {
  background: rgba(255,255,255,0.18); border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: #fff;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 20px;
  transition: transform 0.15s, background 0.15s; -webkit-tap-highlight-color: transparent;
}
.fav-header-btn:hover, .fav-header-btn:active { background: rgba(255,255,255,0.35); }
.fav-header-btn:active { transform: scale(0.92); }
.fav-dropdown {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 8px;
  background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 260px; max-height: 320px; overflow-y: auto; z-index: 200;
}
.fav-dropdown.show { display: block; }
.fav-dropdown-empty { padding: 16px; color: #999; font-size: 13px; text-align: center; }
.fav-dropdown-item { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.15s; }
.fav-dropdown-item:last-child { border-bottom: none; }
.fav-dropdown-item:hover { background: #f9f9f9; }
.fav-dropdown-q { font-size: 13px; color: #333; }

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 12px 20px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 1000;
  font-size: 14px;
}

.toast.show {
  opacity: 1;
}

.choices { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.choice-btn { background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%); color: #fff; border: none; padding: 8px 16px; border-radius: 25px; cursor: pointer; font-size: 14px; text-align: left; box-shadow: 0 2px 4px rgba(236,72,153,0.3); transition: all 0.2s; display: flex; align-items: center; gap: 8px; }
.choice-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(236,72,153,0.4); }
.choice-btn::before { content: '▶'; font-size: 12px; }
.choice-btn .breadcrumb-small { display: block; font-size: 11px; color: rgba(255,255,255,0.8); margin-bottom: 4px; font-weight: normal; }

.toggle-popular { background: rgba(23,162,184,0.1); border: 1px solid #17a2b8; color: #17a2b8; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 13px; margin-top: 12px; display: inline-block; transition: all 0.2s; }
.toggle-popular:hover { background: rgba(23,162,184,0.2); }
.toggle-popular::before { content: '▼ '; }
.toggle-popular.open::before { content: '▲ '; }

.input-area { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid #e0e0e0; padding: 12px 20px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)); display: flex; gap: 10px; align-items: center; z-index: 100; }
.input-field { flex: 1; border: 1px solid #e0e0e0; border-radius: 25px; padding: 10px 16px; font-size: 14px; outline: none; }
.input-field:focus { border-color: #17a2b8; }
.send-btn { background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(236,72,153,0.3); flex-shrink: 0; }

.back-btn { position: fixed; bottom: 70px; right: 20px; background: rgba(23,162,184,0.9); color: #fff; border: none; width: 50px; height: 50px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.2); z-index: 99; font-size: 20px; transition: all 0.2s; }
.back-btn:hover { background: rgba(23,162,184,1); transform: scale(1.05); }
.back-btn.hidden { display: none; }

.back-btn-label { position: fixed; bottom: 125px; right: 10px; background: rgba(0,0,0,0.7); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 11px; z-index: 99; pointer-events: none; white-space: nowrap; }
.back-btn-label.hidden { display: none; }

.csv-upload { text-align: center; padding: 90px 20px 40px 20px; }
.csv-upload input { display: none; }
.csv-upload label { background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%); color: #fff; padding: 12px 24px; border-radius: 25px; cursor: pointer; display: inline-block; }

.hidden { display: none; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-content { background: #fff; border-radius: 12px; padding: 24px; max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 24px; cursor: pointer; color: #999; }
.modal-close:hover { color: #333; }

.feedback-form h3 { font-size: 16px; color: #333; margin-bottom: 16px; }
.feedback-form p { font-size: 14px; line-height: 1.6; color: #666; margin-bottom: 12px; }
.feedback-form .email-info { background: #f5f5f5; padding: 12px; border-radius: 8px; margin: 16px 0; font-size: 14px; line-height: 1.8; }
.feedback-form .question { margin: 20px 0; }
.feedback-form .question-title { font-weight: 600; font-size: 14px; color: #333; margin-bottom: 8px; }
.feedback-form label { display: block; margin: 8px 0; font-size: 14px; cursor: pointer; }
.feedback-form input[type="radio"] { margin-right: 8px; }
.feedback-form textarea { width: 100%; min-height: 100px; padding: 12px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 14px; font-family: inherit; resize: vertical; }
.feedback-form .note { font-size: 12px; color: #999; margin-top: 8px; }
.feedback-form .submit-btn { background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%); color: #fff; border: none; padding: 12px 32px; border-radius: 25px; cursor: pointer; font-size: 14px; margin-top: 16px; }
.feedback-form .submit-btn:hover { opacity: 0.9; }

/* AIチャットポップアップ */
.ai-popup { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 9999; display: none; opacity: 0; transition: opacity 0.3s ease; }
.ai-popup.show { opacity: 1; }
.ai-popup-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.8); background: #fff; border-radius: 12px; width: 90%; max-width: 700px; max-height: 85vh; overflow: hidden; transition: transform 0.3s ease; }
.ai-popup.show .ai-popup-content { transform: translate(-50%, -50%) scale(1); }
.ai-popup-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
.ai-popup-title { font-size: 16px; font-weight: 500; }
.ai-close-btn { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }
.ai-chat-area { padding: 20px; max-height: 500px; overflow-y: auto; }
.ai-input-area { padding: 16px 20px; border-top: 1px solid #eee; display: flex; gap: 8px; }
.ai-input { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 20px; font-size: 14px; }
.ai-send-btn { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border: none; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 14px; }
.ai-message { margin-bottom: 12px; }
.ai-message.user { text-align: right; }
.ai-message.ai { text-align: left; }
.ai-message-content { display: inline-block; padding: 8px 12px; border-radius: 12px; max-width: 80%; }
.ai-message.user .ai-message-content { background: #667eea; color: #fff; }
.ai-message.ai .ai-message-content { background: #f0f0f0; color: #333; }

/* 小さなタブ（左上） */
.search-tabs-mini {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  position: relative;
}
.search-tab-mini {
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 12px;
  background: rgba(0,0,0,0.1);
  color: #666;
  transition: all 0.3s ease;
  position: relative;
  white-space: nowrap;
  min-width: fit-content;
}
.search-tab-mini.active {
  background: #667eea;
  color: white;
}
.search-tab-mini:hover:not(.active) {
  background: rgba(0,0,0,0.15);
}

/* 検索中アニメーション */
.searching-animation {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #17a2b8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.ai-tooltip {
  position: absolute;
  top: -45px;
  left: 90%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}
.ai-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 30%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}

/* キーワード検索の説明吹き出し */
.keyword-tooltip {
  position: absolute;
  top: -45px;
  left: 90%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}
.keyword-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 30%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}
.search-tab-mini:hover .ai-tooltip,
.search-tab-mini:hover .keyword-tooltip {
  opacity: 1;
  visibility: visible;
}

/* 入力エリアの高さ調整 */
.input-area {
  padding: 12px 20px;
}

/* iPad/iPhone対応 */
@media (max-width: 1024px) {
  .chat-container {
    padding-bottom: 80px !important;
  }
  
  /* PWAモード（JavaScriptで検知） */
  html.pwa-mode {
    height: 100vh;
    height: 100dvh;
  }
  
  html.pwa-mode body {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    position: relative;
    max-height: 100vh;
    max-height: 100dvh;
  }
  
  html.pwa-mode .chat-container {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0)) !important;
  }
  
  html.pwa-mode .input-area {
    position: fixed !important;
    bottom: calc(-1 * env(safe-area-inset-bottom, 0)) !important;
    left: 0 !important;
    right: 0 !important;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)) !important;
    background: #fff !important;
    z-index: 1000 !important;
  }
}
.search-input-container {
  display: flex;
  gap: 8px;
  width: 100%;
  position: relative;
}

.suggestions-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e0e0e0;
  border-bottom: none;
  border-radius: 15px 15px 0 0;
  box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.suggestion-item {
  padding: 10px 20px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background-color: #f8f9ff;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-text {
  font-size: 14px;
  color: #333;
}

.suggestion-categories {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}
.input-field {
  flex: 1;
  min-width: 0;
  width: 100%;
}
.send-btn {
  flex-shrink: 0;
}

/* 画像サイズ制限 */
.message-bubble img, .faq-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 8px 0;
  border-radius: 4px;
}

/* リッチテキスト装飾のスタイル */
.message-text strong, .message-text b {
  font-weight: bold;
}

.message-text em, .message-text i {
  font-style: italic;
}

.message-text u {
  text-decoration: underline;
}

.message-text s, .message-text strike {
  text-decoration: line-through;
}

.message-text hr {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid #ddd;
}

.message-text blockquote {
  border-left: 4px solid #17a2b8;
  padding-left: 1rem;
  margin: 1rem 0;
  color: #666;
  font-style: italic;
}

.message-text pre {
  background: #f5f5f5;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1rem 0;
}

.message-text code {
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.message-text table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

.message-text table td, .message-text table th {
  padding: 8px;
  border: 1px solid #ddd;
}

.message-text table th {
  background: #f5f5f5;
  font-weight: bold;
}

.message-text ul, .message-text ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.message-text li {
  margin: 0.25rem 0;
}


/* よくある質問 2カラムグリッド */
.popular-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.popular-card {
  background: #e6f7f7;
  border: 1px solid rgba(23,162,184,0.2);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.popular-card:hover {
  border-color: #17a2b8;
  box-shadow: 0 2px 8px rgba(23,162,184,0.15);
  transform: translateY(-2px);
}

.popular-breadcrumb {
  font-size: 11px;
  color: #17a2b8;
  margin-bottom: 6px;
  font-weight: 500;
}

.popular-question {
  font-size: 13px;
  color: #333;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .popular-grid {
    grid-template-columns: 1fr;
  }
}

/* 画像モーダル */
.image-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.9); z-index: 10000; display: none; align-items: center; justify-content: center; }
.image-modal.show { display: flex; }
.image-modal img { max-width: 95%; max-height: 95%; object-fit: contain; }
.image-modal-close { position: absolute; top: 20px; right: 20px; color: white; font-size: 40px; cursor: pointer; background: none; border: none; }

/* URLコピーモーダル（iPad用） */
.url-copy-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 10001; display: none; align-items: center; justify-content: center; }
.url-copy-modal.show { display: flex; }
.url-copy-modal-content { background: white; border-radius: 12px; padding: 20px; max-width: 90%; width: 400px; }
.url-copy-modal-title { font-size: 16px; font-weight: bold; margin-bottom: 10px; }
.url-copy-modal-text { font-size: 12px; color: #666; margin-bottom: 15px; }
.url-copy-modal-url { background: #f5f5f5; padding: 10px; border-radius: 8px; word-break: break-all; font-size: 14px; margin-bottom: 15px; user-select: all; -webkit-user-select: all; }
.url-copy-modal-buttons { display: flex; gap: 10px; }
.url-copy-modal-btn { flex: 1; padding: 12px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; }
.url-copy-modal-btn.primary { background: #17a2b8; color: white; }
.url-copy-modal-btn.secondary { background: #e5e7eb; color: #333; }

/* Quillリッチエディタ互換スタイル */
.ql-align-center { text-align: center; }
.ql-align-right { text-align: right; }
.ql-align-justify { text-align: justify; }
.ql-indent-1 { padding-left: 3em; }
.ql-indent-2 { padding-left: 6em; }
.ql-indent-3 { padding-left: 9em; }
.ql-indent-4 { padding-left: 12em; }
.ql-indent-5 { padding-left: 15em; }
.ql-size-small { font-size: 0.75em; }
.ql-size-large { font-size: 1.5em; }
.ql-size-huge { font-size: 2.5em; }
.ql-code-block-container { background: #f4f4f4; border-radius: 4px; padding: 8px; margin: 8px 0; font-family: monospace; }
li[data-list="bullet"] { list-style-type: disc !important; }
li[data-list="ordered"] { list-style-type: decimal !important; }
li[data-list] .ql-ui { display: none; }
ol:has(li[data-list="bullet"]) { list-style-type: disc !important; padding-left: 1.5em; }

/* === 検索結果 新UI（v4） === */

/* おすすめラベル */
.recommend-label {
  display: inline-flex; align-items: center; gap: 5px;
  background: linear-gradient(135deg, #17a2b8, #20c997);
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 4px 12px; border-radius: 12px;
  margin: 16px 0 10px 0;
}

/* おすすめカード（上位） */
.card-top {
  background: linear-gradient(135deg, #f0fdfa 0%, #e6fffa 100%);
  border-radius: 14px;
  padding: 10px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 2px 8px rgba(23,162,184,0.12);
  border: 1.5px solid rgba(23,162,184,0.25);
  position: relative;
}
.card-top:hover { box-shadow: 0 6px 20px rgba(23,162,184,0.22); transform: translateY(-2px); }
.card-top:active { transform: translateY(0); }
.card-top .cat {
  display: inline-block;
  font-size: 10px; color: #17a2b8;
  background: rgba(23,162,184,0.12);
  padding: 2px 8px; border-radius: 10px;
  margin-bottom: 6px;
}
.card-top .q {
  font-size: 14px; font-weight: 500; color: #1a1a1a;
  margin-bottom: 6px; line-height: 1.3;
}
.card-top .preview {
  font-size: 12px; color: #888; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-top .arrow {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: #17a2b8; font-size: 14px;
  opacity: 0; transition: opacity 0.2s;
}
.card-top:hover .arrow { opacity: 1; }

/* アコーディオン */
.accordion-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 4px 12px; border-radius: 12px;
  margin: 16px 0 10px 0;
  border: none; cursor: pointer;
  transition: opacity 0.2s;
}
.accordion-btn:hover { opacity: 0.85; }
.accordion-btn .chevron { transition: transform 0.3s; display: inline-block; font-size: 9px; }
.accordion-btn.open .chevron { transform: rotate(180deg); }
.accordion-body { overflow: hidden; transition: max-height 0.35s ease; }
.accordion-body.open { max-height: 600px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.accordion-body.collapsed { max-height: 0; }

/* 関連カード（コンパクト） */
.card-sub {
  display: flex; align-items: center; gap: 12px;
  background: #f8f5ff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(139,92,246,0.12);
}
.card-sub:first-child { margin-top: 10px; }
.card-sub:hover { background: #f0ebff; border-color: rgba(139,92,246,0.3); }
.card-sub .info { flex: 1; min-width: 0; }
.card-sub .cat { font-size: 10px; color: #a78bfa; }
.card-sub .q { font-size: 13px; color: #333; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub .preview {
  font-size: 11px; color: #999; line-height: 1.4; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-sub .sub-arrow { color: #c4b5fd; font-size: 12px; flex-shrink: 0; }
.card-sub:hover .sub-arrow { color: #8b5cf6; }

/* マーカーハイライト */
.card-top .preview mark,
.card-sub .preview mark {
  background: linear-gradient(transparent 60%, #fde047 60%);
  color: inherit; font-weight: 600; font-style: normal;
  padding: 0;
}

/* フッターボタン */
.footer-btn { margin-top: 16px; padding-top: 14px; border-top: 1px solid #f0f0f0; }
.footer-btn button {
  background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; padding: 10px 16px;
  border-radius: 25px; cursor: pointer; font-size: 13px; width: 100%; text-align: center;
  font-weight: 500; transition: all 0.2s;
}
.footer-btn button:hover { background: #e5e7eb; color: #374151; border-color: #9ca3af; }
.footer-btn button::before { content: none; }

/* ⚙️ 設定メニュー */
.settings-wrap { position: relative; }
.settings-btn {
  background: rgba(255,255,255,0.18); border: none;
  color: #fff; width: 36px; height: 36px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: transform 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.settings-btn:hover, .settings-btn:active { background: rgba(255,255,255,0.35); }
.settings-btn:active { transform: scale(0.92); }
.settings-btn svg { display: block; }
.settings-menu {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 8px;
  background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 12px; min-width: 180px; z-index: 1001;
  opacity: 0; transform: translateY(-10px) scale(0.95);
  transition: opacity 0.2s, transform 0.2s;
}
.settings-menu.show { 
  display: block; 
  animation: menuFadeIn 0.2s forwards;
}
@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.settings-menu-label { font-size: 12px; color: #888; margin-bottom: 8px; }
.settings-font-sizes { display: flex; gap: 6px; margin-bottom: 4px; }
.font-size-opt {
  flex: 1; padding: 6px; border: 1px solid #ddd; border-radius: 8px;
  background: #f5f5f5; cursor: pointer; font-size: 13px; color: #333; text-align: center;
}
.font-size-opt.active { background: #0d9488; color: #fff; border-color: #0d9488; }
.settings-divider { height: 1px; background: #eee; margin: 10px 0; }
.settings-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 4px; border: none; background: none;
  cursor: pointer; font-size: 14px; color: #333; text-align: left; border-radius: 6px;
}
.settings-item:hover { background: #f5f5f5; }
.settings-item svg { flex-shrink: 0; color: #666; }

/* 使い方ガイド */
.guide-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9998;
  transition: clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.guide-tooltip {
  position: fixed; background: #fff; border-radius: 16px;
  padding: 24px 26px 20px; max-width: 420px; width: calc(100% - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25); z-index: 9999;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}
.guide-tooltip.visible { opacity: 1; transform: translateY(0); }
.guide-tooltip-title { font-size: 1.2rem; font-weight: 600; color: #333; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.guide-tooltip-title svg { flex-shrink: 0; }
.guide-tooltip-text { font-size: 1.05rem; color: #555; line-height: 1.7; margin-bottom: 18px; }
.guide-tooltip-footer { display: flex; justify-content: space-between; align-items: center; }
.guide-progress { font-size: 0.8rem; color: #aaa; }
.guide-progress-bar { display: flex; gap: 5px; margin-top: 5px; }
.guide-progress-dot { width: 8px; height: 8px; border-radius: 50%; background: #ddd; transition: background 0.3s; }
.guide-progress-dot.active { background: #0d9488; }
.guide-progress-dot.done { background: #99f6e4; }
.guide-buttons { display: flex; gap: 10px; }
.guide-btn { padding: 10px 22px; border-radius: 10px; border: none; cursor: pointer; font-size: 1rem; font-weight: 500; transition: all 0.2s; }
.guide-btn-skip { background: none; color: #999; }
.guide-btn-skip:hover { color: #666; }
.guide-btn-next { background: linear-gradient(135deg, #0d9488, #0f766e); color: #fff; box-shadow: 0 2px 8px rgba(13,148,136,0.3); }
.guide-btn-next:hover { box-shadow: 0 4px 12px rgba(13,148,136,0.4); }
.guide-highlight { position: relative; z-index: 9998; }

/* 文字サイズ切り替え */
body.font-small .message-text { font-size: 12px; }
body.font-small .choice-btn { font-size: 12px; }
body.font-small .input-field { font-size: 12px; }
body.font-small .card-top .q { font-size: 12px; }
body.font-small .card-top .preview { font-size: 10px; }
body.font-small .card-sub .q { font-size: 11px; }
body.font-small .popular-question { font-size: 11px; }
body.font-small .recommend-label { font-size: 10px; }
body.font-small .accordion-btn { font-size: 10px; }
body.font-small .card-top .cat { font-size: 9px; }

body.font-large .message-text { font-size: 18px; }
body.font-large .choice-btn { font-size: 18px; }
body.font-large .input-field { font-size: 18px; }
body.font-large .card-top .q { font-size: 18px; }
body.font-large .card-top .preview { font-size: 14px; }
body.font-large .card-sub .q { font-size: 16px; }
body.font-large .popular-question { font-size: 17px; }
body.font-large .recommend-label { font-size: 14px; }
body.font-large .accordion-btn { font-size: 14px; }
body.font-large .card-top .cat { font-size: 12px; }

/* フォールバック表示（案B） */
.fallback-wrap { background: #f8f8f8; border-radius: 12px; padding: 14px; margin-top: 8px; }
.fallback-label { font-size: 12px; font-weight: 600; color: #999; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.fallback-card { display: flex; align-items: center; background: #fff; border: 1px solid #e8e8e8; border-radius: 10px; padding: 12px; margin-bottom: 6px; cursor: pointer; }
.fallback-card:last-child { margin-bottom: 0; }
.fallback-card .info { flex: 1; }
.fallback-card .cat { font-size: 11px; color: #aaa; }
.fallback-card .q { font-size: 13px; color: #555; }
.fallback-card:active { background: #f0f0f0; }

/* お気に入りモーダル（案B） */
.fav-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 300; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; }
.fav-modal-overlay.show { display: flex; opacity: 1; }
.fav-modal { background: #fff; border-radius: 20px; width: 90%; max-width: 360px; max-height: 70vh; overflow: hidden; box-shadow: 0 16px 48px rgba(0,0,0,0.2); animation: favModalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes favModalPop { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
.fav-modal-header { padding: 18px 20px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #f0f0f0; }
.fav-modal-title { font-size: 16px; font-weight: 700; color: #333; display: flex; align-items: center; gap: 8px; }
.fav-modal-close { background: none; border: none; font-size: 22px; color: #aaa; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.fav-modal-close:hover { background: #f5f5f5; color: #666; }
.fav-modal-body { overflow-y: auto; max-height: calc(70vh - 60px); }
.fav-modal-item { padding: 14px 20px; cursor: pointer; border-bottom: 1px solid #f5f5f5; display: flex; align-items: center; gap: 12px; }
.fav-modal-item:last-child { border-bottom: none; }
.fav-modal-star { background: none; border: none; color: #f5c518; font-size: 18px; cursor: pointer; flex-shrink: 0; padding: 4px; border-radius: 50%; transition: background 0.15s; }
.fav-modal-star:hover { background: #fff3cd; }
.fav-modal-star:active { background: #ffeeba; }
.fav-modal-text { flex: 1; min-width: 0; }
.fav-modal-q { font-size: 14px; color: #333; line-height: 1.4; }
.fav-modal-cat { font-size: 11px; color: #aaa; margin-top: 3px; }
.fav-modal-arrow { color: #ccc; font-size: 18px; flex-shrink: 0; }
.fav-modal-empty { padding: 40px 20px; text-align: center; color: #ccc; }
.fav-modal-empty svg { margin-bottom: 12px; }
.fav-modal-empty p { font-size: 13px; }
