/* 在庫チャット（自動で循環する飾りのデモ）。Demo 2 の右下固定版と、首页の埋め込み版で共用。 */
/* ======================================================================
   Demo 2：右下に常駐する「在庫チャット」（飾りの自動デモ）。名前は demo-chat- で始まる。
   ====================================================================== */
.demo-chat { position: fixed; right: 20px; bottom: 100px; z-index: 40; width: 290px; display: none; flex-direction: column; background: #fff; border: 1px solid #dde2ea; border-radius: 16px; overflow: hidden; box-shadow: 0 18px 40px -16px rgba(15, 27, 45, .4); font-family: var(--font); color: var(--navy); animation: demo-chat-in .5s ease-out; }
.demo-chat.is-open { display: flex; }
@keyframes demo-chat-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.demo-chat__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--blue); color: #fff; padding: 0 6px 0 16px; min-height: 48px; }
.demo-chat__title { font-size: 16px; font-weight: 700; }
.demo-chat__close { width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.demo-chat__close:hover, .demo-chat__close:focus-visible { background: rgba(255, 255, 255, .2); }
.demo-chat__body { height: 176px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 12px 12px 8px; transition: opacity .4s; }
.demo-chat__body.is-leaving { opacity: 0; }
.demo-chat__bubble { max-width: 92%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.55; animation: demo-chat-pop .3s ease-out; }
.demo-chat__bubble p + p { margin-top: 3px; }
.demo-chat__bubble--me { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.demo-chat__bubble--ai { align-self: flex-start; background: #eef0f4; color: var(--navy); border-bottom-left-radius: 4px; }
@keyframes demo-chat-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.demo-chat__dots { display: inline-flex; gap: 6px; align-items: center; min-height: 22px; }
.demo-chat__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); animation: demo-chat-dot 1s infinite ease-in-out; }
.demo-chat__dots i:nth-child(2) { animation-delay: .15s; }
.demo-chat__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes demo-chat-dot { 0%, 70%, 100% { transform: none; opacity: .4; } 35% { transform: translateY(-5px); opacity: 1; } }
.demo-chat__input { margin: 0 12px; min-height: 44px; display: flex; align-items: center; padding: 0 12px; font-size: 14px; border: 1px solid #dde2ea; border-radius: 10px; }
.demo-chat__input.is-focus { border: 2px solid var(--blue); }
.demo-chat__caret { width: 2px; height: 18px; background: var(--blue); margin-left: 1px; animation: demo-chat-blink 1s steps(1) infinite; }
.demo-chat__caret[hidden] { display: none; }
@keyframes demo-chat-blink { 50% { opacity: 0; } }
.demo-chat__note { font-size: 14px; color: var(--muted); padding: 6px 14px 12px; }

.demo-chat-fab, .demo-chat-peek { display: none; }
/* 电脑：窗口常驻，不需要「×」。手机（≤860px）才有「×」（小気泡へ縮める） */
@media (min-width: 861px) { .demo-chat__close { display: none; } }

@media (max-width: 860px) {
  /* 手機：丸い小さなボタン。押すと小窓が開く。再生バー（高さ約 112px）の上に置く */
  .demo-chat-fab { position: fixed; right: 14px; bottom: 128px; z-index: 41; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; align-items: center; justify-content: center; box-shadow: 0 10px 24px -8px rgba(34, 80, 217, .7); cursor: pointer; }
  .demo-chat-fab:not([hidden]) { display: flex; }
  .demo-chat-peek { position: fixed; right: 80px; bottom: 134px; z-index: 41; max-width: min(260px, calc(100vw - 100px)); padding: 8px 12px; background: #fff; border: 1px solid #dde2ea; border-radius: 12px; box-shadow: 0 10px 24px -12px rgba(15, 27, 45, .4); font-size: 14px; line-height: 1.5; color: var(--navy); opacity: 0; pointer-events: none; transition: opacity .3s; overflow: hidden; display: block; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .demo-chat-peek.is-on { opacity: 1; }
  .demo-chat { right: 12px; bottom: 196px; width: min(300px, calc(100vw - 24px)); }
  .demo-chat__body { height: 190px; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-chat, .demo-chat__bubble { animation: none; }
  .demo-chat__dots i, .demo-chat__caret { animation: none; }
  .demo-chat__body { transition: none; }
}

/* ---------- 首页の埋め込み版（固定しない） ---------- */
.demo-chat.demo-chat--inline { position: static; display: flex; width: 100%; max-width: 420px; margin: 0 auto; z-index: auto; animation: none; box-shadow: 0 18px 40px -20px rgba(15, 27, 45, .35); }
.demo-chat--inline .demo-chat__close { display: none; }
.demo-chat--inline .demo-chat__bar { padding-right: 16px; }
.demo-chat--inline .demo-chat__body { height: 220px; }
@media (max-width: 860px) {
  .demo-chat.demo-chat--inline { position: static; width: 100%; max-width: none; }
  .demo-chat--inline .demo-chat__body { height: 210px; }
}

/* ---------- Demo 2：861–1867px では、ページ上部の右側の空きに置く（固定だと表に重なるため） ---------- */
.demo-hero__chat { display: none; }
.demo-chat.demo-chat--static { position: static; display: flex; width: 100%; max-width: 300px; margin: 0; z-index: auto; animation: none; }
@media (min-width: 861px) and (max-width: 1867px) {
  .demo-hero--chat { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0 40px; align-items: start; }
  .demo-hero__chat { display: block; padding-top: 8px; }
}
