/* EDEALのサイト用チャット */
.edeal-chat { position: fixed; right: 20px; bottom: 20px; z-index: 1000; font-family: inherit; }

.edeal-chat-toggle {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: #bd175c; color: #fff; font-size: 26px;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
.edeal-chat-toggle:focus-visible { outline: 3px solid #ffd54a; outline-offset: 3px; }

.edeal-chat-bubble {
  position: absolute; right: 70px; bottom: 14px; width: max-content; max-width: 240px;
  background: #fff; color: #222; padding: 10px 28px 10px 14px; border-radius: 14px;
  font-size: 14px; font-weight: bold; box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.edeal-chat-bubble::after {
  content: ""; position: absolute; right: -8px; bottom: 16px; border-width: 8px 0 8px 8px;
  border-style: solid; border-color: transparent transparent transparent #fff;
}
.edeal-chat-bubble-close {
  position: absolute; top: 2px; right: 6px; border: 0; background: none; color: #666; font-size: 16px; cursor: pointer;
}

.edeal-chat-panel {
  position: absolute; right: 0; bottom: 74px; width: 400px; max-width: calc(100vw - 40px);
  height: 600px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column; background: #111; color: #e5e7eb;
  border: 1px solid #2d2d2d; border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.6); overflow: hidden;
}
.edeal-chat-panel[hidden] { display: none; }
.edeal-chat-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: #000; border-bottom: 1px solid #2d2d2d; }
.edeal-chat-title { font-weight: bold; font-size: 15px; }
.edeal-chat-x { border: 0; background: none; color: #ccc; font-size: 20px; cursor: pointer; }

.edeal-chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.edeal-chat-msg { max-width: 85%; padding: 8px 11px; border-radius: 12px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.edeal-chat-msg-bot { background: #1f1f1f; align-self: flex-start; border: 1px solid #2d2d2d; }
.edeal-chat-msg-user { background: #bd175c; color: #fff; align-self: flex-end; }
.edeal-chat-msg a { color: #ffd54a; text-decoration: underline; }

.edeal-chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #2d2d2d; background: #000; }
.edeal-chat-input {
  flex: 1; resize: none; background: #161616; color: #fff; border: 1px solid #333; border-radius: 8px;
  padding: 8px; font-size: 14px; font-family: inherit;
}
.edeal-chat-send {
  border: 0; border-radius: 8px; background: #bd175c; color: #fff; padding: 0 14px; font-weight: bold; cursor: pointer;
}
.edeal-chat-send:disabled { opacity: .5; cursor: default; }

.edeal-chat-notice { padding: 8px 12px; font-size: 12px; line-height: 1.6; color: #bbb; background: #161616; border-bottom: 1px solid #2d2d2d; }
.edeal-chat-notice a { color: #ffd54a; text-decoration: underline; }

/* スマホ：画面下の固定メニュー（高さ約56px＋iPhoneの下の余白）の上に出す */
@media (max-width: 767.98px) {
  .edeal-chat { right: 14px; bottom: calc(56px + 14px + env(safe-area-inset-bottom, 0px)); }
  .edeal-chat-toggle { width: 52px; height: 52px; font-size: 22px; }
  .edeal-chat-bubble { right: 62px; bottom: 10px; max-width: calc(100vw - 100px); font-size: 13px; }
  .edeal-chat-bubble::after { bottom: 12px; }
  .edeal-chat-panel {
    bottom: 64px; width: calc(100vw - 28px); max-width: calc(100vw - 28px); height: 640px;
    max-height: calc(100vh - 56px - 14px - 64px - 24px - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 56px - 14px - 64px - 24px - env(safe-area-inset-bottom, 0px));
  }
}

/* 会話欄のスクロールバー（細く、EDEALのピンク） */
.edeal-chat-log { scrollbar-width: thin; scrollbar-color: #bd175c transparent; }
.edeal-chat-log::-webkit-scrollbar { width: 6px; }
.edeal-chat-log::-webkit-scrollbar-track { background: transparent; }
.edeal-chat-log::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff3d8b, #bd175c); border-radius: 6px;
  box-shadow: 0 0 6px rgba(255, 61, 139, .6);
}
.edeal-chat-log::-webkit-scrollbar-thumb:hover { background: #ff3d8b; }
.edeal-chat-log::-webkit-scrollbar-button { display: none; height: 0; }

/* アイコンを押したときの、ぴょこっとした動き */
.edeal-chat-toggle { transition: transform .15s ease, box-shadow .15s ease; }
.edeal-chat-toggle:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(189, 23, 92, .55); }
.edeal-chat-toggle.is-pop { animation: edeal-chat-pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.edeal-chat-toggle.is-pop i { display: inline-block; animation: edeal-chat-wiggle .6s ease; }
@keyframes edeal-chat-pop {
  0% { transform: scale(1); }
  25% { transform: scale(.82); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes edeal-chat-wiggle {
  0%, 100% { transform: rotate(0); }
  30% { transform: rotate(-18deg); }
  55% { transform: rotate(14deg); }
  80% { transform: rotate(-6deg); }
}
@media (prefers-reduced-motion: reduce) {
  .edeal-chat-toggle, .edeal-chat-toggle.is-pop, .edeal-chat-toggle.is-pop i { animation: none; transition: none; }
}
