/* Vetrifai chat assistant */
.vc-launch {
  position: fixed; right: 22px; bottom: 22px; z-index: 50;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px 12px 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: #1a1f36; color: #fff; font: 600 15px/1 "Inter", system-ui, sans-serif;
  box-shadow: 0 14px 34px -10px rgba(26,31,54,.55);
  transition: transform .2s ease, box-shadow .2s ease;
}
.vc-launch:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -10px rgba(26,31,54,.6); }
.vc-launch:focus-visible, .vc-panel button:focus-visible, .vc-panel textarea:focus-visible { outline: 2px solid #635bff; outline-offset: 2px; }
.vc-launch .vc-dot { width: 34px; height: 34px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.vc-launch .vc-dot .chiti { width: 30px; }
.vc-launch[aria-expanded="true"] { display: none; }

.vc-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 51;
  width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100vh - 44px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 20px; color: #1a1f36;
  font: 15px/1.5 "Inter", system-ui, sans-serif;
  box-shadow: 0 30px 80px -20px rgba(26,31,54,.45), 0 0 0 1px rgba(26,31,54,.06);
  transform-origin: bottom right; animation: vc-in .22s ease;
}
.vc-panel[hidden] { display: none; }
@keyframes vc-in { from { transform: translateY(12px) scale(.97); } to { transform: none; } }

.vc-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 18px; background: #1a1f36; color: #fff; }
.vc-head .vc-dot { width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.vc-head .vc-dot .chiti { width: 32px; }
.vc-title { font-weight: 600; font-size: 15px; }
.vc-sub { font-size: 12.5px; color: rgba(255,255,255,.65); }
.vc-close { margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.vc-close:hover { background: rgba(255,255,255,.2); }

.vc-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; background: #f6f9fc; }
.vc-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; white-space: normal; overflow-wrap: anywhere; }
.vc-msg p { margin: 0 0 8px; } .vc-msg p:last-child { margin: 0; }
.vc-msg ul { margin: 4px 0 8px; padding-left: 18px; } .vc-msg li { margin: 2px 0; }
.vc-msg a { color: #4b45d6; text-decoration: underline; }
.vc-row { align-self: flex-start; display: flex; align-items: flex-end; gap: 8px; max-width: 92%; }
.vc-row .vc-msg { max-width: none; }
.vc-av { width: 30px; height: 30px; flex: none; border-radius: 50%; background: #fff; border: 1px solid #e6e9f0; display: grid; place-items: center; }
.vc-av .chiti { width: 22px; }
.vc-bot { align-self: flex-start; background: #fff; border: 1px solid #e6e9f0; border-bottom-left-radius: 6px; }
.vc-user { align-self: flex-end; background: #635bff; color: #fff; border-bottom-right-radius: 6px; }
.vc-user a { color: #fff; }

.vc-typing { display: inline-flex; align-items: center; gap: 6px; padding: 14px 16px; background: #fff; border: 1px solid #e6e9f0; border-radius: 16px; border-bottom-left-radius: 6px; }
.vc-typing i { width: 8px; height: 8px; border-radius: 50%; animation: vc-bounce 1.15s cubic-bezier(.45,0,.25,1) infinite; }
.vc-typing i:nth-child(1) { background: #f6a23a; }
.vc-typing i:nth-child(2) { background: #ff3d8b; animation-delay: .14s; }
.vc-typing i:nth-child(3) { background: #4a14f2; animation-delay: .28s; }
@keyframes vc-bounce { 0%, 60%, 100% { transform: translateY(0) scale(1); opacity: .45; } 30% { transform: translateY(-6px) scale(1.3); opacity: 1; } }

/* Chiti: the logo mark, brought to life with light. A comet of light runs along the line and blooms at the dot. */
.chiti { display: block; height: auto; overflow: visible; transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.chiti .c-body { fill: none; stroke-width: 30; stroke-miterlimit: 10; }
.chiti .c-head, .chiti .c-tail { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.chiti .c-head { stroke-width: 22; stroke-dasharray: .09 2; stroke-dashoffset: .09; filter: drop-shadow(0 0 6px rgba(255,255,255,.9)); }
.chiti .c-tail { stroke-width: 32; stroke-dasharray: .22 2; stroke-dashoffset: .22; }
.chiti .c-dot { fill: none; stroke: #ff3d8b; stroke-width: 14; }
.chiti .c-glow { fill: none; stroke: #ff3d8b; stroke-width: 12; stroke-opacity: 0; }

/* The comet: head and tail travel together along the logo, then fade as the dot blooms */
@keyframes c-head-run { 0% { stroke-dashoffset: .09; opacity: 0; } 5% { opacity: 1; } 72% { stroke-dashoffset: -.91; opacity: 1; } 80%, 100% { stroke-dashoffset: -.91; opacity: 0; } }
@keyframes c-tail-run { 0% { stroke-dashoffset: .22; opacity: 0; } 7% { opacity: .55; } 72% { stroke-dashoffset: -.78; opacity: .55; } 80%, 100% { stroke-dashoffset: -.78; opacity: 0; } }
@keyframes c-bloom { 0%, 70% { r: 19px; stroke-opacity: 0; } 73% { stroke-opacity: .85; } 100% { r: 54px; stroke-opacity: 0; } }
@keyframes c-bloom2 { 0%, 76% { r: 19px; stroke-opacity: 0; } 79% { stroke-opacity: .5; } 100% { r: 42px; stroke-opacity: 0; } }
@keyframes c-dot-pulse { 0%, 70%, 100% { r: 19px; } 76% { r: 27px; } 88% { r: 18px; } }

/* idle (header, beside replies): a soft double heartbeat on the dot */
.chiti.idle .c-glow1 { animation: c-beat 4.5s ease-out infinite; }
.chiti.idle .c-glow2 { animation: c-beat 4.5s ease-out .18s infinite; }
@keyframes c-beat { 0%, 72% { r: 19px; stroke-opacity: 0; } 74% { stroke-opacity: .5; } 100% { r: 46px; stroke-opacity: 0; } }

/* button: every few seconds a comet runs the logo and blooms at the dot */
.chiti.redraw .c-tail { opacity: 0; }
.chiti.redraw .c-head { animation: c-head-run 4s cubic-bezier(.45,0,.25,1) infinite; }
.chiti.redraw .c-tail { animation: c-tail-run 4s cubic-bezier(.45,0,.25,1) infinite; }
.chiti.redraw .c-glow1 { animation: c-bloom 4s ease-out infinite; }
.chiti.redraw .c-glow2 { animation: c-bloom2 4s ease-out infinite; }
.chiti.redraw .c-dot { animation: c-dot-pulse 4s ease-out infinite; }
.vc-launch:hover .chiti { transform: scale(1.1); }

/* thinking: the logo dims, comets run continuously and the dot blooms every lap; the whole mark breathes */
.chiti.think { animation: c-breathe 1.15s ease-in-out infinite; }
.chiti.think .c-body { opacity: .2; }
.chiti.think .c-head { stroke-width: 30; filter: drop-shadow(0 0 5px rgba(176,34,242,.55)); animation: c-head-run 1.15s cubic-bezier(.45,0,.25,1) infinite; }
.chiti.think .c-tail { stroke-width: 34; animation: c-tail-run-strong 1.15s cubic-bezier(.45,0,.25,1) infinite; }
@keyframes c-tail-run-strong { 0% { stroke-dashoffset: .22; opacity: 0; } 7% { opacity: .5; } 72% { stroke-dashoffset: -.78; opacity: .5; } 80%, 100% { stroke-dashoffset: -.78; opacity: 0; } }
.chiti.think .c-glow1 { animation: c-bloom 1.15s ease-out infinite; }
.chiti.think .c-glow2 { animation: c-bloom2 1.15s ease-out infinite; }
.chiti.think .c-dot { animation: c-dot-pulse 1.15s ease-out infinite; }
@keyframes c-breathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-1.5px) scale(1.04); } }

/* a reply lands: the mark pops and the dot flashes once */
.chiti.arrive { animation: c-pop .55s cubic-bezier(.34,1.56,.64,1); }
.chiti.arrive .c-glow1 { animation: c-flash .9s ease-out; }
.chiti.arrive .c-glow2 { animation: c-flash .9s ease-out .12s; }
@keyframes c-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes c-flash { 0% { r: 19px; stroke-opacity: .8; } 100% { r: 54px; stroke-opacity: 0; } }
.vc-msg.vc-new { animation: vc-pop-in .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes vc-pop-in { 0% { opacity: 0; transform: translateY(10px) scale(.96); } 100% { opacity: 1; transform: none; } }

.vc-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 12px; background: #f6f9fc; }
.vc-chips[hidden] { display: none; }
.vc-chip { border: 1px solid #d9dcf5; background: #fff; color: #4b45d6; border-radius: 999px; padding: 7px 12px; font: 500 13.5px "Inter", system-ui, sans-serif; cursor: pointer; }
.vc-chip:hover { background: #f0efff; }

.vc-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid #e6e9f0; background: #fff; }
.vc-form textarea {
  flex: 1; min-width: 0; resize: none; max-height: 120px; border: 1px solid #dfe3eb; border-radius: 14px;
  padding: 10px 12px; font: 15px/1.4 "Inter", system-ui, sans-serif; color: #1a1f36; background: #fff;
}
.vc-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: #635bff; color: #fff; cursor: pointer; display: grid; place-items: center; }
.vc-send:disabled { opacity: .45; cursor: default; }
.vc-send svg { width: 18px; height: 18px; }
.vc-note { padding: 0 14px 10px; font-size: 11.5px; color: #8792a2; text-align: center; background: #fff; }
.vc-note a { color: #6b7c93; text-decoration: underline; }

@media (max-width: 560px) {
  .vc-launch { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .vc-launch .vc-label { display: none; }
  .vc-launch { padding: 10px; }
  .vc-panel { inset: 0; width: auto; height: auto; border-radius: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
}
@media (prefers-reduced-motion: reduce) {
  .vc-panel, .vc-typing i, .chiti, .chiti .c-head, .chiti .c-tail, .chiti .c-glow, .chiti .c-dot, .vc-msg { animation: none !important; }
  .vc-launch { transition: none; }
}
