/* ===== ページ全体 ===== */
.page__content--item {
  max-width: 860px;
  padding: 230px 12px 120px;
  margin: 0 auto;
}

/* ===== 上部バー ===== */
.item-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: rgba(245, 245, 245, 0.96);
  border-bottom: 1px solid #e3e3e3;
  backdrop-filter: blur(8px);
}

.item-topbar__inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}


.item-topbar__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e7e7e7;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.item-topbar__back::before {
  content: "‹";
  font-weight: 600;
  display: inline-block;
  transform: translateY(-2px);
}


.item-topbar__brand {
  display: inline-flex;
  align-items: center;
}

.item-topbar__logo {
  display: block;
  width: 56px;
  height: auto;
}

.rakuten-credit--header {
  position: absolute;
  right: 10px;
  bottom: 4px;
  font-size: 12px;
  color: #888;
}

.rakuten-credit--header a {
  color: #888;
  text-decoration: none;
}

.rakuten-credit--header a:hover {
  text-decoration: underline;
}

/* ===== 固定商品カード ===== */
.item-fixed-top {
  position: fixed;
  top: 58px;
  left: 0;
  right: 0;
  z-index: 35;
  pointer-events: none;
}

.item-fixed-top .product-card {
  max-width: 860px;
  margin: 0 auto;
  pointer-events: auto;
}

.product-card {
  background: #ffffff;
  border: 1px solid #ececec;
  border-left: none;
  border-right: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin: 0 12px;
}

.product-card__main {
  display: flex;
  gap: 12px;
  padding: 12px;
  align-items: flex-start;
}

.product-card__image-wrap {
  flex: 0 0 88px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card__image,
.product-card__image-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 1px solid #eeeeee;
  background: #f7f7f7;
}

.product-card__image {
  object-fit: contain;
  object-position: center;
}

.product-card__image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9a9a9a;
  font-size: 12px;
}

.product-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding-top: 1px;
}

.product-card__name {
  margin: 0 0 2px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  color: #222222;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__price-row {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.product-card__price {
  margin: 0;
  color: #bf0000;
  font-size: 18px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.product-card__subactions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-card__hint {
  font-size: 11px;
  color: #8a8f99;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card__actions {
  display: flex;
  gap: 10px;
  padding: 0 12px 12px;
}

.product-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.product-action--amazon {
  background: #f2f2f2;
  color: #222222;
  border: 1px solid #e4e4e4;
}


.product-card__rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #666666;
}

.rating-stars {
  position: relative;
  display: inline-block;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 1px;
}

.rating-stars__base {
  color: #dddddd;
}

.rating-stars__fill {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  overflow: hidden;
  color: #f39800;
  width: calc(var(--rating) / 5 * 100%);
}

.rating-score {
  font-size: 12px;
  color: #666666;
}

/* ===== チャット ===== */
.chat-section {
  padding-top: 0;
}

.limit-notice {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f3f4f6;
  border: 1px solid #e4e6ea;
}

.limit-notice__icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #d9dde5;
  color: #4a5565;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.limit-notice__title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: #222222;
}

.limit-notice__text {
  margin: 0;
  font-size: 13px;
  color: #666666;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-messages {
  min-height: 260px;
  padding: 2px 2px 2px;
  overflow: visible;
  max-height: none;
}

.chat-row {
  display: flex;
  margin-bottom: 22px;
}

.chat-row--user {
  justify-content: flex-end;
}

.chat-row--assistant {
  align-items: flex-start;
}


.chat-bubble {
  font-size: 15px;
  line-height: 1.9;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-bubble--user {
  width: fit-content;
  max-width: min(78%, 720px);
  padding: 14px 18px;
  border-radius: 24px;
  background: #e9edf3;
  color: #222222;
}

.chat-bubble--assistant {
  max-width: min(90%, 720px);
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  color: #222222;
  letter-spacing: 0.01em;
  line-height: 2;
}

.chat-bubble--assistant a {
  color: #0a66c2;
  text-decoration: underline;
}

.chat-bubble--assistant br + br {
  display: block;
  content: "";
  margin-top: 8px;
}



.chat-row--loading {
  margin-bottom: 0;
}

.chat-bubble--loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #8d95a3;
  animation: loading-bounce 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}


@keyframes loading-bounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== 初回画面 ===== */
.chat-welcome {
  padding: 16px 8px 8px;
}


.chat-welcome__title {
  margin: 0 0 30px;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #222222;
}

.faq-chips {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.faq-chip {
  width: fit-content;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  line-height: 1.6;
  color: #333333;
  transition: background 0.15s ease, border 0.15s ease;
}

.faq-chip:hover {
  background: #e9edf3;
}

.faq-chip:active {
  background: #e9edf3;
}

.faq-chip:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ===== 入力欄（常時固定） ===== */
.chat-input--fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: linear-gradient(to top, #f5f5f5 72%, rgba(245, 245, 245, 0));
  padding: 8px 12px 12px;
}

.chat-input__inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  /* align-items: flex-end; */
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 28px;
  background: #ffffff;
  border: 1px solid #e6e6e6;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.chat-input__textarea {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 160px;
  padding: 10px 15px;
  resize: none;
  overflow-y: auto;
  border: none;
  background: transparent;
  color: #222222;
  font-size: 16px;
  line-height: 1.5;
}



.chat-input__textarea::placeholder {
  color: #8a8f99;
  line-height: 22px;
}



.chat-input__textarea:focus {
  outline: none;
}

.chat-input__send {
  flex-shrink: 0;
  min-width: 72px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: #d60000;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.chat-input__send:disabled,
.chat-input__textarea:disabled {
  cursor: default;
}

.chat-input__send:disabled {
  background: #d7dbe2;
  color: #7a808a;
}

.chat-input__textarea:disabled {
  color: #7a808a;
}


#loadingBubble[hidden] {
  display: none !important;
}




/* ===== タブレット以上 ===== */
@media (min-width: 768px) {
  .page__content--item {
    padding: 260px 16px 128px;
  }

  .item-topbar__inner {
    padding: 12px 16px;
  }

  .item-topbar__logo {
    width: 68px;
  }

  .item-fixed-top {
    top: 63px;
  }

  .item-fixed-top .product-card {
    max-width: 860px;
  }

  .product-card {
    margin: 0 16px;
  }

  .product-card__main {
    gap: 14px;
    padding: 14px 16px;
  }

  .product-card__image-wrap {
    flex-basis: 96px;
    width: 96px;
    height: 96px;
  }

  .product-card__name {
    font-size: 16px;
  }

  .product-card__price {
    font-size: 22px;
  }

  .product-action {
    min-height: 32px;
    font-size: 12px;
  }

  .chat-welcome__title {
    font-size: 34px;
  }

  .chat-bubble {
    font-size: 16px;
  }

  .chat-input--fixed {
    padding: 10px 16px 16px;
  }

  .chat-input__inner {
    padding: 14px;
  }
}