/* ── 全体レイアウト ── */
#chatai-demo {
  display: flex;
  border: 1px solid #dde3ed;
  border-radius: 10px;
  overflow: visible; /* ツールチップがはみ出せるように */
  aspect-ratio: 16 / 9; height: auto;
  position: relative;
}

/* ── レスポンシブ対応 ── */
@media (max-width: 767px) {
  #chatai-demo {
    flex-direction: column;
    aspect-ratio: unset;
    height: auto;
    max-height: none;
  }
  #demo-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    height: auto;
    min-height: unset;
  }
  .demo-sb-header { padding: 8px 12px; }
  .demo-sb-new { display: none; }
  .demo-sb-label { display: none; }
  #demo-sb-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 4px 8px 6px;
    gap: 4px;
    overflow-y: visible;
  }
  .demo-sb-item {
    font-size: 12px;
    padding: 5px 10px;
    margin: 0;
    border: 1px solid rgba(255,255,255,0.15);
  }
  #demo-chat {
    width: 100%;
    border-right: none;
    border-top: 1px solid #e5e9f0;
    min-height: 280px;
  }
  #demo-preview {
    min-height: 200px;
    border-top: 1px solid #e5e9f0;
  }
  #demo-balloon {
    left: 50%;
    top: auto;
    bottom: calc(100% - 80px);
    transform: translateX(-50%);
    white-space: normal;
    max-width: 90%;
    text-align: center;
  }
  #demo-balloon::before {
    display: none;
  }
  .demo-tabbar { overflow-x: auto; }
  .demo-tab-agent { margin-right: 4px; }
  #demo-messages { max-height: 200px; overflow-y: auto; }
}

/* 白フィルター */
#demo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.62);
  border-radius: 10px;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

/* ツールチップ（吹き出し） */
#demo-balloon {
  position: absolute;
  left: 172px; /* サイドバー200pxから28px手前 → 少し重なる */
  top: 30%;
  transform: translateY(-50%);
  background: #0085CE;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  padding: 11px 16px;
  border-radius: 10px;
  white-space: nowrap;
  z-index: 20;
  box-shadow: 0 4px 18px rgba(0,133,206,0.32), 0 1px 4px rgba(0,0,0,0.1);
  animation: demoBalloonIn 0.4s cubic-bezier(0.22,1,0.36,1) forwards;
  pointer-events: all;
}
@keyframes demoBalloonIn {
  0%  { opacity: 0; transform: translateY(-50%) scale(0.88); }
  70% { opacity: 1; transform: translateY(-50%) scale(1.02); }
  100%{ opacity: 1; transform: translateY(-50%) scale(1); }
}
/* 左向き三角 */
#demo-balloon::before {
  content: '';
  position: absolute;
  left: -8px; top: 50%;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid #0085CE;
}
#demo-balloon-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(255,255,255,0.28);
  font-size: 9px; color: #fff; font-weight: normal;
  margin-left: 10px; cursor: pointer; vertical-align: middle;
  transition: background 0.15s;
}
#demo-balloon-close:hover { background: rgba(255,255,255,0.5); }

/* ── ① サイドバー（フィルターより前面） ── */
#demo-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #1c1c1e;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 6; /* overlay(5) より上 */
}
.demo-sb-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.demo-sb-logo {
  width: 22px; height: 22px;
  background: #0085CE; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.demo-sb-brand { font-size: 13px; font-weight: bold; color: #fff; }
.demo-sb-new {
  margin: 10px 14px 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px; padding: 6px 10px;
  font-size: 13px; color: rgba(255,255,255,0.5); cursor: default;
}
.demo-sb-label {
  margin: 10px 14px 4px;
  font-size: 11px; letter-spacing: .07em;
  color: rgba(255,255,255,0.28); text-transform: uppercase;
}
#demo-sb-list { flex: 1; overflow-y: auto; padding-bottom: 8px; scrollbar-width: none; }
#demo-sb-list::-webkit-scrollbar { display: none; }
.demo-sb-item {
  padding: 8px 14px;
  font-size: 15px; line-height: 1.4;
  color: rgba(255,255,255,0.45);
  cursor: pointer; border-radius: 6px; margin: 1px 8px;
  transition: all .15s;
}
.demo-sb-item:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.07); }
.demo-sb-item.active { background: rgba(0,133,206,0.28); color: #5bbcff; }

/* ── ② チャットエリア ── */
#demo-chat {
  width: 460px;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: #fff;
  border-right: 1px solid #e5e9f0;
}
.demo-tabbar {
  display: flex; align-items: center;
  border-bottom: 1px solid #e5e9f0;
  height: 38px; padding: 0 4px; flex-shrink: 0;
}
.demo-tab {
  padding: 0 12px; height: 100%;
  display: flex; align-items: center;
  font-size: 13px; color: #888;
  border-bottom: 2px solid transparent; cursor: default;
}
.demo-tab.on { color: #0085CE; border-bottom-color: #0085CE; }
.demo-tab-agent {
  margin-left: auto; margin-right: 8px;
  font-size: 12px; color: #888;
  border: 1px solid #dde3ed; border-radius: 4px;
  padding: 2px 7px; cursor: default;
}
.demo-filebadge {
  display: none; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-bottom: 1px solid #e5e9f0; flex-shrink: 0;
}
.demo-fileicon {
  width: 28px; height: 28px;
  background: #E53935; border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 7px; font-weight: bold; letter-spacing: 0.02em;
}
#demo-docname { font-size: 13px; color: #333; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#demo-messages {
  flex: 1; overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.demo-msg-user {
  align-self: flex-end;
  background: #f3f4f6; border: 1px solid #e5e9f0;
  border-radius: 12px 12px 3px 12px;
  padding: 8px 13px; font-size: 14px; line-height: 1.5;
  max-width: 80%; color: #222;
}
.demo-msg-ai-wrap { align-self: flex-start; max-width: 96%; }
.demo-ai-icon {
  width: 18px; height: 18px; border-radius: 50%;
  background: #0085CE;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.demo-msg-ai-bubble {
  background: #EFF6FF;
  border-radius: 3px 12px 12px 12px;
  padding: 10px 13px; font-size: 14px; line-height: 1.7;
  min-height: 36px; color: #222;
}
.demo-src-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.demo-src-link {
  font-size: 12px; color: #0085CE;
  background: rgba(0,133,206,0.1);
  border-radius: 4px; padding: 2px 7px;
}
.demo-thinking-dots { display: flex; gap: 5px; padding: 3px 0; }
.demo-thinking-dots span {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #0085CE; opacity: .4;
  animation: demoDot 1.2s ease-in-out infinite;
}
.demo-thinking-dots span:nth-child(2) { animation-delay: .2s; }
.demo-thinking-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes demoDot { 0%,60%,100%{opacity:.4;transform:scale(1);} 30%{opacity:1;transform:scale(1.3);} }
.demo-cursor {
  display: inline-block; width: 2px; height: 12px;
  background: #0085CE; margin-left: 1px; vertical-align: text-bottom;
  animation: demoBlink .7s step-end infinite;
}
@keyframes demoBlink { 0%,100%{opacity:1;} 50%{opacity:0;} }
@keyframes demoSlideIn { from{opacity:0;transform:translateY(7px);} to{opacity:1;transform:translateY(0);} }
.demo-slide-in { animation: demoSlideIn .2s ease forwards; }

/* 入力欄 */
.demo-input-wrap { border-top: 1px solid #e5e9f0; flex-shrink: 0; padding-bottom: 0; overflow: visible; }
.demo-input-box {
  margin: 8px 10px 0 10px;
  border: 1px solid #dde3ed; border-radius: 8px;
  background: #f8f9fc; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 6px;
  overflow: visible;
}
.demo-input-top { display: flex; align-items: flex-start; gap: 6px; }
.demo-input-placeholder { flex: 1; font-size: 12px; color: #aaa; }
.demo-mic-icon { color: #bbb; display: flex; align-items: center; margin-top: 3px; }
.demo-input-bottom { display: flex; align-items: center; justify-content: space-between; overflow: visible; }
.demo-kbd-btn {
  width: 24px; height: 20px; border-radius: 4px;
  border: 1px solid #dde3ed; background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: #bbb; cursor: default;
}
.demo-input-right { display: flex; align-items: center; gap: 6px; overflow: visible; position: relative; }
.demo-tpl-btn {
  font-size: 12px; color: #666;
  border: 1px solid #dde3ed; border-radius: 5px;
  padding: 3px 10px; background: #fff; cursor: default;
  height: 28px; display: flex; align-items: center;
}
.demo-send-group { display: flex; align-items: center; border-radius: 6px; overflow: hidden; }
.demo-send-main {
  width: 30px; height: 26px; background: #72A79A;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.demo-send-caret {
  width: 18px; height: 26px; background: #72A79A;
  border-left: 1px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #fff; cursor: pointer;
}

/* ── ③ プレビューパネル ── */
#demo-preview {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: #f0f2f5;
}
.demo-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 12px; background: #fff;
  border-bottom: 1px solid #e5e9f0;
  height: 38px; gap: 8px; flex-shrink: 0;
}
.demo-preview-header > span {
  font-size: 13px; color: #888;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.demo-preview-pager { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.demo-page-btn {
  width: 22px; height: 22px; border-radius: 4px;
  border: 1px solid #dde3ed; background: #f8f9fc; color: #666;
  font-size: 13px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.demo-page-btn:disabled { opacity: .3; cursor: default; }
#demo-page-label { font-size: 12px; color: #999; min-width: 34px; text-align: center; }
.demo-dl-btn {
  font-size: 12px; color: #666;
  border: 1px solid #dde3ed; border-radius: 3px;
  padding: 2px 8px; cursor: default; margin-left: 4px;
  white-space: nowrap;
}
@media (max-width: 1080px) {
  .demo-dl-btn { display: none; }
}
.demo-preview-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 14px; overflow: hidden;
}
#demo-skeleton {
  width: 100%; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg,#e0e4ea 25%,#eaecf0 50%,#e0e4ea 75%);
  background-size: 800px 100%;
  animation: demoShimmer 1.4s infinite linear;
}
@keyframes demoShimmer { 0%{background-position:-400px 0;} 100%{background-position:400px 0;} }
#demo-img-wrap {
  display: none; width: 100%; height: 100%;
  align-items: center; justify-content: center;
}
#demo-preview-img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; border-radius: 6px;
  display: block; opacity: 0;
  transition: opacity .35s ease;
}
#demo-img-fallback {
  display: none; width: 100%; height: 100%;
  flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: #fff; border: 1px solid #dde3ed; border-radius: 8px;
}
.demo-fallback-icon {
  width: 48px; height: 48px; border-radius: 8px;
  background: #f3f4f6;
  display: flex; align-items: center; justify-content: center;
}
#demo-fallback-name { font-size: 14px; font-weight: bold; color: #333; }
.demo-fallback-hint { font-size: 13px; color: #999; }

/* ── 添付ファイルカード（ユーザーメッセージ内） ── */
.demo-attach-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #dde3ed;
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 8px;
  max-width: 220px;
}
.demo-attach-icon {
  width: 36px; height: 36px;
  border-radius: 6px;
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}
.demo-attach-info { min-width: 0; }
.demo-attach-name {
  font-size: 12px; font-weight: bold; color: #222;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 150px;
}
.demo-attach-size { font-size: 11px; color: #999; margin-top: 2px; }
.demo-msg-user { display: flex; flex-direction: column; align-items: flex-end; }

/* ── Step2 送信ボタンバルーン ── */
#demo-send-wrap { position: relative; }
#demo-step2-balloon {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: #0085CE;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  padding: 9px 15px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,133,206,0.32);
  animation: demoBalloonIn 0.4s cubic-bezier(0.22,1,0.36,1) forwards;
}
#demo-step2-balloon::after {
  content:'';
  position:absolute;
  bottom:-7px; right:14px;
  border-left:7px solid transparent;
  border-right:7px solid transparent;
  border-top:7px solid #0085CE;
}
/* 送信ボタン点滅ハイライト */
.demo-send-group.step2-highlight .demo-send-main,
.demo-send-group.step2-highlight .demo-send-caret {
  animation: demoPulse 1s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(0,133,206,0.6);
}
@keyframes demoPulse {
  0%   { box-shadow: 0 0 0 0 rgba(0,133,206,0.6); }
  60%  { box-shadow: 0 0 0 7px rgba(0,133,206,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,133,206,0); }
}
/* プレースホルダーにプロンプト表示 */
#demo-placeholder.has-prompt {
  color: #333;
  font-size: 14px; /* 左のメニューと同じサイズ。さらに大きくする場合は 15px に */
  font-style: normal;
  white-space: pre-wrap;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0.5; /* ★追加：添付ファイルカードも含めて全体をグレーアウト（半透明に） */
}
/* ── benefit バナー ── */
#demo-benefit-banner {
  display: none;
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: #1D9E75;
  color: #fff;
  border-radius: 10px;
  padding: 14px 40px 14px 16px;
  z-index: 30;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  animation: demoSlideIn 0.35s ease forwards;
  font-size: 13px;
  line-height: 1.65;
  pointer-events: auto;
}
#demo-benefit-banner .benefit-title {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
#demo-benefit-banner .benefit-title::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  font-size: 10px;
  flex-shrink: 0;
}
#demo-benefit-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  color: rgba(255,255,255,0.7);
  font-size: 16px; cursor: pointer;
  line-height: 1; padding: 2px 4px;
}
#demo-benefit-close:hover { color: #fff; }


/* ========================================================
   モバイル専用スタイル (max-width: 767px)
======================================================== */


/* ──── モバイルヘッダー ──── */
#demo-mobile-header {
  display: none;
  align-items: center;
  background: #1c1c1e;
  height: 44px;
  padding: 0 14px;
  flex-shrink: 0;
  gap: 0;
}
#demo-mobile-title {
  flex: 1; text-align: center;
  color: #fff; font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#demo-mobile-plus {
  background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 4px 0 4px 8px;
  line-height: 1; flex-shrink: 0;
}

/* ──── モバイルタブバー ──── */
#demo-mobile-tabbar {
  display: none;
  background: #fff;
  border-bottom: 1px solid #e5e9f0;
  height: 44px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
#demo-mobile-tabbar::-webkit-scrollbar { display: none; }
.dm-tab {
  flex-shrink: 0;
  padding: 0 16px;
  height: 100%;
  display: inline-flex; align-items: center;
  font-size: 14px; color: #888;
  border-bottom: 2px solid transparent;
  cursor: default;
}
.dm-tab.active { color: #0085CE; border-bottom-color: #0085CE; }

/* ──── モバイルモデルバー ──── */
#demo-mobile-modelbar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #fff;
  border-bottom: 1px solid #e5e9f0;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.dm-model-sel {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; color: #222;
  border: 1px solid #dde3ed; border-radius: 6px;
  padding: 3px 10px; cursor: default; background: #fff;
}
.dm-model-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: #555;
  border: 1px solid #dde3ed; border-radius: 6px;
  padding: 3px 10px; cursor: default; background: #fff;
}


/* ──── ファーストタップCTA ──── */
#demo-sp-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px 20px 28px;
  flex: 1;
}
.demo-sp-start-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0085CE 0%, #0ba5e9 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 18px rgba(0,133,206,0.35);
  animation: spIconPulse 2s ease-in-out infinite;
}
@keyframes spIconPulse {
  0%,100% { box-shadow: 0 4px 18px rgba(0,133,206,0.35); transform: scale(1); }
  50%      { box-shadow: 0 6px 28px rgba(0,133,206,0.55); transform: scale(1.05); }
}
.demo-sp-start-title {
  text-align: center;
  font-size: 16px; font-weight: 700; color: #111;
  line-height: 1.5;
}
.demo-sp-start-sub {
  text-align: center;
  font-size: 13px; color: #888; line-height: 1.6;
  margin-top: -10px;
}
#demo-sp-start-btn {
  display: flex; align-items: center; gap: 8px;
  background: #0085CE;
  color: #fff;
  font-size: 15px; font-weight: 700;
  border: none; border-radius: 12px;
  padding: 15px 32px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,133,206,0.4);
  transition: transform .15s, box-shadow .15s;
  width: 100%; max-width: 280px;
  justify-content: center;
}
#demo-sp-start-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0,133,206,0.3);
}
.demo-sp-start-note {
  font-size: 12px; color: #bbb;
}

/* ──── SPシナリオチップス ──── */
#demo-sp-chips {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0 14px 12px;
  flex: 1;
  overflow-y: auto;
}
.demo-sp-chips-label {
  font-size: 12px; color: #888;
  padding: 12px 2px 8px;
  font-weight: 600; letter-spacing: .04em;
}
.demo-sp-chip {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px;
  background: #fff;
  border: none;
  border-bottom: 1px solid #f0f2f5;
  font-size: 14px; color: #111; text-align: left;
  cursor: pointer; line-height: 1.4;
  transition: background .12s;
  width: 100%;
}
.demo-sp-chip:first-of-type { border-top: 1px solid #f0f2f5; }
.demo-sp-chip:active { background: #f0f6ff; }
.demo-sp-chip-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: #EFF6FF; color: #0085CE;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
/* チップス展開アニメ */
@keyframes spChipsIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.demo-sp-chips-animate {
  animation: spChipsIn 0.3s ease forwards;
}

/* ──── インラインプレビュー（AIバブル内） ──── */
.demo-inline-preview-card {
  align-self: flex-start;
  margin-left: 26px; /* AIアイコン幅分 */
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #dde3ed;
  max-width: 90%;
}
.demo-inline-preview-img {
  display: block;
  width: 100%; max-width: 280px;
  height: auto; border-radius: 8px;
}

/* ──── モバイル benefitバナー ──── */
#demo-mobile-benefit {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #1D9E75;
  color: #fff;
  padding: 16px 16px 20px;
  border-radius: 16px 16px 0 0;
  z-index: 300;
  animation: demoSlideUp 0.35s ease forwards;
  font-size: 14px; line-height: 1.65;
}
@keyframes demoSlideUp { from{transform:translateY(100%);opacity:0;} to{transform:translateY(0);opacity:1;} }
#demo-mobile-benefit .sp-benefit-title {
  font-weight: bold; font-size: 15px;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
#demo-mobile-benefit .sp-benefit-title::before {
  content: '✓';
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  font-size: 10px; flex-shrink: 0;
}
#demo-mobile-benefit .sp-benefit-retry {
  margin-top: 14px;
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 8px; padding: 10px 16px;
  font-size: 14px; font-weight: bold; color: #fff;
  cursor: pointer;
}

@media (max-width: 767px) {
  /* 全体レイアウト */
  #chatai-demo {
    flex-direction: column;
    aspect-ratio: unset;
    height: auto;
    min-height: 540px;
    border-radius: 10px;
    overflow: hidden;
  }

  /* PCオーバーレイ・バルーン非表示 */
  #demo-overlay { display: none !important; }
  #demo-balloon  { display: none !important; }

  /* サイドバー → ドロワー */
  #demo-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 85%; max-width: 320px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4,0,0.2,1);
    flex-direction: column;
    height: 100%;
    min-height: unset;
  }
  .demo-sb-header {
    padding: 14px 16px;
    display: flex; align-items: center;
  }
  .demo-sb-new { margin: 10px 14px 4px; }
  .demo-sb-label { display: block; }
  #demo-sb-list {
    flex-direction: column;
    overflow-y: auto;
  }

  /* チャットエリア：全幅・縦積み */
  #demo-chat {
    width: 100%;
    flex: 1;
    display: flex; flex-direction: column;
    border-right: none;
    min-height: 0;
  }

  /* PCタブバー非表示 */
  .demo-tabbar { display: none !important; }

  /* モバイルヘッダー等を表示 */
  #demo-mobile-header    { display: flex; }
  #demo-mobile-tabbar    { display: flex; }
  #demo-mobile-modelbar  { display: flex; }

  /* ファイルバッジ（SP表示用） */
  .demo-filebadge { flex-shrink: 0; }
  .demo-filebadge.has-file { display: flex !important; padding: 8px 12px; background: #fff; border-bottom: 1px solid #e5e9f0; }
  .demo-filebadge .demo-fileicon { width: 36px; height: 26px; border-radius: 3px; font-size: 8px; }

  /* メッセージエリア */
  #demo-messages {
    flex: 1;
    max-height: none;
    overflow-y: auto;
    min-height: 100px;
    padding: 12px;
  }

  /* 入力欄 */
  .demo-input-wrap { flex-shrink: 0; }
  #demo-placeholder.has-prompt { font-size: 12px; }

  /* プレビューパネル非表示 */
  #demo-preview { display: none !important; }

  /* PC版 benefitバナー非表示 */
  #demo-benefit-banner { display: none !important; }
}

/* プレビュー非表示時：チャットを右端まで伸ばす */
#chatai-demo.no-preview .demo-msg-ai-bubble { max-width: none; }
#chatai-demo.no-preview #demo-preview {
  display: none;
}
#chatai-demo.no-preview #demo-chat {
  width: auto;
  flex: 1;
}


/* ──── テーブル（HTMLセグメント用） ──── */
.demo-msg-ai-bubble .demo-table {
  width: 100%; border-collapse: collapse;
  font-size: 11px; margin: 6px 0;
}
.demo-msg-ai-bubble .demo-table th {
  background: #1a2e5a; color: #fff;
  padding: 5px 8px; text-align: left; font-weight: 600;
}
.demo-msg-ai-bubble .demo-table td {
  border-bottom: 1px solid #e5e9f0;
  padding: 5px 8px; color: #333; word-break: break-all;
}
.demo-msg-ai-bubble .demo-table tr:nth-child(even) td { background: #f6f8fc; }
.demo-msg-ai-bubble .demo-table tr:last-child td { border-bottom: none; }
