/* Не занимает место, пока нет текста (раньше здесь показывали «Доступно раскладов» для вошедших) */
#demo-status-bar:empty {
  display: none;
}
/* Вертикальная полоса прокрутки всегда заметна, когда окно демо ограничено по высоте (главная, блог, лендинги колод). */
#demo-messages.web-chat-messages,
#demo-messages {
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  /* Firefox: тонкая полоса в тон интерфейсу */
  scrollbar-width: thin;
  scrollbar-color: rgba(130, 100, 200, 0.75) rgba(18, 12, 34, 0.92);
}
/* Chromium / Safari: кастомный скроллбар под тёмную схему и фиолетовую рамку чата */
#demo-messages::-webkit-scrollbar {
  width: 10px;
}
#demo-messages::-webkit-scrollbar-track {
  background: rgba(12, 8, 26, 0.85);
  border-radius: 10px;
  margin: 4px 0;
}
#demo-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(140, 110, 210, 0.55) 0%, rgba(75, 52, 140, 0.9) 50%, rgba(55, 38, 105, 0.95) 100%);
  border-radius: 8px;
  border: 2px solid rgba(18, 12, 34, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
#demo-messages::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(165, 135, 230, 0.65) 0%, rgba(95, 70, 165, 0.95) 100%);
}
#demo-messages::-webkit-scrollbar-thumb:active {
  background: rgba(73, 54, 106, 0.95);
}
#demo-messages::-webkit-scrollbar-corner {
  background: rgba(12, 8, 26, 0.85);
}
/* Чуть отступ при scrollIntoView с мобилки (бабл → к форме) */
#try-chat {
  scroll-margin-top: 16px;
}
/* Заголовок секции демо-чата (h2 на главной, в блоге, у прорицателей и т.д.) */
#try-chat h2.section-title {
  color: var(--text-gold, #e1c07a);
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.demo-title-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  margin-left: 8px;
  border-radius: 999px;
  font-size: 0.9em;
  line-height: 1;
  background: rgba(116, 85, 195, 0.38);
  border: 1px solid rgba(198, 160, 255, 0.55);
  color: #ffe39e;
  cursor: help;
  vertical-align: text-top;
}
.demo-title-hint-mark {
  font-size: 0.82em;
  font-weight: 700;
  font-family: Georgia, serif;
  transform: translateY(-0.03em);
}
.demo-title-hint-pop {
  position: fixed;
  left: 8px;
  top: 8px;
  z-index: 1200;
  width: min(660px, calc(100vw - 24px));
  max-height: min(68vh, 760px);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(178, 142, 255, 0.5);
  background: linear-gradient(165deg, rgba(34, 24, 64, 0.98), rgba(19, 12, 40, 0.98));
  color: #efe7ff;
  box-shadow: 0 16px 34px rgba(6, 2, 16, 0.6);
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}
.demo-title-hint.is-open .demo-title-hint-pop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.demo-title-hint-pop.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.demo-title-hint-pop h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #ffe7aa;
}
.demo-title-hint-pop ol {
  margin: 0;
  padding-left: 18px;
}
.demo-title-hint-pop li + li {
  margin-top: 10px;
}
.demo-title-hint-pop p {
  margin: 4px 0 0;
  max-width: 100%;
}
.demo-title-hint-pop .demo-title-hint-example {
  display: block;
  margin-top: 5px;
  color: #d5c9f2;
}
.demo-title-hint-pop .demo-title-hint-example b {
  color: #f5df9d;
}
@media (max-width: 700px) {
  body.demo-hint-open {
    overflow: hidden;
  }
  .demo-title-hint-pop {
    left: 8px;
    top: max(10px, env(safe-area-inset-top, 0px));
    width: min(720px, calc(100vw - 16px));
    max-height: min(72vh, 720px);
    z-index: 2147483000;
    background: #130d2b;
    color: #f2ecff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    text-shadow: none;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.68);
    padding: 12px;
  }
  .demo-title-hint-pop.is-floating {
    z-index: 2147483000;
  }
}
.web-msg { margin-bottom:14px; padding:10px 12px; border-radius:10px; max-width:95%; }
.web-msg.user { background:rgba(104,78,203,.35); margin-left:auto; text-align:right; }
.web-msg.bot { background:rgba(40,32,66,.75); border:1px solid #49366a; }
.web-msg.bot .interp { margin-top:8px; line-height:1.55; }
.web-msg.bot .interp p { margin:0 0 10px; }
.web-msg.bot .interp p:last-child { margin-bottom:0; }
.web-msg.bot .interp b, .web-msg.bot .interp strong { color:#ffe5b3; }
.web-cards { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.web-cards img {
  width:72px;
  border-radius:8px;
  box-shadow:0 4px 12px #0006;
  cursor:zoom-in;
}
.web-cards img:focus { outline:2px solid rgba(185,142,255,.7); outline-offset:2px; }
.demo-thinking { color:#c9b8e8; font-style:italic; }
.demo-thinking-pulse { display:inline-block; animation:demoThinkPulse 1s ease-in-out infinite; }
@keyframes demoThinkPulse { 0%,100%{opacity:.45} 50%{opacity:1} }
.web-queue-delay {
  border-color: rgba(225, 192, 122, 0.58) !important;
  background: linear-gradient(155deg, rgba(64, 38, 110, 0.9), rgba(25, 17, 48, 0.96)) !important;
  box-shadow: 0 0 22px rgba(148, 98, 228, 0.22);
}
.web-queue-delay__line {
  color: #ffe6aa;
  font-weight: 700;
  line-height: 1.35;
}
.web-queue-delay__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  margin-top: 12px;
}
.web-queue-delay__button,
.web-queue-delay__link {
  display: inline-block;
  border-radius: 10px;
  text-decoration: none;
}
.web-queue-delay__button {
  padding: 9px 13px;
  border: 1px solid rgba(255, 228, 166, 0.68);
  color: #1b112d;
  background: linear-gradient(95deg, #ffe0a3, #c99cff);
  font-weight: 700;
}
.web-queue-delay__link {
  color: #d7c7ff;
  font-size: 14px;
}
.web-queue-delay__link:hover {
  color: #fff0bd;
  text-decoration: underline;
}
.demo-register-cta { margin-top:14px; padding-top:12px; border-top:1px solid rgba(255,255,255,.12); }
.demo-register-cta .demo-register-hint { margin:0 0 10px; font-size:14px; color:var(--muted, #a89cc4); line-height:1.4; }
#try-chat .web-chat-input-row { width: 100%; }
#try-chat #demo-q { width: 100%; max-width: 100%; }
#try-chat #demo-send { white-space: nowrap; }
#try-chat #demo-send:disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
  filter: grayscale(0.2);
  box-shadow: none;
}
.demo-guest-lock-hint {
  margin-top: 10px;
  margin-bottom: 2px;
  padding: 11px 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(176, 138, 255, 0.48);
  background: linear-gradient(150deg, rgba(73, 50, 130, 0.42), rgba(41, 28, 79, 0.66));
  box-shadow: 0 0 16px rgba(117, 84, 200, 0.22);
}
.demo-guest-lock-hint[hidden] {
  display: none !important;
}
.demo-guest-lock-hint__text {
  margin: 0 0 10px;
  color: #e5dbfb;
  line-height: 1.42;
  font-size: 14px;
}
.demo-guest-lock-hint__text strong {
  color: #ffe3a8;
}
.demo-guest-lock-hint__btn {
  display: inline-block;
}
.demo-empty-state { margin-bottom:4px; }
.demo-empty-lead { color:rgba(200,185,230,.72); font-size:14px; line-height:1.45; margin:0 0 12px; max-width:36em; }
/* Быстрые вопросы (без внутренней полосы прокрутки - список целиком) */
.demo-quick-questions {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
  padding: 0;
}
.demo-quick-questions--aside {
  flex: 1 1 auto;
  min-height: 0;
}
.demo-quick-questions--below-chat {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  max-height: none;
  overflow: visible;
  padding: 0 0 4px;
  margin-bottom: 10px;
}
.demo-quick-questions--below-chat .demo-quick-bubble {
  flex: 1 1 min(280px, 100%);
  max-width: 100%;
}
/* Кнопка-«бабл» в палитре сайта (хвост снизу слева, как в переписке) */
.demo-quick-bubble {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 11px 14px 13px;
  border: 1px solid rgba(160, 130, 230, 0.38);
  cursor: pointer;
  pointer-events: auto;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: #f2ecff;
  text-align: left;
  background: linear-gradient(155deg, rgba(118, 88, 195, 0.5) 0%, rgba(62, 42, 118, 0.82) 55%, rgba(48, 32, 92, 0.9) 100%);
  border-radius: 16px 16px 16px 5px;
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition:
    filter 0.18s ease,
    border-color 0.18s ease,
    transform 0.12s ease;
}
.demo-quick-bubble:hover:not(:disabled) {
  filter: brightness(1.08);
  border-color: rgba(210, 180, 255, 0.55);
}
.demo-quick-bubble:active:not(:disabled) {
  transform: scale(0.99);
}
.demo-quick-bubble:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.15);
}
.demo-quick-questions--aside .demo-quick-bubble:last-child {
  margin-bottom: 4px;
}
.demo-quick-bubble::after {
  content: '';
  position: absolute;
  left: 16px;
  bottom: -6px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid rgba(48, 32, 92, 0.95);
}
/* Кнопки мессенджеров под формой демо-чата (блог, колоды, прорицатели) */
#try-chat .demo-chat-messenger-below {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
#try-chat .demo-chat-messenger-lead {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(200, 185, 230, 0.85);
}
#try-chat .demo-chat-bot-open-row {
  gap: 10px;
}
@media (max-width: 700px) {
  #try-chat .web-chat-input-row {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px !important;
  }
  #try-chat #demo-q {
    min-width: 0 !important;
    width: 100%;
  }
  #try-chat #demo-send {
    width: 100%;
    align-self: stretch;
  }
  #try-chat .demo-register-cta .btn {
    display: block;
    width: 100%;
    text-align: center;
  }
  #try-chat .web-queue-delay__button,
  #try-chat .web-queue-delay__link {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }
  #try-chat .demo-register-cta .demo-register-hint {
    font-size: 13px;
  }
  .demo-guest-lock-hint {
    padding: 10px;
  }
  .demo-guest-lock-hint__text {
    font-size: 13px;
    margin-bottom: 8px;
  }
  .demo-guest-lock-hint__btn {
    display: block;
    width: 100%;
    text-align: center;
  }
  #demo-status-bar {
    font-size: 13px !important;
    line-height: 1.45;
  }
}
