/* ============================================================
   SATOMI — chatbot.css  右下追尾チャットボット
   ============================================================ */

.cbt { position: fixed; right: 18px; bottom: calc(52px + 16px); z-index: 1500; font-family: 'Shippori Mincho','Hiragino Mincho ProN',serif; }

/* ---- 吹き出しアイコン（FAB） ---- */
.cbt-fab {
  position: relative;
  width: 58px; height: 58px;
  border: none; border-radius: 50%;
  background: var(--dark, #2c2825);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  transition: transform .25s ease, background .25s;
}
.cbt-fab:hover { transform: scale(1.08); background: #46403a; }
.cbt-fab svg { transition: opacity .2s, transform .3s; }
.cbt-fab .cbt-ic-close { position: absolute; opacity: 0; transform: rotate(-90deg); }
.cbt.open .cbt-fab .cbt-ic-chat { opacity: 0; transform: rotate(90deg); }
.cbt.open .cbt-fab .cbt-ic-close { opacity: 1; transform: rotate(0); }

/* 未読バッジ */
.cbt-badge {
  position: absolute; top: -2px; right: -2px;
  width: 18px; height: 18px;
  background: #c4574e; color: #fff;
  border-radius: 50%;
  font-family: 'Lato', sans-serif; font-size: .65rem; line-height: 18px;
  text-align: center;
  animation: cbtPulse 2s infinite;
}
@keyframes cbtPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(196,87,78,.45); }
  50%     { box-shadow: 0 0 0 7px rgba(196,87,78,0); }
}
.cbt.open .cbt-badge, .cbt.visited .cbt-badge { display: none; }

/* ティーザー吹き出し */
.cbt-teaser {
  position: absolute; right: 70px; bottom: 10px;
  background: #fff;
  border: 1px solid var(--sand, #e8ddd0);
  border-radius: 14px 14px 2px 14px;
  padding: .65em 1em;
  font-size: .8rem; color: var(--dark, #2c2825);
  white-space: nowrap;
  box-shadow: 0 4px 18px rgba(0,0,0,.12);
  opacity: 0; transform: translateY(6px);
  pointer-events: none;
  transition: opacity .4s, transform .4s;
}
.cbt-teaser.show { opacity: 1; transform: none; }
.cbt.open .cbt-teaser { opacity: 0; }

/* ---- チャットパネル ---- */
.cbt-panel {
  position: absolute; right: 0; bottom: 72px;
  width: min(88vw, 330px);
  background: var(--cream, #faf7f2);
  border: 1px solid var(--sand, #e8ddd0);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.22);
  overflow: hidden;
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(14px) scale(.97);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.cbt.open .cbt-panel { opacity: 1; transform: none; pointer-events: all; }

/* ヘッダー */
.cbt-head {
  display: flex; align-items: center; gap: .75rem;
  background: var(--dark, #2c2825);
  padding: .9rem 1rem;
}
.cbt-ava {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--acc, #a0836b);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem; font-style: italic;
}
.cbt-head-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem; font-style: italic; color: #fff; line-height: 1.2;
}
.cbt-head-st {
  font-family: 'Lato', sans-serif; font-size: .62rem; letter-spacing: .1em;
  color: rgba(255,255,255,.65);
  display: flex; align-items: center; gap: .35em;
}
.cbt-head-st::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #7fc97f; display: inline-block;
}

/* 本文 */
.cbt-body {
  height: min(52vh, 380px);
  overflow-y: auto;
  padding: 1rem .9rem 1.1rem;
  display: flex; flex-direction: column; gap: .65rem;
  scroll-behavior: smooth;
}

/* メッセージ */
.cbt-msg { display: flex; gap: .5rem; align-items: flex-end; animation: cbtIn .35s ease both; }
@keyframes cbtIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cbt-msg-ava {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--acc, #a0836b); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-size: .9rem; font-style: italic;
}
.cbt-bub {
  max-width: 82%;
  background: #fff;
  border: 1px solid var(--sand, #e8ddd0);
  border-radius: 12px 12px 12px 3px;
  padding: .7em .95em;
  font-size: .82rem; line-height: 1.85;
  color: #5a5048;
}
.cbt-bub a { color: var(--acc, #a0836b); text-decoration: underline; text-underline-offset: 3px; }

.cbt-msg.user { justify-content: flex-end; }
.cbt-msg.user .cbt-bub {
  background: var(--acc, #a0836b);
  border-color: var(--acc, #a0836b);
  color: #fff;
  border-radius: 12px 12px 3px 12px;
}

/* タイピング中 */
.cbt-typing { display: inline-flex; gap: 4px; padding: .3em 0; }
.cbt-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--warm, #c9b8a4);
  animation: cbtDot 1.2s infinite;
}
.cbt-typing span:nth-child(2) { animation-delay: .15s; }
.cbt-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cbtDot { 0%,60%,100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* 選択肢ボタン */
.cbt-opts { display: flex; flex-direction: column; gap: .45rem; padding-left: 34px; animation: cbtIn .35s ease both; }
.cbt-opt {
  text-align: left;
  background: #fff;
  border: 1px solid var(--acc, #a0836b);
  border-radius: 999px;
  color: var(--acc, #a0836b);
  font-family: inherit;
  font-size: .8rem; line-height: 1.5;
  padding: .55em 1.1em;
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
}
.cbt-opt:hover { background: var(--acc, #a0836b); color: #fff; transform: translateX(3px); }
.cbt-opt.cbt-opt-link { display: block; text-decoration: none; }

/* リスタート */
.cbt-restart {
  align-self: center;
  background: none; border: none;
  font-family: 'Lato', sans-serif; font-size: .68rem; letter-spacing: .1em;
  color: var(--warm, #c9b8a4);
  border-bottom: 1px solid var(--warm, #c9b8a4);
  padding: 0 0 2px; margin-top: .4rem;
  cursor: pointer;
  animation: cbtIn .35s ease both;
}
.cbt-restart:hover { color: var(--acc, #a0836b); border-color: var(--acc, #a0836b); }

@media (max-width: 480px) {
  .cbt { right: 12px; }
  .cbt-fab { width: 54px; height: 54px; }
  .cbt-panel { bottom: 66px; }
}
