/**
 * AIブタチェの会話・待機表示
 * 初回案内、検索中の吹き出し、会話履歴とリセット操作を担当する
 */

.km-recommendationPage .butache-waiting-area {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
}

.km-recommendationPage .butache-waiting-area:has(.butache-bubble[data-message-type="beta-intro"]) {
  margin-bottom: 8px;
}

.km-recommendationPage .butache-avatar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.km-recommendationPage .butache-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  line-height: 1;
}

.km-recommendationPage .butache-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.km-recommendationPage .butache-bubble {
  min-height: 18px;
  width: min(560px, 80%);
  padding: 10px 16px;
  border-radius: 999px;
  border: 0;
  background: var(--km-butache-pink);
  color: #726a64;
  font-size: calc(0.92rem + var(--km-butache-font-increase));
  box-shadow: none;
}

.km-recommendationPage .butache-bubble[data-state="thinking"] {
  opacity: 0.95;
}

.km-recommendationPage .butache-bubble[data-state="thinking"]::after {
  margin-left: 4px;
}

.km-recommendationPage .butache-bubble[data-message-type="beta-intro"] {
  border-radius: 18px;
  line-height: 1.65;
  white-space: pre-line;
}

/* サマリーは80〜120文字あるので折り返す。丸みの強い形は1行前提。 */
.km-recommendationPage .butache-bubble[data-message-type="summary"] {
  border-radius: 18px;
  line-height: 1.65;
}

.km-recommendationPage .pork-alert {
  margin-top: 10px;
  min-height: 20px;
  color: #7b6f68;
  font-size: calc(0.86rem + var(--km-butache-font-increase));
}

.km-recommendationPage .pork-alert:empty {
  display: none;
}

.km-recommendationPage .pork-alert.active::before {
  animation: none;
}

.km-recommendationPage .conversation-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.km-recommendationPage .conversation-toolbar[hidden] {
  display: none;
}

.km-recommendationPage .conversation-toolbar__title {
  margin: 0;
  color: #7d6b67;
  font-size: calc(0.78rem + var(--km-butache-font-increase));
  font-weight: 700;
}

.km-recommendationPage .conversation-toolbar__resetBtn {
  border: 1px solid #ead4d8;
  border-radius: 999px;
  background: #fff;
  color: #8c7470;
  font-size: calc(0.72rem + var(--km-butache-font-increase));
  font-weight: 700;
  line-height: 1;
  padding: 7px 12px;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.km-recommendationPage .conversation-toolbar__resetBtn:hover {
  background: #fdf7f8;
  border-color: #dfc0c6;
}

.km-recommendationPage .conversation-container {
  margin-bottom: 14px;
}

.km-recommendationPage .conversation-container[hidden] {
  display: none;
}

.km-recommendationPage .conversation-history {
  border: 1px solid #efe3e6;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
}

.km-recommendationPage .conversation-history-label {
  margin-bottom: 6px;
  color: #9f7a79;
  font-size: calc(0.73rem + var(--km-butache-font-increase));
  font-weight: 700;
}

.km-recommendationPage .conversation-history__details > summary {
  color: #8f746f;
  cursor: pointer;
  font-size: calc(0.8rem + var(--km-butache-font-increase));
  font-weight: 800;
  list-style-position: inside;
}

.km-recommendationPage .conversation-history__body {
  margin-top: 10px;
  border-top: 1px solid #f1e7e8;
  padding-top: 10px;
}

.km-recommendationPage .conversation-history__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.km-recommendationPage .conversation-message {
  margin-top: 8px;
}

.km-recommendationPage .conversation-message:first-of-type {
  margin-top: 0;
}

.km-recommendationPage .conversation-message-content {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #6a5d56;
  font-size: calc(0.82rem + var(--km-butache-font-increase));
  line-height: 1.55;
}

.km-recommendationPage .conversation-message-text {
  flex: 1;
}

.km-recommendationPage .conversation-message-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
}

.km-recommendationPage .conversation-message-count {
  color: #9d8b84;
  font-size: calc(0.7rem + var(--km-butache-font-increase));
  font-weight: 700;
  line-height: 1.4;
}

.km-recommendationPage .conversation-message.user {
  display: flex;
  justify-content: flex-start;
}

.km-recommendationPage .conversation-message.user .conversation-message-content {
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  max-width: none;
  padding: 6px 8px;
  border-radius: 8px;
  background: #fff3f4;
}

.km-recommendationPage .conversation-message.user .conversation-message-text {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.km-recommendationPage .conversation-message.user .conversation-message-main {
  min-width: 0;
  flex-direction: row;
  gap: 8px;
  align-items: flex-start;
}

.km-recommendationPage .conversation-message.user .conversation-message-count {
  flex: 0 0 auto;
  white-space: nowrap;
}

.km-recommendationPage .conversation-message-action {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: inherit;
  cursor: pointer;
}

.km-recommendationPage .conversation-message.user .conversation-message-action {
  width: 100%;
}

.km-recommendationPage .conversation-message.is-clickable .conversation-message-content {
  border-radius: 8px;
  padding: 3px 6px;
  transition: background-color 0.2s ease;
}

.km-recommendationPage .conversation-message.is-clickable .conversation-message-action:hover .conversation-message-content,
.km-recommendationPage .conversation-message.is-clickable .conversation-message-action:focus-visible .conversation-message-content {
  background: #f9eef1;
}

.km-recommendationPage .conversation-message.is-active .conversation-message-content {
  background: #f4e4e9;
}

@media (max-width: 768px) {
  .km-recommendationPage .butache-bubble {
    width: 100%;
  }

}
