:root {
  --df-ink: #17333d;
  --df-muted: #647784;
  --df-line: #d7e8ec;
  --df-panel: #ffffff;
  --df-soft: #eef8fa;
  --df-brand: #2f9cb5;
  --df-brand-dark: #1a6d86;
  --df-brand-deep: #145568;
  --df-warm: #f09b5a;
  --df-warm-deep: #d87132;
  --df-focus: #d97706;
}

.df-chat {
  bottom: 24px;
  color: var(--df-ink);
  font-family: inherit;
  position: fixed;
  right: 24px;
  z-index: 99999;
}

.df-chat-inline {
  bottom: auto;
  position: relative;
  right: auto;
  z-index: 1;
}

.df-toggle {
  align-items: center;
  background-color: transparent;
  background-image: var(--df-card-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  border: 0;
  border-radius: 24px;
  box-shadow: none;
  color: var(--df-ink);
  cursor: pointer;
  display: flex;
  line-height: 1.1;
  aspect-ratio: 900 / 578;
  min-height: 0;
  overflow: visible;
  padding: 7.2% 40% 10% 8.4%;
  position: relative;
  text-align: left;
  transform: translateZ(0);
  transition: filter 0.2s ease, transform 0.2s ease;
  width: min(315px, calc(100vw - 32px));
}

.df-toggle:hover {
  filter: drop-shadow(0 20px 28px rgba(23, 51, 61, 0.2));
  transform: translateY(-2px);
}

.df-toggle::after {
  background:
    radial-gradient(circle at 70% 34%, rgba(232, 248, 251, 0.92), rgba(232, 248, 251, 0.55) 54%, rgba(232, 248, 251, 0) 72%),
    linear-gradient(135deg, rgba(250, 254, 255, 0.88), rgba(230, 248, 252, 0.78));
  border-radius: 24px;
  content: "";
  inset: 8% 5% 12% 56%;
  pointer-events: none;
  position: absolute;
  z-index: 0;
}

.df-toggle-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
  position: relative;
  z-index: 2;
}

.df-toggle-lighthouse {
  bottom: 18px;
  display: block;
  filter: drop-shadow(0 18px 20px rgba(16, 70, 86, 0.26));
  pointer-events: none;
  position: absolute;
  right: -8px;
  transform: translateZ(0);
  width: 150px;
  z-index: 1;
}

.df-toggle-lighthouse::before {
  animation: df-lighthouse-sweep 3.2s linear infinite;
  background:
    linear-gradient(90deg, rgba(255, 244, 188, 0.92), rgba(255, 228, 137, 0.46) 46%, rgba(255, 228, 137, 0));
  clip-path: polygon(0 44%, 100% 0, 100% 100%, 0 56%);
  content: "";
  filter: blur(0.7px);
  height: 58px;
  left: 47%;
  opacity: 0;
  position: absolute;
  top: 8%;
  transform: rotate(-4deg) scaleX(0.72);
  transform-origin: left center;
  width: 188px;
  will-change: opacity, transform;
  z-index: 0;
}

.df-toggle-lighthouse::after {
  animation: df-lighthouse-glow 3s ease-in-out infinite;
  background: radial-gradient(circle, rgba(255, 234, 157, 0.78), rgba(255, 234, 157, 0) 64%);
  content: "";
  height: 54px;
  left: 37%;
  opacity: 0.45;
  position: absolute;
  top: 4%;
  width: 54px;
  z-index: 0;
}

.df-toggle-lighthouse img {
  display: block;
  height: auto;
  max-width: none;
  position: relative;
  width: 100%;
  z-index: 1;
}

.df-mobile-icon {
  display: none;
}

.df-toggle-title {
  color: var(--df-brand-deep);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.df-toggle-subtitle {
  color: var(--df-warm-deep);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.df-toggle-note {
  color: var(--df-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.28;
}

.df-panel {
  background: var(--df-panel);
  border: 1px solid var(--df-line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(23, 51, 61, 0.24);
  display: none;
  flex-direction: column;
  height: min(680px, calc(100vh - 44px));
  max-height: 680px;
  overflow: hidden;
  width: min(410px, calc(100vw - 28px));
}

.df-chat.is-open .df-panel,
.df-chat-inline .df-panel {
  animation: df-panel-in 0.24s cubic-bezier(0.2, 0.78, 0.28, 1);
  display: flex;
}

.df-chat.is-open .df-toggle,
.df-chat-inline .df-toggle {
  display: none;
}

.df-header {
  align-items: center;
  background:
    radial-gradient(circle at 100% 0%, rgba(244, 198, 108, 0.28), transparent 34%),
    linear-gradient(135deg, var(--df-brand-deep), var(--df-brand-dark) 54%, var(--df-brand));
  color: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 14px 0 16px;
}

.df-title-wrap {
  align-items: center;
  display: flex;
  gap: 10px;
}

.df-header-icon {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 14px;
  box-sizing: border-box;
  display: block;
  height: 46px;
  object-fit: contain;
  padding: 3px;
  width: 46px;
}

.df-title {
  font-size: 16px;
  font-weight: 800;
}

.df-subtitle {
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 700;
  margin-top: 3px;
}

.df-close {
  align-items: center;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 28px;
  height: 40px;
  justify-content: center;
  line-height: 1;
  width: 40px;
}

.df-messages {
  background: linear-gradient(180deg, #f7fcfd 0%, #ffffff 56%, #f8fbfc 100%);
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px 15px;
}

.df-message {
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 86%;
  padding: 11px 13px;
  white-space: normal;
  word-break: break-word;
}

.df-message a {
  color: var(--df-brand-deep);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.df-message-user a {
  color: #fff;
}

.df-message-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(215, 232, 236, 0.9);
  box-shadow: 0 10px 26px rgba(23, 51, 61, 0.07);
}

.df-message-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--df-brand-dark), var(--df-brand));
  box-shadow: 0 10px 24px rgba(47, 156, 181, 0.2);
  color: #fff;
}

.df-typing {
  color: var(--df-muted);
}

.df-consent {
  background: #fff7ef;
  border-top: 1px solid #f3d0b1;
  color: #4f3a1b;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
}

.df-consent.is-hidden {
  display: none;
}

.df-consent p {
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.df-consent a {
  color: var(--df-warm-deep);
  font-size: 12px;
}

.df-consent-button,
.df-send {
  background: linear-gradient(135deg, #145568 0%, #188aa5 52%, #2fb4cf 100%);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(20, 85, 104, 0.22);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  min-height: 44px;
  padding: 0 18px;
}

.df-consent-button:hover,
.df-send:hover {
  background: linear-gradient(135deg, #104657 0%, #147893 52%, #239fbd 100%);
}

.df-form {
  align-items: stretch;
  background: #fff;
  border-top: 1px solid var(--df-line);
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  padding: 12px;
}

.df-input {
  border: 1px solid var(--df-line);
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--df-ink);
  font: inherit;
  font-size: 14px;
  max-height: 110px;
  min-height: 42px;
  padding: 9px 10px;
  resize: vertical;
  width: 100%;
}

.df-input:focus,
.df-send:focus,
.df-toggle:focus,
.df-close:focus,
.df-consent-button:focus,
.df-actions a:focus {
  outline: 2px solid var(--df-focus);
  outline-offset: 2px;
}

.df-send:disabled,
.df-input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.df-actions {
  background: #fff;
  border-top: 1px solid var(--df-line);
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
}

.df-actions a {
  align-items: center;
  background: linear-gradient(135deg, #ffffff, #f3fbfc);
  border: 1px solid rgba(47, 156, 181, 0.24);
  border-radius: 6px;
  color: var(--df-brand-deep);
  display: inline-flex;
  flex: 1 1 0;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
  min-height: 38px;
  text-decoration: none;
}

.df-actions.is-emphasized a {
  border-color: #f2b84b;
  color: #9a4e18;
}

@media (max-width: 520px) {
  .df-chat {
    bottom: max(92px, env(safe-area-inset-bottom));
    right: 12px;
  }

  .df-panel {
    height: min(640px, calc(100vh - 24px));
    width: calc(100vw - 24px);
  }

  .df-toggle {
    align-items: center;
    aspect-ratio: 246 / 72;
    background-color: transparent;
    background-image: var(--df-mobile-card-image);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border: 0;
    border-radius: 18px;
    box-shadow: none;
    display: flex;
    min-height: 0;
    padding: 12px 106px 13px 18px;
    width: min(246px, calc(100vw - 24px));
  }

  .df-toggle::after {
    border-radius: 18px;
    inset: 9% 5% 14% 58%;
  }

  .df-toggle-lighthouse {
    bottom: -6px;
    right: -10px;
    width: 96px;
  }

  .df-toggle-lighthouse::before {
    height: 38px;
    left: 46%;
    top: 7%;
    width: 120px;
  }

  .df-toggle-lighthouse::after {
    height: 38px;
    left: 36%;
    top: 2%;
    width: 38px;
  }

  .df-mobile-icon {
    display: none;
  }

  .df-mobile-icon img {
    display: block;
    filter: drop-shadow(0 8px 10px rgba(23, 51, 61, 0.14));
    height: 72px;
    max-width: none;
    object-fit: contain;
    width: auto;
  }

  .df-toggle-title {
    font-size: 15px;
  }

  .df-toggle-subtitle {
    font-size: 10px;
  }

  .df-toggle-note {
    display: none;
  }

  .df-form {
    grid-template-columns: 1fr;
  }
}

@keyframes df-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes df-lighthouse-sweep {
  0%, 68%, 100% {
    opacity: 0;
    transform: rotate(-6deg) translateY(-1px) scaleX(0.72);
  }

  8% {
    opacity: 0.82;
    transform: rotate(6deg) translateY(2px) scaleX(1);
  }

  18% {
    opacity: 0.78;
    transform: rotate(26deg) translateY(4px) scaleX(1);
  }

  30% {
    opacity: 0.66;
    transform: rotate(62deg) translateY(8px) scaleX(0.98);
  }

  43% {
    opacity: 0.52;
    transform: rotate(108deg) translateY(10px) scaleX(0.95);
  }

  56% {
    opacity: 0.28;
    transform: rotate(150deg) translateY(8px) scaleX(0.92);
  }

  63% {
    opacity: 0;
    transform: rotate(178deg) translateY(4px) scaleX(0.86);
  }
}

@keyframes df-lighthouse-glow {
  0%, 58%, 100% {
    opacity: 0.3;
    transform: scale(0.86);
  }

  14% {
    opacity: 0.9;
    transform: scale(1.08);
  }

  28% {
    opacity: 0.48;
    transform: scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .df-chat.is-open .df-panel,
  .df-toggle-lighthouse::before,
  .df-toggle-lighthouse::after {
    animation: none;
  }

  .df-toggle {
    transition: none;
  }
}
