/* 图示同款对话布局：左侧完整智体，右侧对话线程，底部固定输入。四流光由原 canvas 负责。 */
.bean-chat-panel {
  grid-template-rows: minmax(0, 1fr) 34px;
  background: #000;
}

.bean-chat-header { display: none; }

.bean-chat-log {
  min-height: 0;
  padding: 8px 8px 0;
  overflow: hidden;
  background: #000;
}

.bean-chat-agent-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(96px, 24%, 146px) minmax(0, 1fr);
  gap: 7px;
}

.bean-chat-agent-stage {
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 2px 0 5px;
  overflow: visible;
  background: #000;
}

.bean-chat-agent-art {
  width: 122%;
  max-width: none;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 0 8px rgba(87, 229, 255, .16));
  transform: scale(1.1);
  transform-origin: center bottom;
}

.bean-chat-agent-card { display: none; }

.bean-chat-agent-main {
  min-width: 0;
  min-height: 0;
  padding: 0 5px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 235, 255, .38) transparent;
}

/* 内容不足一屏时吸收顶部余量，使最后一条回复紧贴输入区；超出时仍正常滚动。 */
.bean-chat-agent-main::before {
  content: "";
  flex: 0 0 auto;
  margin-top: auto;
}

/* 移动端与应用中心需要从可视区顶部开始阅读，不保留桌面官网的顶部弹性占位。 */
.bean-chat-overlay.is-mobile .bean-chat-agent-main::before,
.bean-chat-overlay.is-app-center .bean-chat-agent-main::before {
  content: none;
}

.bean-chat-agent-main::-webkit-scrollbar { width: 4px; }
.bean-chat-agent-main::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(100, 235, 255, .38); }

.bean-chat-intro-message,
.bean-chat-message-card,
.bean-chat-match {
  border-radius: 10px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(103, 232, 255, .16);
}

.bean-chat-intro-message { padding: 7px 9px; }
.bean-chat-intro-message p,
.bean-chat-message-card p {
  margin: 0;
  color: #f4f6f8;
  font-size: 8.9px;
  font-weight: 620;
  line-height: 1.45;
  text-wrap: pretty;
}

.bean-chat-conversion {
  position: relative;
  isolation: isolate;
  min-height: 88px;
  margin: 0;
  padding: 6px 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: stretch;
  gap: 6px;
  overflow: hidden;
  border-radius: 12px;
  color: #fff;
  background: #000;
}

.bean-chat-conversion > .dual-flow-canvas {
  position: absolute;
  z-index: 5;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.bean-chat-conversion-links {
  min-width: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.bean-chat-conversion-link {
  position: relative;
  min-width: 0;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 180ms ease, filter 180ms ease, transform 180ms ease;
}

.bean-chat-conversion-link + .bean-chat-conversion-link {
  border-top: 1px solid rgba(115, 231, 247, .14);
}

.bean-chat-conversion-link span,
.bean-chat-conversion-link strong,
.bean-chat-conversion-link small {
  min-width: 0;
  display: block;
}

.bean-chat-conversion-link > span:first-child {
  flex: 0 1 auto;
}

.bean-chat-conversion-link strong {
  overflow: hidden;
  color: #fff;
  font-size: 9.3px;
  line-height: 1.25;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bean-chat-conversion-link small {
  margin-top: 2px;
  color: #9eb4c0;
  font-size: 7.2px;
  line-height: 1.2;
}

.bean-chat-link-hand {
  position: relative;
  right: auto;
  top: auto;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: inherit;
  font-style: normal;
  text-decoration: none;
  transform: rotate(-34deg);
  transform-origin: 50% 50%;
}

.bean-chat-link-hand span {
  position: relative;
  z-index: 2;
  display: block;
  font-size: 19px;
  line-height: 1;
  transform: translateY(3px) scale(1);
  transform-origin: 50% 12%;
  animation: bean-chat-link-tap 1.55s cubic-bezier(.22, 1, .36, 1) infinite;
}

.bean-chat-link-hand u {
  position: absolute;
  z-index: 1;
  left: 49%;
  top: 4px;
  width: 9px;
  height: 9px;
  border: 1px solid #6cf3ff;
  border-radius: 50%;
  text-decoration: none;
  transform: translate(-50%, -50%) scale(.4);
  opacity: 0;
  animation: bean-chat-link-ripple 1.55s ease-out infinite;
}

.bean-chat-conversion-link.is-center .bean-chat-link-hand span,
.bean-chat-conversion-link.is-center .bean-chat-link-hand u { animation-delay: .72s; }
.bean-chat-conversion-link.is-center .bean-chat-link-hand u { border-color: #ffd36e; }

.bean-chat-conversion-link:hover,
.bean-chat-conversion-link:focus-visible {
  background: rgba(75, 229, 255, .08);
  filter: brightness(1.16);
  transform: translateX(1px);
}

.bean-chat-conversion-link:focus-visible {
  outline: 1px solid #68efff;
  outline-offset: -1px;
}

.bean-chat-conversion-link:active {
  transform: translateX(2px) scale(.99);
}

.bean-chat-conversion-qr {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding-left: 6px;
  border-left: 1px solid rgba(195, 104, 255, .28);
}

.bean-chat-conversion-qr img {
  width: 52px;
  height: 52px;
  padding: 2px;
  object-fit: contain;
  border-radius: 7px;
  background: #fff;
}

.bean-chat-conversion-qr b { color: #fff; font-size: 7.5px; line-height: 1; }
.bean-chat-conversion-qr small { color: #9eeef8; font-size: 6.8px; line-height: 1; }

.bean-chat-qr-hand {
  position: absolute;
  z-index: 6;
  right: -1px;
  bottom: 0;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  pointer-events: none;
  transform: rotate(-34deg);
  transform-origin: 50% 50%;
}

.bean-chat-qr-hand span {
  position: relative;
  z-index: 2;
  display: block;
  font-size: 16px;
  line-height: 1;
  transform: translateY(2px) scale(1);
  transform-origin: 50% 12%;
  animation: bean-chat-link-tap 1.55s cubic-bezier(.22, 1, .36, 1) .36s infinite;
}

.bean-chat-qr-hand u {
  position: absolute;
  z-index: 1;
  left: 49%;
  top: 3px;
  width: 8px;
  height: 8px;
  border: 1px solid #6cf3ff;
  border-radius: 50%;
  text-decoration: none;
  transform: translate(-50%, -50%) scale(.4);
  opacity: 0;
  animation: bean-chat-link-ripple 1.55s ease-out .36s infinite;
}

.bean-chat-row {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 1px 0 0;
}

.bean-chat-row.is-user { justify-content: flex-end; }

.bean-chat-row-avatar { display: none; }

.bean-chat-bubble {
  max-width: 82%;
  padding: 6px 8px;
  border-radius: 8px;
  color: #fff;
  background: #000;
  font-size: 8.9px;
  font-weight: 690;
  line-height: 1.45;
  box-shadow: inset 0 0 0 1px rgba(94, 229, 255, .22);
}

.bean-chat-row.is-user .bean-chat-bubble {
  border-radius: 8px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(69, 222, 255, .78);
}

.bean-chat-structured-response {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bean-chat-history-example {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 1px;
}

.bean-chat-message-card { padding: 7px 8px; }

.bean-chat-match {
  padding: 2px 4px 3px;
  border-radius: 0;
  box-shadow: none;
}
.bean-chat-match-intro {
  margin: 0 0 5px;
  color: #e8eef1;
  font-size: 8.7px;
  line-height: 1.4;
}
.bean-chat-module-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.bean-chat-module {
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  background: #000;
  box-shadow: none;
  transition: filter 160ms ease;
}

.bean-chat-module:hover,
.bean-chat-module:focus-visible { filter: brightness(1.18); }
.bean-chat-module:focus-visible { outline: 2px solid #69eaff; outline-offset: 1px; }
.bean-chat-module-visual {
  position: relative;
  isolation: isolate;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: #000;
  box-shadow: none;
}
.bean-chat-module-visual > .dual-flow-canvas {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.bean-chat-module-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bean-chat-module > b {
  display: block;
  overflow: hidden;
  max-width: 100%;
  color: #f7fbff;
  font-size: 8.7px;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes bean-chat-link-tap {
  0%, 34%, 100% { transform: translateY(3px) scale(1); }
  46% { transform: translateY(-1px) scale(.93); }
  58% { transform: translateY(2px) scale(1.03); }
}

@keyframes bean-chat-link-ripple {
  0%, 40%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(.35); }
  48% { opacity: .9; }
  72% { opacity: 0; transform: translate(-50%, -50%) scale(1.9); }
}

.bean-chat-actions {
  padding: 0 8px 4px;
  border-top: 0;
  background: #000;
}

.bean-chat-form {
  height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 5px;
}

.bean-chat-input {
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(78, 225, 255, .72);
  font-size: 9.2px;
}

.bean-chat-input::placeholder { color: #aeb9bf; opacity: 1; }

.bean-chat-send {
  border-radius: 9px;
  color: #041117;
  background: #77edff;
  font-size: 9.8px;
  font-weight: 780;
}

.bean-chat-overlay.is-mobile .bean-chat-panel { grid-template-rows: minmax(0, 1fr) 33px; }
.bean-chat-overlay.is-mobile .bean-chat-log { min-height: 0; padding: 6px 5px 4px; overflow: hidden; }
.bean-chat-overlay.is-mobile .bean-chat-agent-layout {
  height: 100%;
  display: grid;
  grid-template-columns: 24% minmax(0, 1fr);
  gap: 5px;
}
.bean-chat-overlay.is-mobile .bean-chat-agent-stage { display: flex; padding: 2px 0 5px; }
.bean-chat-overlay.is-mobile .bean-chat-agent-art { width: 124%; height: 100%; }
.bean-chat-overlay.is-mobile .bean-chat-agent-main { padding: 0 3px 0 0; gap: 5px; }
.bean-chat-overlay.is-mobile .bean-chat-intro-message { padding: 6px 7px; }
.bean-chat-overlay.is-mobile .bean-chat-intro-message p,
.bean-chat-overlay.is-mobile .bean-chat-message-card p { font-size: 7.8px; line-height: 1.4; }
.bean-chat-overlay.is-mobile .bean-chat-conversion {
  min-height: 80px;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 5px;
  padding: 5px;
}
.bean-chat-overlay.is-mobile .bean-chat-conversion-link { padding: 4px 5px; gap: 11px; }
.bean-chat-overlay.is-mobile .bean-chat-conversion-link strong { font-size: 8px; }
.bean-chat-overlay.is-mobile .bean-chat-conversion-link small { font-size: 6.5px; }
.bean-chat-overlay.is-mobile .bean-chat-link-hand { right: auto; width: 22px; height: 22px; display: grid; }
.bean-chat-overlay.is-mobile .bean-chat-link-hand span { font-size: 16px; }
.bean-chat-overlay.is-mobile .bean-chat-conversion-qr { padding-left: 6px; }
.bean-chat-overlay.is-mobile .bean-chat-conversion-qr img { width: 46px; height: 46px; }
.bean-chat-overlay.is-mobile .bean-chat-qr-hand { right: -2px; bottom: -1px; width: 18px; height: 18px; }
.bean-chat-overlay.is-mobile .bean-chat-qr-hand span { font-size: 14px; }
.bean-chat-overlay.is-mobile .bean-chat-message-card { padding: 6px; }
.bean-chat-overlay.is-mobile .bean-chat-match { padding: 2px 3px; }
.bean-chat-overlay.is-mobile .bean-chat-match-intro { font-size: 7.7px; }
.bean-chat-overlay.is-mobile .bean-chat-module-grid { grid-template-columns: repeat(2, 40px); gap: 4px; }
.bean-chat-overlay.is-mobile .bean-chat-module { min-height: 0; padding: 0; gap: 3px; }
.bean-chat-overlay.is-mobile .bean-chat-module-visual { width: 40px; height: 40px; border-radius: 5px; }
.bean-chat-overlay.is-mobile .bean-chat-module-visual img { width: 100%; height: 100%; }
.bean-chat-overlay.is-mobile .bean-chat-module > b { font-size: 7.7px; }
.bean-chat-overlay.is-mobile .bean-chat-actions { padding: 0 6px 3px; }
.bean-chat-overlay.is-mobile .bean-chat-form { height: 30px; grid-template-columns: minmax(0, 1fr) 50px; gap: 4px; }
.bean-chat-overlay.is-mobile .bean-chat-input { height: 30px; font-size: 8px; }
.bean-chat-overlay.is-mobile .bean-chat-send { font-size: 8.8px; }

/* 真实手机页沿用参考移动端设备画布内的 60% 对话框占比。 */
body[data-bean-mobile="true"] .bean-chat-overlay.is-mobile { height: 60%; }

@media (max-width: 390px) {
  .bean-chat-overlay.is-mobile .bean-chat-agent-layout { grid-template-columns: 23% minmax(0, 1fr); }
  .bean-chat-overlay.is-mobile .bean-chat-module-grid { grid-template-columns: repeat(2, 38px); gap: 3px; }
  .bean-chat-overlay.is-mobile .bean-chat-module-visual { width: 38px; height: 38px; }
  .bean-chat-overlay.is-mobile .bean-chat-module-visual img { width: 100%; height: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .bean-chat-module,
  .bean-chat-conversion-link { transition: none; }
  .bean-chat-link-hand span,
  .bean-chat-link-hand u,
  .bean-chat-qr-hand span,
  .bean-chat-qr-hand u { animation: none; }
}
