.aicb-root {
  --aicb-color: #2563eb;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1f2937;
  box-sizing: border-box;
}
.aicb-root *, .aicb-root *::before, .aicb-root *::after { box-sizing: inherit; }

/* 右下（左下）のボタン */
.aicb-floating { position: fixed; bottom: 20px; z-index: 99999; }
.aicb-floating.aicb-pos-right { right: 20px; }
.aicb-floating.aicb-pos-left { left: 20px; }

.aicb-launcher {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--aicb-color); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  transition: transform .15s;
}
.aicb-launcher:hover { transform: scale(1.06); }

.aicb-floating .aicb-panel {
  position: absolute; bottom: 76px;
  width: 370px; height: 560px; max-height: calc(100vh - 110px);
}
.aicb-floating.aicb-pos-right .aicb-panel { right: 0; }
.aicb-floating.aicb-pos-left .aicb-panel { left: 0; }

/* ショートコードで埋め込んだ場合 */
.aicb-inline .aicb-panel { width: 100%; max-width: 720px; height: 600px; margin: 0 auto; }

.aicb-panel {
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  border: 1px solid #e5e7eb;
}
.aicb-panel[hidden] { display: none; }

.aicb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--aicb-color); color: #fff;
}
.aicb-title { font-weight: 700; }
.aicb-header-actions { display: flex; gap: 4px; }
.aicb-icon-btn {
  background: transparent; border: 0; color: #fff; cursor: pointer;
  font-size: 20px; line-height: 1; width: 32px; height: 32px; border-radius: 8px;
}
.aicb-icon-btn:hover { background: rgba(255,255,255,.18); }

.aicb-log { flex: 1; overflow-y: auto; padding: 14px; background: #f8fafc; }
.aicb-msg { display: flex; margin-bottom: 10px; }
.aicb-user { justify-content: flex-end; }
.aicb-bubble {
  max-width: 85%; padding: 9px 13px; border-radius: 14px;
  word-break: break-word; overflow-wrap: anywhere;
}
.aicb-assistant .aicb-bubble, .aicb-error .aicb-bubble { background: #fff; border: 1px solid #e5e7eb; border-top-left-radius: 4px; }
.aicb-user .aicb-bubble { background: var(--aicb-color); color: #fff; border-top-right-radius: 4px; }
.aicb-error .aicb-bubble { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }
.aicb-bubble a { color: var(--aicb-color); text-decoration: underline; }
.aicb-user .aicb-bubble a { color: #fff; }

.aicb-sources { margin-top: 8px; padding-top: 6px; border-top: 1px dashed #e5e7eb; font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 10px; color: #6b7280; }

.aicb-typing .aicb-bubble span {
  display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%;
  background: #9ca3af; animation: aicb-dot 1.2s infinite ease-in-out;
}
.aicb-typing .aicb-bubble span:nth-child(2) { animation-delay: .15s; }
.aicb-typing .aicb-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes aicb-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.aicb-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; background: #f8fafc; }
.aicb-suggestions:not(:empty) { padding-bottom: 10px; }
.aicb-chip {
  border: 1px solid var(--aicb-color); color: var(--aicb-color); background: #fff;
  border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer;
}
.aicb-chip:hover { background: var(--aicb-color); color: #fff; }

.aicb-profile { margin: 4px 0 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.aicb-profile-q { width: 100%; font-size: 13px; color: #4b5563; }
.aicb-profile-note { font-size: 12px; color: #6b7280; }
.aicb-link-btn { background: none; border: 0; padding: 0; color: var(--aicb-color); font-size: 12px; text-decoration: underline; cursor: pointer; }

.aicb-feedback { margin-top: 8px; display: flex; align-items: center; gap: 4px; font-size: 12px; color: #6b7280; }
.aicb-feedback-label { margin-right: 4px; }
.aicb-fb-btn { border: 1px solid #e5e7eb; background: #fff; border-radius: 999px; padding: 1px 8px; cursor: pointer; font-size: 13px; line-height: 1.6; }
.aicb-fb-btn[aria-pressed="true"] { border-color: var(--aicb-color); background: #eef2ff; }

.aicb-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e5e7eb; background: #fff; }
.aicb-input {
  flex: 1; resize: none; border: 1px solid #d1d5db; border-radius: 10px;
  padding: 8px 10px; font: inherit; max-height: 120px; margin: 0;
}
.aicb-input:focus { outline: 2px solid var(--aicb-color); outline-offset: -1px; border-color: transparent; }
.aicb-send {
  border: 0; border-radius: 10px; padding: 0 16px; cursor: pointer;
  background: var(--aicb-color); color: #fff; font-weight: 700; font-size: 14px;
}
.aicb-send:disabled, .aicb-input:disabled { opacity: .6; cursor: default; }

.aicb-disclaimer { font-size: 11px; color: #9ca3af; text-align: center; padding: 0 10px 8px; background: #fff; }

@media (max-width: 480px) {
  .aicb-floating.aicb-open { inset: 0; }
  .aicb-floating.aicb-open .aicb-launcher { display: none; }
  .aicb-floating .aicb-panel { position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; }
}
