.yks-ai-service,
.yks-ai-service * {
  box-sizing: border-box;
}

.yks-ai-service {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9500;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #0f172a;
}

.yks-ai-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.28);
  cursor: pointer;
}

.yks-ai-launcher__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 0 7px rgba(52, 211, 153, 0.18);
}

.yks-ai-panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  width: min(420px, calc(100vw - 32px));
  max-height: min(680px, calc(100svh - 110px));
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto auto auto;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.12), transparent 36%),
    linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 180ms ease, transform 180ms ease;
}

.yks-ai-service.is-open .yks-ai-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.yks-ai-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.76);
}

.yks-ai-panel__header strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
}

.yks-ai-panel__header span {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.yks-ai-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.yks-ai-messages {
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
}

.yks-ai-message {
  display: flex;
  margin-bottom: 12px;
}

.yks-ai-message--user {
  justify-content: flex-end;
}

.yks-ai-message__bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 16px;
  background: #eef6ff;
  color: #334155;
  font-size: 14px;
  line-height: 1.68;
}

.yks-ai-message--user .yks-ai-message__bubble {
  border-bottom-right-radius: 6px;
  background: #1d4ed8;
  color: #fff;
}

.yks-ai-message--assistant .yks-ai-message__bubble {
  border-bottom-left-radius: 6px;
  background: #f1f5f9;
}

.yks-ai-message--thinking .yks-ai-message__bubble {
  color: #64748b;
}

.yks-ai-message__bubble p {
  margin: 0;
}

.yks-ai-message__bubble p + p {
  margin-top: 7px;
}

.yks-ai-cta {
  margin: 0 0 14px;
  padding: 13px;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background: rgba(239, 246, 255, 0.72);
}

.yks-ai-cta strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
}

.yks-ai-cta p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.yks-ai-cta__actions,
.yks-ai-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.yks-ai-cta__actions {
  margin-top: 10px;
}

.yks-ai-secondary,
.yks-ai-link,
.yks-ai-quick button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #fff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.yks-ai-link {
  background: #1d4ed8;
  color: #fff !important;
}

.yks-ai-quick {
  padding: 0 16px 12px;
}

.yks-ai-ask,
.yks-ai-lead {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.82);
}

.yks-ai-ask {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.yks-ai-ask input,
.yks-ai-lead input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  padding: 0 12px;
  color: #0f172a;
  font: inherit;
  outline: none;
}

.yks-ai-ask input:focus,
.yks-ai-lead input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.yks-ai-ask button,
.yks-ai-lead button {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  padding: 0 14px;
  background: #1d4ed8;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.yks-ai-lead[hidden] {
  display: none;
}

.yks-ai-lead__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.yks-ai-lead input[name="website"] {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.yks-ai-lead > input[name="company"],
.yks-ai-lead > button {
  margin-top: 8px;
}

.yks-ai-lead__status {
  min-height: 18px;
  margin: 8px 0 0;
  color: #64748b;
  font-size: 12px;
}

.yks-ai-lead__status[data-state="success"] {
  color: #047857;
}

.yks-ai-lead__status[data-state="error"] {
  color: #b91c1c;
}

@media (max-width: 768px) {
  .yks-ai-service {
    right: 14px;
    bottom: 14px;
  }

  .yks-ai-panel {
    right: -2px;
    bottom: 64px;
    width: calc(100vw - 24px);
    max-height: calc(100svh - 92px);
    border-radius: 20px;
  }

  .yks-ai-launcher {
    min-height: 48px;
    padding: 0 15px;
    font-size: 15px;
  }

  .yks-ai-lead__grid,
  .yks-ai-ask {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yks-ai-panel {
    transition: none !important;
  }
}
