/* AI float bar — expanded = workbench dock; collapsed = gradient pill */

.rd-ai-float {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10050;
  width: min(720px, calc(100vw - 32px));
  transform: translateX(-50%);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: bottom 0.2s ease, width 0.28s ease;
}
.rd-ai-float * {
  box-sizing: border-box;
}
.rd-ai-float.is-collapsed {
  bottom: 20px;
  width: min(640px, calc(100vw - 32px));
}
.rd-ai-float.is-collapsed .rd-ai-float__panel {
  display: none;
}
.rd-ai-float.is-collapsed .rd-ai-float__pill {
  display: flex;
}

/* ---- collapsed (fig.2): gradient border pill ---- */
.rd-ai-float__pill {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px 10px 20px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(90deg, #9fe8c8 0%, #ffe08a 48%, #c4b5fd 100%) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.1);
}
.rd-ai-float__pill:hover {
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.14);
}
.rd-ai-float__pill-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rd-ai-float__pill-text em {
  font-style: normal;
  font-weight: 600;
  color: #334155;
}
.rd-ai-float__pill-go {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #c7d7ea;
  color: #fff;
}
.rd-ai-float__pill-go svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* ---- expanded (fig.1): workbench-like compose card ---- */
.rd-ai-float__panel {
  width: 100%;
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: -10px 10px 40px rgba(0, 0, 0, 0.06), 0 8px 32px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(20px);
}
.rd-ai-float__compose {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.rd-ai-float.is-ppt .rd-ai-float__upload,
.rd-ai-float.is-ppt .rd-ai-float__refs,
.rd-ai-float.is-ppt .rd-ai-float__chip[data-role="model"],
.rd-ai-float.is-ppt .rd-ai-float__chip[data-role="size"] {
  display: none !important;
}
.rd-ai-float__refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  max-width: 140px;
}
.rd-ai-float__ref {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
}
.rd-ai-float__ref img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rd-ai-float__ref-x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  cursor: pointer;
  padding: 0;
}
.rd-ai-float__upload {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 64px;
  height: 64px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
}
.rd-ai-float__upload.is-hidden {
  display: none !important;
}
.rd-ai-float__upload.is-busy {
  opacity: 0.6;
  pointer-events: none;
}
.rd-ai-float__upload:hover {
  border-color: #94a3b8;
  color: #64748b;
}
.rd-ai-float__upload-plus {
  font-size: 20px;
  line-height: 1;
  font-weight: 300;
  color: #64748b;
}
.rd-ai-float__input {
  flex: 1;
  min-width: 0;
  min-height: 64px;
  max-height: 120px;
  padding: 4px 2px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.55;
  font-family: inherit;
}
.rd-ai-float__input::placeholder {
  color: #94a3b8;
}
.rd-ai-float__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  min-height: 44px;
}
.rd-ai-float__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.rd-ai-float__chip.is-active {
  border-color: #fda4af;
  background: #fff1f2;
  color: #be123c;
}
.rd-ai-float__chip-caret {
  color: #94a3b8;
  font-size: 10px;
}
.rd-ai-float__chip.is-static {
  cursor: default;
  color: #64748b;
}
.rd-ai-float__spacer {
  flex: 1;
  min-width: 8px;
}
.rd-ai-float__cost {
  color: #e11d48;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.rd-ai-float__submit {
  flex-shrink: 0;
  height: 36px;
  padding: 0 18px;
  border: none;
  border-radius: 8px;
  background: #e11d48;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.rd-ai-float__submit:hover {
  background: #be123c;
}
.rd-ai-float__submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.rd-ai-float__hint {
  margin-top: 8px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.4;
}
.rd-ai-float__hint.is-err {
  color: #e11d48;
}
.rd-ai-float__menu {
  position: absolute;
  z-index: 2;
  min-width: 160px;
  max-width: 280px;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}
.rd-ai-float__menu[hidden] {
  display: none !important;
}
.rd-ai-float__menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.rd-ai-float__menu-item:hover,
.rd-ai-float__menu-item.is-active {
  background: #f1f5f9;
}

/* recharge modal */
.rd-ai-rc-mask {
  position: fixed;
  inset: 0;
  z-index: 10100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}
.rd-ai-rc-mask[hidden] {
  display: none !important;
}
.rd-ai-rc-dialog {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px 24px 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.rd-ai-rc-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.rd-ai-rc-title {
  margin: 0 28px 4px 0;
  color: #0f172a;
  font-size: 20px;
  font-weight: 700;
}
.rd-ai-rc-sub {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}
.rd-ai-rc-feats-line {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff1f2;
  color: #9f1239;
  font-size: 12px;
  line-height: 1.5;
}
.rd-ai-rc-pkgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.rd-ai-rc-pkg {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 16px 8px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.rd-ai-rc-pkg.is-active {
  border-color: #38bdf8;
  background: #f0f9ff;
}
.rd-ai-rc-pkg-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  padding: 2px 8px;
  border-radius: 0 10px 0 8px;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
}
.rd-ai-rc-pkg-badge.is-rec {
  background: #e11d48;
}
.rd-ai-rc-pkg-amt {
  color: #0f172a;
  font-size: 18px;
  font-weight: 700;
}
.rd-ai-rc-pkg.is-active .rd-ai-rc-pkg-amt {
  color: #0284c7;
}
.rd-ai-rc-pkg-money {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}
.rd-ai-rc-pkg-tip {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 11px;
}
.rd-ai-rc-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}
.rd-ai-rc-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: 10px;
  background: #e11d48;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.rd-ai-rc-buy:hover:not(:disabled) {
  background: #be123c;
}
.rd-ai-rc-buy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.rd-ai-rc-buy[hidden] {
  display: none !important;
}
.rd-ai-rc-pay {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: center;
  margin-top: 12px;
}
.rd-ai-rc-pay[hidden] {
  display: none !important;
}
.rd-ai-rc-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 180px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.rd-ai-rc-qr img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  background: #fff;
}
.rd-ai-rc-qr-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  background: #e2e8f0;
  color: #94a3b8;
  font-size: 12px;
}
.rd-ai-rc-qr-label {
  color: #475569;
  font-size: 12px;
}
.rd-ai-rc-side {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}
.rd-ai-rc-tip {
  margin: 0;
  min-height: 60px;
  color: #475569;
  font-size: 13px;
  line-height: 1.55;
}
.rd-ai-rc-msg {
  margin-top: 12px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}
.rd-ai-rc-msg.is-err {
  color: #e11d48;
}
.rd-ai-rc-msg.is-ok {
  color: #059669;
}
.rd-ai-rc-terms {
  margin-top: 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}
.rd-ai-rc-terms a {
  color: #0284c7;
  text-decoration: none;
}

@media (max-width: 768px) {
  .rd-ai-float {
    display: none;
  }
}
