.dfcv {
  --dfcv-brand: #2472b5;
  --dfcv-brand-dark: #15568f;
  --dfcv-ink: #142b41;
  --dfcv-muted: #405970;
  --dfcv-line: #d7e3ed;
  --dfcv-soft: #edf5fb;
  --dfcv-signal: #9ed3ff;
  --dfcv-trigger-diameter: 44px;
  position: absolute;
  top: calc(50% - var(--dfcv-trigger-diameter) / 2);
  left: calc(var(--dfcv-header-x, 45%) - var(--dfcv-trigger-diameter) / 2);
  width: var(--dfcv-trigger-diameter);
  height: var(--dfcv-trigger-diameter);
  z-index: 5;
}

.dfcv-symbols { position: absolute; pointer-events: none; }
#top .dfcv [hidden] { display: none !important; }

#top .dfcv .dfcv-orb-control {
  display: grid;
  flex: none;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
}

.dfcv-trigger { width: var(--dfcv-trigger-diameter); }
.dfcv-trigger-tip {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  translate: -50% 0;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--dfcv-brand-dark);
  color: #fff;
  font: 700 11px/1.25 system-ui, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.dfcv-trigger:is(:hover, :focus-visible) .dfcv-trigger-tip { opacity: 1; }
.dfcv-avatar { width: 144px; }

#top .dfcv :where(button, a, input, [tabindex]):focus-visible {
  outline: 2px solid var(--dfcv-brand-dark);
  outline-offset: 3px;
}

#top .dfcv .dfcv-trigger:focus-visible { outline-offset: -6px; }

.dfcv-orb {
  display: block;
  width: calc(100% - 12px);
  height: auto;
  overflow: visible;
  fill: none;
  stroke: var(--dfcv-brand);
}

.dfcv-orb-disc { fill: #081d33; stroke-width: 2.5; }
.dfcv-orb-rim { stroke-width: 2; opacity: .8; }
.dfcv-orb-shell, .dfcv-glyph-wave { opacity: .98; }
.dfcv-orb-sectors { opacity: .9; }
.dfcv-orb-pointers, .dfcv-orb-satellites { fill: var(--dfcv-brand); stroke: none; }
.dfcv-orb-satellites { opacity: 0; }
.dfcv-orb-receive { display: none; stroke-width: 2; }

.dfcv-orb :is(.dfcv-orb-shell, .dfcv-orb-sectors, .dfcv-orb-satellites, .dfcv-orb-receive, .dfcv-glyph-clock) {
  transform-origin: 72px 72px;
}

.dfcv-orb-shell { animation: dfcv-orbit 24s linear infinite; }
.dfcv-orb-sectors { animation: dfcv-orbit 18s linear infinite reverse; }
.dfcv-glyph-play { fill: var(--dfcv-signal); stroke: none; }
.dfcv-glyph-clock { display: none; stroke: var(--dfcv-signal); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.dfcv-glyph-wave { display: none; }
.dfcv-glyph-wave path {
  fill: none;
  stroke: var(--dfcv-brand);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dfcv-orb-dot { fill: var(--dfcv-brand); stroke: none; opacity: .68; }
.dfcv-trigger .dfcv-orb-dot,
.dfcv:is([data-state="thinking"], [data-state="transcribing"]) .dfcv-orb-dot { display: none; }
.dfcv:is([data-state="listening"], [data-state="speaking"]) .dfcv-trigger .dfcv-orb-dot { display: block; }

.dfcv[data-state="listening"] .dfcv-orb-receive,
.dfcv:is([data-state="thinking"], [data-state="transcribing"]) .dfcv-glyph-clock,
.dfcv[data-state="speaking"] .dfcv-glyph-wave { display: block; }

.dfcv:is([data-state="listening"], [data-state="thinking"], [data-state="transcribing"], [data-state="speaking"]) .dfcv-glyph-play { display: none; }

.dfcv[data-state="listening"] .dfcv-orb-receive { animation: dfcv-receive 1.7s ease-out infinite; }
.dfcv[data-state="listening"] .dfcv-orb-dot { animation: dfcv-dot-listen 1.7s ease-in-out .18s infinite; }
.dfcv[data-state="listening"] .dfcv-orb-shell { animation-duration: 10s; }
.dfcv[data-state="listening"] .dfcv-orb-sectors { animation-duration: 7s; }
.dfcv:is([data-state="thinking"], [data-state="transcribing"]) .dfcv-orb-shell { animation-duration: 4.2s; }
.dfcv:is([data-state="thinking"], [data-state="transcribing"]) .dfcv-orb-sectors { animation-duration: 2.6s; }
.dfcv:is([data-state="thinking"], [data-state="transcribing"]) .dfcv-orb-satellites { opacity: 1; animation: dfcv-orbit 1.8s linear infinite; }
.dfcv:is([data-state="thinking"], [data-state="transcribing"]) .dfcv-glyph-clock { scale: 1.17; animation: dfcv-hourglass-turn 3s ease-in-out infinite; }
.dfcv[data-state="speaking"] .dfcv-orb-shell { animation-duration: 3.6s; }
.dfcv[data-state="speaking"] .dfcv-orb-sectors { animation-duration: 2.8s; }
.dfcv[data-state="speaking"] .dfcv-orb {
  transform: scale(calc(1 + var(--dfcv-beat, 0) * .055));
  transition: transform 140ms ease-out;
}

.dfcv-sand-top, .dfcv-sand-bottom { fill: var(--dfcv-signal); stroke: none; }
.dfcv-sand-top { transform-origin: 72px 71px; animation: dfcv-hourglass-empty 3s linear infinite; }
.dfcv-sand-bottom { transform-origin: 72px 84px; animation: dfcv-hourglass-fill 3s linear infinite; }
.dfcv-sand-stream { stroke-width: 1.5; stroke-dasharray: 1.3 1.4; animation: dfcv-hourglass-stream .35s linear infinite; }

@keyframes dfcv-orbit { to { transform: rotate(360deg); } }
@keyframes dfcv-receive {
  from { transform: scale(.85); opacity: .9; }
  to { transform: scale(1.6); opacity: 0; }
}
@keyframes dfcv-dot-listen {
  0%, 64%, 100% { opacity: .68; }
  22% { opacity: 1; }
}
@keyframes dfcv-hourglass-turn { 0%, 80% { transform: rotate(0); } to { transform: rotate(180deg); } }
@keyframes dfcv-hourglass-empty { from { transform: scaleY(1); } 80%, to { transform: scaleY(.08); } }
@keyframes dfcv-hourglass-fill { from { transform: scaleY(.08); } 80%, to { transform: scaleY(1); } }
@keyframes dfcv-hourglass-stream { to { stroke-dashoffset: -2.7; } }

#top .dfcv-dialog {
  position: fixed;
  inset: 0;
  width: min(560px, calc(100vw - 28px));
  max-width: none;
  height: min(570px, calc(100vh - 36px));
  height: min(570px, calc(100dvh - 36px));
  max-height: none;
  padding: 0;
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--dfcv-line);
  border-radius: 21px;
  background: #fff;
  color: var(--dfcv-ink);
  box-shadow: 0 22px 80px #071b3257;
  font: 15px/1.45 system-ui, sans-serif;
  box-sizing: border-box;
}

#top .dfcv-dialog[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

#top .dfcv-dialog::backdrop { background: #0a1c32a1; }
#top .dfcv-dialog *, #top .dfcv-dialog *::before, #top .dfcv-dialog *::after { box-sizing: border-box; }

.dfcv-heading {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 15px 55px 14px;
  border-bottom: 1px solid var(--dfcv-line);
  background: radial-gradient(ellipse at 50% 27%, #dcecf9, #f7fbff 67%);
}

#top .dfcv-heading .dfcv-state {
  margin: 0;
  color: var(--dfcv-muted);
  text-align: center;
  font: 13px/1.35 system-ui, sans-serif;
}

#top .dfcv :is(.dfcv-close, .dfcv-send, .dfcv-mic) {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--dfcv-line);
  border-radius: 10px;
  background: #fff;
  color: var(--dfcv-ink);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

#top .dfcv .dfcv-close { position: absolute; top: 9px; right: 9px; }
#top .dfcv .dfcv-close:hover { background: var(--dfcv-soft); }
#top .dfcv :is(.dfcv-close, .dfcv-send) svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#top .dfcv .dfcv-mic { color: var(--dfcv-brand-dark); border-color: #b4c8d9; }
#top .dfcv .dfcv-mic:hover { background: var(--dfcv-soft); }
#top .dfcv .dfcv-mic[aria-pressed="true"] { color: #fff; background: var(--dfcv-brand-dark); border-color: var(--dfcv-brand-dark); }
#top .dfcv .dfcv-mic svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 4.5; stroke-linecap: round; }

.dfcv-messages {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 20px;
  scrollbar-color: #87a8c2 transparent;
}

#top .dfcv-messages .dfcv-message {
  width: fit-content;
  max-width: min(94%, 55ch);
  margin: 0 0 12px;
  padding: 10px 13px;
  border: 1px solid var(--dfcv-line);
  border-radius: 12px;
  background: #f7fafc;
  color: var(--dfcv-ink);
  overflow-wrap: anywhere;
}

#top .dfcv-messages [data-dfcv-role="user"] {
  max-width: 88%;
  margin-inline-start: auto;
  border-color: #c0d7ed;
  background: var(--dfcv-soft);
}

#top .dfcv-messages .dfcv-message p { margin: 0 0 6px; }
#top .dfcv-messages .dfcv-message p:last-child { margin-bottom: 0; }
.dfcv-message-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
#top .dfcv-messages :is(a, .dfcv-followup) { color: var(--dfcv-brand-dark); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
#top .dfcv-messages .dfcv-followup {
  appearance: none;
  min-height: 24px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
}
#top .dfcv-messages .dfcv-whatsapp {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 6px;
  padding: 7px 12px;
  border: 1px solid #b8d7ca;
  border-radius: 9px;
  color: #185d42;
  background: #eaf5ef;
}

.dfcv-actions {
  padding: 13px 20px 18px;
  border-top: 1px solid var(--dfcv-line);
  background: #f9fbfd;
}

.dfcv-quick, #top .dfcv-form { display: flex; flex-wrap: wrap; gap: 7px; }
#top .dfcv-form { margin: 9px 0 0; flex-wrap: nowrap; align-items: center; }

#top .dfcv :is(.dfcv-quick button, .dfcv-stop) {
  min-height: 36px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--dfcv-line);
  border-radius: 19px;
  color: var(--dfcv-brand-dark);
  background: #fff;
  font: 650 12px/1.2 system-ui, sans-serif;
  text-transform: none;
  cursor: pointer;
  touch-action: manipulation;
}

#top .dfcv .dfcv-quick button:hover, #top .dfcv .dfcv-stop:hover { border-color: #a9c8e2; background: var(--dfcv-soft); }
#top .dfcv .dfcv-stop { min-height: 44px; padding-inline: 10px; border-radius: 10px; }
#top .dfcv .dfcv-send { border-color: var(--dfcv-brand); background: var(--dfcv-brand); color: #fff; }
#top .dfcv .dfcv-send:hover { border-color: var(--dfcv-brand-dark); background: var(--dfcv-brand-dark); }
#top .dfcv :is(.dfcv-send, .dfcv-mic, .dfcv-quick button):disabled { opacity: .55; cursor: default; }

#top .dfcv-form input[data-dfcv="input"] {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 44px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #b4c8d9;
  border-radius: 10px;
  color: var(--dfcv-ink);
  background: #fff;
  box-shadow: none;
  font: 16px/1.25 system-ui, sans-serif;
}

#top .dfcv .dfcv-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 767px) {
  .dfcv { left: calc(var(--dfcv-header-x, 56%) - var(--dfcv-trigger-diameter) / 2); }
  #top .dfcv-dialog {
    width: min(560px, calc(100vw - 16px));
    height: min(570px, calc(100vh - 16px));
    height: min(570px, calc(100dvh - 16px));
    border-radius: 16px;
  }
  .dfcv-heading { padding-top: 12px; padding-bottom: 11px; }
  .dfcv-avatar { width: 120px; }
  .dfcv-messages { padding: 13px; }
  .dfcv-actions { padding: 10px 13px 13px; }
}

@media (max-width: 470px) {
  #top .dfcv-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
  #top .dfcv .dfcv-stop { grid-column: 1 / -1; justify-self: end; min-height: 36px; }
}

@media (max-height: 450px) {
  .dfcv-heading { gap: 4px; padding-top: 6px; padding-bottom: 6px; }
  .dfcv-avatar { width: 104px; }
  .dfcv-quick { display: none; }
  .dfcv-actions { padding: 9px 12px; }
  #top .dfcv-form { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dfcv[data-state="speaking"] .dfcv-orb { transform: none; }
  .dfcv *, .dfcv *::before, .dfcv *::after { animation: none !important; transition: none !important; }
}
