#soz-chat-root {
  --soz-accent: #34d399;
  --soz-accent-soft: rgba(52, 211, 153, 0.2);
  --soz-accent-text: #6ee7b7;
  --soz-surface: rgba(9, 9, 11, 0.95);
  --soz-text: #e4e4e7;
  --soz-muted: #71717a;
  --soz-border: rgba(255, 255, 255, 0.08);
  --soz-offset: 16px;
  font-family: var(--font-geist-sans), system-ui, -apple-system, "Segoe UI",
    Roboto, sans-serif;
}

@media (min-width: 640px) {
  #soz-chat-root {
    --soz-offset: 24px;
  }
}

/* Кнопка */

#soz-chat-root .soz-fab {
  position: fixed;
  right: var(--soz-offset);
  bottom: 20px;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 9999px;
  background: rgba(9, 9, 11, 0.9);
  color: var(--soz-accent-text);
  cursor: pointer;
  backdrop-filter: blur(12px);
  animation: soz-glow-pulse 2.4s ease-in-out infinite;
  transition:
    border-color 0.3s ease,
    background 0.3s ease,
    color 0.3s ease,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) and (pointer: fine) {
  #soz-chat-root .soz-fab:hover {
    border-color: rgba(52, 211, 153, 0.7);
    background: #18181b;
    color: #a7f3d0;
    transform: translateY(-2px) scale(1.06);
  }
}

#soz-chat-root .soz-fab:active {
  transform: scale(0.94);
}

#soz-chat-root .soz-fab[hidden] {
  display: none !important;
}

@keyframes soz-glow-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(52, 211, 153, 0.2),
      0 0 14px rgba(52, 211, 153, 0.18);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(52, 211, 153, 0.45),
      0 0 26px rgba(52, 211, 153, 0.4);
  }
}

/* Панель */

#soz-chat-root .soz-panel {
  position: fixed;
  right: var(--soz-offset);
  bottom: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 2rem));
  height: min(520px, calc(100vh - 6rem));
  overflow: hidden;
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 16px;
  background: var(--soz-surface);
  color: var(--soz-text);
  backdrop-filter: blur(16px);
  box-shadow:
    0 0 40px rgba(52, 211, 153, 0.15),
    0 20px 60px rgba(0, 0, 0, 0.55);
  animation: soz-panel-in 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#soz-chat-root .soz-panel[hidden] {
  display: none !important;
}

@keyframes soz-panel-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#soz-chat-root .soz-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#soz-chat-root .soz-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #f4f4f5;
}

#soz-chat-root .soz-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: var(--soz-accent);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.7);
}

#soz-chat-root .soz-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--soz-muted);
}

#soz-chat-root .soz-close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a1a1aa;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

#soz-chat-root .soz-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f4f4f5;
}

/* Сообщения */

#soz-chat-root .soz-msgs {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

#soz-chat-root .soz-msgs::-webkit-scrollbar {
  width: 6px;
}

#soz-chat-root .soz-msgs::-webkit-scrollbar-thumb {
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
}

#soz-chat-root .soz-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  animation: soz-bubble-in 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes soz-bubble-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#soz-chat-root .soz-user {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: var(--soz-accent-soft);
  color: #ecfdf5;
}

#soz-chat-root .soz-assistant {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--soz-text);
}

#soz-chat-root .soz-wait {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px;
}

#soz-chat-root .soz-wait span {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--soz-accent-text);
  animation: soz-typing 1.2s ease-in-out infinite;
}

#soz-chat-root .soz-wait span:nth-child(2) {
  animation-delay: 0.15s;
}

#soz-chat-root .soz-wait span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes soz-typing {
  0%,
  60%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* Форма ввода */

#soz-chat-root .soz-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#soz-chat-root .soz-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(24, 24, 27, 0.8);
  color: #f4f4f5;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

#soz-chat-root .soz-input::placeholder {
  color: var(--soz-muted);
}

#soz-chat-root .soz-input:focus {
  border-color: rgba(52, 211, 153, 0.4);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.2);
}

#soz-chat-root .soz-send {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--soz-accent);
  color: #09090b;
  cursor: pointer;
  transition:
    background 0.2s ease,
    opacity 0.2s ease;
}

#soz-chat-root .soz-send:hover:not(:disabled) {
  background: #6ee7b7;
}

#soz-chat-root .soz-send:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  #soz-chat-root .soz-fab,
  #soz-chat-root .soz-panel,
  #soz-chat-root .soz-bubble,
  #soz-chat-root .soz-wait span {
    animation: none;
  }
}
