/* ZEAMI Art FAQ Bot widget — scoped under #zfb-root */
#zfb-root, #zfb-root * { box-sizing: border-box; }
#zfb-root {
  --zfb-primary: #1f2933;
  --zfb-accent: #fbb03b;
  --zfb-bot-bg: #f3f4f6;
  --zfb-user-bg: #fde8c4;
  --zfb-text: #20262e;
  --zfb-muted: #6b7280;
  --zfb-border: #e5e7eb;
  /* Anchored to the VISUAL viewport via JS so it stays on-screen even on
     non-responsive / fixed-width pages. pointer-events:none lets the page
     stay clickable; children re-enable pointer-events. */
  position: fixed; left: 0; top: 0; width: 100vw; height: 100vh;
  pointer-events: none; transform-origin: top left;
  z-index: 2147483000;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* launcher */
#zfb-launcher {
  position: absolute; right: 20px; bottom: 20px; pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px 12px 14px;
  background: var(--zfb-primary); color: #fff;
  border: none; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  cursor: pointer; font-size: 15px; font-weight: 700; line-height: 1;
  transition: transform .15s ease, box-shadow .15s ease;
}
#zfb-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.28); }
#zfb-launcher .zfb-ic { width: 24px; height: 24px; display:inline-flex; align-items:center; justify-content:center;
  background: var(--zfb-accent); color: var(--zfb-primary); border-radius: 50%; font-weight: 900; font-size: 15px; }
#zfb-launcher.zfb-hide { display: none; }

/* panel — サイズは #zfb-root(JSで実表示領域=visualViewportに一致) の % 基準。
   100vh/100vw を使うと iOS でツールバー分はみ出してヘッダーが切れるため使わない。 */
#zfb-panel {
  position: absolute; right: 20px; bottom: 20px; pointer-events: auto;
  width: min(384px, calc(100% - 32px));
  height: min(580px, calc(100% - 32px));
  max-height: calc(100% - 16px);
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.30);
  display: none; flex-direction: column;
  border: 1px solid var(--zfb-border);
}
#zfb-panel.zfb-open { display: flex; animation: zfb-pop .18s ease; }
@keyframes zfb-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

#zfb-head {
  background: var(--zfb-primary); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; gap: 10px;
}
#zfb-head .zfb-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--zfb-accent);
  color: var(--zfb-primary); display:flex; align-items:center; justify-content:center; font-weight: 900; }
#zfb-head .zfb-ttl { font-size: 15px; font-weight: 800; line-height: 1.2; }
#zfb-head .zfb-sub { font-size: 11px; opacity: .8; margin-top: 2px; }
#zfb-head .zfb-close { margin-left: auto; background: transparent; border: none; color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer; opacity: .85; padding: 4px; }
#zfb-head .zfb-close:hover { opacity: 1; }

#zfb-log { flex: 1; overflow-y: auto; padding: 16px; background: #fafafa; }
.zfb-row { display: flex; margin-bottom: 12px; }
.zfb-row.zfb-bot { justify-content: flex-start; }
.zfb-row.zfb-user { justify-content: flex-end; }
.zfb-bubble {
  max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.65;
  color: var(--zfb-text); word-wrap: break-word; overflow-wrap: anywhere;
}
.zfb-bot .zfb-bubble { background: var(--zfb-bot-bg); border-top-left-radius: 4px; }
.zfb-user .zfb-bubble { background: var(--zfb-user-bg); border-top-right-radius: 4px; }
.zfb-bubble a { color: #b45309; text-decoration: underline; }
.zfb-bubble img { max-width: 100%; height: auto; border-radius: 6px; margin: 4px 0; }
.zfb-ans-title { font-weight: 800; display: block; margin-bottom: 6px; color: var(--zfb-primary); }
.zfb-text { white-space: normal; }
.zfb-more { margin-top: 9px; display: flex; flex-direction: column; gap: 3px; }
.zfb-src { font-size: 11.5px; color: var(--zfb-muted); }
.zfb-link { align-self: flex-start; font-size: 13px; font-weight: 700; color: #b45309; text-decoration: none;
  border: 1px solid var(--zfb-accent); border-radius: 8px; padding: 5px 11px; background: #fffaf0; }
.zfb-link:hover { background: #fff3d9; }

/* chips */
.zfb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.zfb-chip {
  background: #fff; border: 1px solid var(--zfb-accent); color: var(--zfb-primary);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; cursor: pointer; line-height: 1.3;
  text-align: left; transition: background .12s ease;
}
.zfb-chip:hover { background: #fff7e9; }
.zfb-chips.zfb-suggest { margin-top: 10px; }

/* related / escalation */
.zfb-related { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--zfb-border); }
.zfb-related .zfb-lbl { font-size: 12px; color: var(--zfb-muted); margin-bottom: 6px; }
.zfb-esc { margin-top: 10px; font-size: 12.5px; color: var(--zfb-muted); }
.zfb-esc a { color: #b45309; font-weight: 700; }

/* typing */
.zfb-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.zfb-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b8bec7; display: inline-block;
  animation: zfb-blink 1.2s infinite both; }
.zfb-typing i:nth-child(2) { animation-delay: .2s; }
.zfb-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes zfb-blink { 0%,80%,100% { opacity:.25; } 40% { opacity:1; } }

/* input */
#zfb-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--zfb-border); background: #fff; }
#zfb-input textarea {
  flex: 1; resize: none; border: 1px solid var(--zfb-border); border-radius: 10px;
  padding: 9px 11px; font-family: inherit; max-height: 96px; line-height: 1.4; color: var(--zfb-text);
  /* iOSはinputのfont-sizeが16px未満だとフォーカス時に自動ズーム→表示崩れ。16pxで抑止 */
  font-size: 16px;
}
#zfb-input textarea:focus { outline: none; border-color: var(--zfb-accent); box-shadow: 0 0 0 2px rgba(251,176,59,.25); }
#zfb-send { background: var(--zfb-primary); color: #fff; border: none; border-radius: 10px;
  width: 44px; flex: 0 0 44px; cursor: pointer; font-size: 18px; }
#zfb-send:disabled { opacity: .5; cursor: default; }

#zfb-foot { font-size: 10.5px; color: var(--zfb-muted); text-align: center; padding: 6px 10px 9px; background:#fff; }

@media (max-width: 480px) {
  /* 実表示領域(#zfb-root)を上下左右8pxの余白で満たす。100vh不使用＝ヘッダーが切れない */
  #zfb-panel { top: 8px; right: 8px; bottom: 8px; left: 8px; width: auto; height: auto; max-height: none; border-radius: 14px; }
  #zfb-launcher { right: 14px; bottom: 14px; }
}
