.apex-ask {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(23.5rem, calc(100vw - 1.5rem));
  font-family: var(--sans, "Instrument Sans", "Segoe UI", sans-serif);
  color: var(--text, #edf1f7);
}
.apex-ask-launch,
.apex-ask-panel {
  border: 1px solid var(--line, rgba(232, 237, 246, 0.12));
  background: #10141c;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}
.apex-ask-launch {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  color: var(--text, #edf1f7);
  background: linear-gradient(180deg, #171c28, #10141c);
  cursor: pointer;
}
.apex-ask-launch strong { font-weight: 650; font-size: 0.95rem; }
.apex-ask-mark {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #8eb4ff, #a99bff);
  color: #0c1020;
}
.apex-ask-panel {
  display: flex;
  flex-direction: column;
  height: min(34rem, calc(100dvh - 6.5rem));
  border-radius: 1.15rem;
  overflow: hidden;
}
.apex-ask.is-closed .apex-ask-panel { display: none; }
.apex-ask.is-open .apex-ask-launch { display: none; }
.apex-ask-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 0.8rem 0.7rem 1rem;
  border-bottom: 1px solid var(--line, rgba(232, 237, 246, 0.12));
}
.apex-ask-head p { margin: 0; }
.apex-ask-head strong { display: block; font-size: 0.95rem; }
.apex-ask-head span { color: var(--muted, #a8b3c5); font-size: 0.82rem; }
.apex-ask-tools { display: flex; gap: 0.25rem; }
.apex-ask-tools button {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text, #edf1f7);
  cursor: pointer;
}
.apex-ask-tools button:hover { background: rgba(255, 255, 255, 0.06); }
.apex-ask-log {
  flex: 1;
  overflow: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.apex-ask-msg {
  max-width: 92%;
  margin: 0;
  padding: 0.7rem 0.8rem;
  border-radius: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.apex-ask-msg a { color: var(--blue, #8eafff); }
.apex-ask-bot { align-self: flex-start; background: #171c28; }
.apex-ask-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(142, 180, 255, 0.22), rgba(169, 155, 255, 0.22));
}
.apex-ask-error { border: 1px solid rgba(255, 180, 180, 0.35); }
.apex-ask-suggestions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.apex-ask-suggestions button {
  text-align: left;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(232, 237, 246, 0.12));
  background: transparent;
  color: var(--text, #edf1f7);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
}
.apex-ask-suggestions button:hover { border-color: rgba(142, 175, 255, 0.55); }
.apex-ask-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.75rem;
  border-top: 1px solid var(--line, rgba(232, 237, 246, 0.12));
}
.apex-ask-form textarea {
  flex: 1;
  min-height: 2.7rem;
  max-height: 6.5rem;
  resize: none;
  border-radius: 0.8rem;
  border: 1px solid var(--line, rgba(232, 237, 246, 0.12));
  background: #0d1118;
  color: var(--text, #edf1f7);
  padding: 0.55rem 0.7rem;
}
.apex-ask-form button {
  align-self: end;
  min-height: 2.7rem;
  border: 0;
  border-radius: 999px;
  padding: 0 0.9rem;
  cursor: pointer;
  font-weight: 650;
  color: #0c1020;
  background: linear-gradient(135deg, #8eb4ff, #a99bff);
}
.apex-ask-form button:disabled { opacity: 0.65; cursor: progress; }
.apex-ask-typing { display: inline-flex; gap: 0.25rem; }
.apex-ask-typing i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--violet, #b3a6ff);
  animation: apex-ask-dot 1s infinite ease-in-out;
}
.apex-ask-typing i:nth-child(2) { animation-delay: 0.15s; }
.apex-ask-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes apex-ask-dot {
  50% { opacity: 0.3; transform: translateY(2px); }
}
@media (min-width: 900px) {
  .apex-ask.is-open { width: 24rem; }
}
@media (prefers-reduced-motion: reduce) {
  .apex-ask-typing i { animation: none; }
}
