.ben {
  --ben-gold: #f7c600;
  --ben-ink: #071c35;
  --ben-muted: #4b5563;
  --ben-soft: #6b7280;
  --ben-bg: #f4f6f8;
  position: fixed;
  right: 1.15rem;
  bottom: 5.5rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--ben-ink);
  font-family: inherit;
  line-height: 1.45;
}
.ben-launch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.ben-launch[hidden] { display: none; }
.ben .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.ben-tag {
  position: relative;
  background: var(--ben-ink);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.28rem 0.65rem 0.32rem;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(7, 28, 53, 0.28);
}
.ben-tag::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: var(--ben-ink);
  transform: translateX(-50%) rotate(45deg);
}
.ben-fab {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ben-gold);
  box-shadow: 0 12px 28px rgba(7, 28, 53, 0.28);
  cursor: pointer;
  overflow: hidden;
}
.ben-fab img {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-fit: contain;
  object-position: center;
  transform-origin: center;
  animation: ben-wave 2.8s ease-in-out infinite;
}
.ben-fab:hover { filter: brightness(1.04); }
.ben-dock {
  display: flex;
  align-items: flex-end;
  gap: 0.15rem;
}
.ben-dock[hidden] { display: none; }
.ben-mascot {
  width: 180px;
  height: 268px;
  max-width: 180px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 12px 16px rgba(7, 28, 53, 0.28));
  flex-shrink: 0;
}
.ben-mascot.is-in { animation: ben-pop 0.35s ease; }
.ben-panel {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 11rem));
  height: min(520px, calc(100vh - 8rem));
  background: #fff;
  color: var(--ben-ink);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(7, 28, 53, 0.35);
  overflow: hidden;
  overscroll-behavior: contain;
}
.ben-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.8rem;
  background: var(--ben-gold);
  color: var(--ben-ink);
}
.ben-avatar {
  width: 46px;
  height: 46px;
  max-width: none;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 12%;
  background: #fff;
  flex-shrink: 0;
}
.ben-head strong { display: block; font-size: 0.98rem; }
.ben-head span { display: block; font-size: 0.75rem; color: var(--ben-muted); }
.ben-x {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ben-ink);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}
.ben-log {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.9rem;
  background: var(--ben-bg);
}
.ben-msg {
  max-width: 88%;
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 16px;
  font-size: 0.92rem;
}
.ben-msg-bot { align-self: flex-start; background: #fff; color: var(--ben-ink); border: 1px solid #e5e7eb; }
.ben-msg-user { align-self: flex-end; background: var(--ben-ink); color: #fff; }
.ben-thinking {
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
  min-height: 2.4rem;
}
.ben-thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ben-soft);
  animation: ben-dot 1s infinite ease-in-out;
}
.ben-thinking span:nth-child(2) { animation-delay: 0.15s; }
.ben-thinking span:nth-child(3) { animation-delay: 0.3s; }
.ben-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.75rem;
  border-top: 1px solid #eee;
  background: #fff;
}
.ben-choice {
  border: 1.5px solid #e5e7eb;
  background: #fff;
  color: var(--ben-ink);
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  text-align: left;
}
.ben-choice:hover { border-color: var(--ben-ink); background: #fff8dc; }
@keyframes ben-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-3px); opacity: 1; }
}
@keyframes ben-pop {
  from { transform: translateY(8px) scale(0.96); }
  to { transform: none; }
}
@keyframes ben-wave {
  0%, 100% { transform: rotate(0deg); }
  40% { transform: rotate(-4deg); }
  60% { transform: rotate(3deg); }
}
@media (max-width: 720px) {
  .ben { right: 0.75rem; bottom: 5rem; left: 0.75rem; align-items: flex-end; }
  .ben-dock {
    align-self: stretch;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  .ben-mascot {
    display: block;
    width: 140px;
    height: 186px;
    max-width: 140px;
  }
  .ben-avatar { display: none; }
  .ben-panel {
    width: 100%;
    height: min(54vh, calc(100dvh - 320px));
  }
}
@media (prefers-reduced-motion: reduce) {
  .ben-fab img, .ben-thinking span { animation: none; }
  .ben-mascot.is-in { animation: none; }
}
