#yc-chat-widget {
  --yc-bottom-offset: 88px;
  position: fixed;
  bottom: var(--yc-bottom-offset);
  right: 24px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#yc-chat-widget * {
  box-sizing: border-box;
}

/* Кнопка открытия */
#yc-toggle {
  width: 60px;
  height: 60px;
  border-radius: 15px;
  background-color: #6592b9;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(101, 146, 185, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.2s;
  position: relative;
  z-index: 1;
}

#yc-toggle:hover {
  background-color: #557d9f;
  transform: scale(1.05);
}

.yc-toggle-hidden {
  opacity: 0 !important;
  transform: scale(0.3) !important;
  pointer-events: none !important;
  visibility: hidden;
}

.yc-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Окно чата поверх кнопки */
#yc-box {
  position: fixed;
  bottom: var(--yc-bottom-offset);
  right: 24px;
  width: 380px;
  height: 540px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(101, 146, 185, 0.3);
  z-index: 2;
  transform-origin: bottom right;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.3s;
}

.yc-box-closed {
  opacity: 0 !important;
  transform: scale(0.1) !important;
  pointer-events: none !important;
  visibility: hidden;
}

.yc-box-open {
  opacity: 1 !important;
  transform: scale(1) !important;
  pointer-events: auto !important;
  visibility: visible;
}

#yc-header {
  height: 46px;
  min-height: 46px;
  max-height: 46px;
  background-color: #6592b9;
  color: #ffffff;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.yc-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: #ffffff;
}

.yc-header-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

#yc-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.85;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#yc-close:hover {
  opacity: 1;
}

/* Сообщения */
#yc-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

.yc-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.yc-user {
  align-self: flex-end;
  background-color: #6592b9;
  color: #ffffff;
  border-bottom-right-radius: 3px;
  white-space: pre-wrap;
}

.yc-bot {
  align-self: flex-start;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 3px;
}

/* Полная типографика Markdown */
.yc-bot p {
  margin: 0 0 8px 0 !important;
}
.yc-bot p:last-child {
  margin-bottom: 0 !important;
}

.yc-bot h1, .yc-bot h2, .yc-bot h3, .yc-bot h4, .yc-bot h5, .yc-bot h6 {
  margin: 12px 0 6px 0 !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  line-height: 1.3 !important;
}
.yc-bot h1 { font-size: 16px !important; }
.yc-bot h2 { font-size: 15px !important; }
.yc-bot h3 { font-size: 14.5px !important; }
.yc-bot h4 { font-size: 14px !important; }
.yc-bot h5 { font-size: 13.5px !important; }
.yc-bot h6 { font-size: 13px !important; }

.yc-bot ul {
  list-style-type: disc !important;
  padding-left: 20px !important;
  margin: 6px 0 8px 0 !important;
}

.yc-bot ol {
  list-style-type: decimal !important;
  padding-left: 20px !important;
  margin: 6px 0 8px 0 !important;
}

.yc-bot li {
  display: list-item !important;
  margin-bottom: 4px !important;
}

.yc-bot li > ul, .yc-bot li > ol {
  margin-top: 4px !important;
  margin-bottom: 4px !important;
}

.yc-bot strong {
  font-weight: 600 !important;
}

.yc-bot a {
  color: #6592b9 !important;
  text-decoration: underline !important;
}

.yc-bot code {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  padding: 2px 5px !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

.yc-bot pre {
  background: #1e293b !important;
  color: #f8fafc !important;
  padding: 10px 12px !important;
  border-radius: 6px !important;
  overflow-x: auto !important;
  margin: 8px 0 !important;
}

.yc-bot pre code {
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  font-size: 12px !important;
}

.yc-bot blockquote {
  border-left: 3px solid #6592b9 !important;
  margin: 8px 0 !important;
  padding: 4px 10px !important;
  color: #475569 !important;
  background: #f8fafc !important;
  border-radius: 0 4px 4px 0 !important;
}

.yc-bot table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 8px 0 !important;
  font-size: 12.5px !important;
}

.yc-bot th, .yc-bot td {
  border: 1px solid #cbd5e1 !important;
  padding: 6px 8px !important;
  text-align: left !important;
}

.yc-bot th {
  background: #f1f5f9 !important;
  font-weight: 600 !important;
}

.yc-bot hr {
  border: 0 !important;
  height: 1px !important;
  background: #e2e8f0 !important;
  margin: 10px 0 !important;
}

.yc-citations {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.yc-citations strong {
  display: block;
  margin-bottom: 4px;
  color: #475569;
}

.yc-citations a {
  color: #6592b9;
  text-decoration: underline;
  display: block;
  margin-bottom: 2px;
  word-break: break-all;
}

.yc-loading {
  font-style: italic;
  color: #64748b;
}

.yc-error {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

/* Поле ввода */
#yc-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

#yc-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  padding: 9px 12px;
  border-radius: 8px;
  outline: none;
  font-size: 13.5px;
  line-height: 1.4;
}

#yc-input:focus {
  border-color: #6592b9;
}

#yc-send {
  background-color: #6592b9;
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

#yc-send:hover {
  background-color: #557d9f;
}