#vd-support-chat {
  --chat-purple: #5520b5;
  --chat-ink: #24203a;
  --chat-line: #e8ddf9;
  position: fixed;
  z-index: 1085;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  color: var(--chat-ink);
  font: 14px/1.5 system-ui, sans-serif;
}

#vd-support-chat [hidden] { display: none !important; }
#vd-support-chat button, #vd-support-chat input { font: inherit; }
#vd-support-chat button:focus-visible, #vd-support-chat a:focus-visible, #vd-support-chat input:focus-visible {
  outline: 3px solid #ad80ff;
  outline-offset: 2px;
}

.vd-chat-launch {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-left: auto;
  padding: .8rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(115deg, #4d168d, #9a176d);
  box-shadow: 0 8px 30px #32145c45;
  color: #fff;
  font-weight: 700 !important;
}

#vd-chat-panel {
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 2rem));
  height: min(625px, calc(100dvh - 2rem));
  overflow: hidden;
  border: 1px solid var(--chat-line);
  border-radius: 1.3rem;
  background: #fff;
  box-shadow: 0 18px 60px #25113e4d;
}

.vd-chat-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  color: #fff;
  background: linear-gradient(110deg, #2c115e, #6a1a9d);
}

.vd-chat-head > i {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .75rem;
  background: #ffffff23;
}

.vd-chat-head strong { font-size: 1rem; }
.vd-chat-head small { display: block; color: #eddefd; }

#vd-support-chat .vd-chat-close {
  margin-left: auto;
  padding: .25rem .5rem;
  border: 0;
  border-radius: .5rem;
  background: transparent;
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
}

.vd-chat-log {
  flex: 1;
  min-height: 3rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .85rem;
  background: #f8f5ff;
}

.vd-chat-message {
  width: fit-content;
  max-width: 94%;
  margin-bottom: .65rem;
  padding: .55rem .75rem;
  border: 1px solid var(--chat-line);
  border-radius: .85rem .85rem .85rem .25rem;
  background: #fff;
  overflow-wrap: anywhere;
}

.vd-chat-message small { display: block; margin-bottom: .2rem; color: #554668; font-weight: 700; }
.vd-chat-message p { margin: 0; white-space: pre-wrap; }
.vd-chat-visitor { margin-left: auto; background: #ece2ff; border-radius: .85rem .85rem .25rem .85rem; }

.vd-chat-topics, .vd-chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.vd-chat-topics { padding: .55rem .65rem 0; }
.vd-chat-links { margin-top: .5rem; }
#vd-support-chat .vd-chat-topics button, .vd-chat-links a, #vd-support-chat .vd-chat-back {
  padding: .35rem .55rem;
  border: 1px solid var(--chat-line);
  border-radius: .6rem;
  background: #faf7ff;
  color: #472086;
  font-size: .8rem;
  font-weight: 650;
  text-decoration: none;
}

.vd-chat-ask, .vd-chat-verify { margin: 0; padding: .65rem; }
.vd-chat-ask, .vd-chat-verify > div { display: flex; gap: .45rem; }
.vd-chat-verify { overflow-y: auto; }
.vd-chat-verify p { margin: 0 0 .35rem; font-size: .85rem; }
.vd-chat-verify label { display: block; margin-bottom: .35rem; font-size: .8rem; font-weight: 650; }

#vd-support-chat input {
  display: block;
  min-width: 0;
  width: 100%;
  padding: .45rem .55rem;
  border: 1px solid #d8cce9;
  border-radius: .55rem;
  color: var(--chat-ink);
  background: #fff;
}

#vd-support-chat .vd-chat-primary {
  padding: .45rem .75rem;
  border: 0;
  border-radius: .55rem;
  color: #fff;
  background: var(--chat-purple);
  font-weight: 650;
}

#vd-support-chat button:disabled { opacity: .65; cursor: wait; }
.vd-chat-note { margin: 0 .65rem .55rem; color: #554668; font-size: .73rem; text-align: center; }
.vd-chat-note a { color: #472086; }

@media (max-width: 767.98px) {
  #vd-support-chat { bottom: calc(4.6rem + env(safe-area-inset-bottom)); }
  #vd-chat-panel { height: min(625px, calc(100dvh - 5.6rem - env(safe-area-inset-bottom))); }
  #vd-support-chat input { font-size: 16px; }
}
