/* Помощник Whale.Art Studio: шар из частиц и чат */
.as-root {
  --as-gold: #f0c891;
  --as-gold-2: #d8a365;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9000;
  font-family: Inter, "SF Pro Display", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.85, 0.2, 1);
}
.as-root.is-wait { opacity: 0; pointer-events: none; }

/* шар */
.as-orb {
  position: relative;
  display: block;
  width: 96px;
  height: 96px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  animation: asFloat 6.5s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.35s cubic-bezier(0.2, 0.85, 0.2, 1);
}
.as-orb:hover { transform: scale(1.06); }
.as-orb:focus-visible { outline: 2px solid var(--as-gold); outline-offset: 4px; }
.as-orb canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
@keyframes asFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }

/* подсказка */
.as-teaser {
  position: absolute;
  right: 92px;
  bottom: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 250px;
  padding: 10px 10px 10px 16px;
  border: 1px solid rgba(240, 200, 145, 0.32);
  border-radius: 14px 14px 4px 14px;
  background: rgba(12, 14, 18, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  color: #efe9dc;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  opacity: 0;
  transform: translateX(12px) scale(0.96);
  transform-origin: right bottom;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 0.85, 0.2, 1);
}
.as-teaser.on { opacity: 1; transform: none; }
.as-teaser[hidden] { display: none; }
.as-teaser button { flex: none; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: #efe9dc; font-size: 14px; line-height: 1; cursor: pointer; }

/* панель */
.as-panel {
  position: absolute;
  right: 108px;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 384px;
  height: min(580px, calc(calc(var(--vh) * 100) - 60px));
  overflow: hidden;
  border: 1px solid rgba(240, 200, 145, 0.26);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20, 22, 28, 0.97), rgba(9, 11, 14, 0.98));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.4);
  color: #efe9dc;
  opacity: 0;
  transform: translate(18px, 24px) scale(0.5);
  transform-origin: right bottom;
  transition: opacity 0.35s ease, transform 0.55s cubic-bezier(0.2, 0.85, 0.2, 1);
}
.as-panel[hidden] { display: none; }
.as-panel.on { opacity: 1; transform: none; }

.as-head { touch-action: none; cursor: grab; display: flex; align-items: center; gap: 12px; padding: 14px 16px 12px 14px; border-bottom: 1px solid rgba(240, 200, 145, 0.14); }
.as-head-orb { flex: none; width: 44px; height: 44px; }
.as-head-text { flex: 1; min-width: 0; }
.as-head-text strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 400; color: var(--as-gold); }
.as-head-text small { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; color: rgba(239, 233, 220, 0.6); }
.as-head-text small i { width: 6px; height: 6px; border-radius: 50%; background: #7fd49a; box-shadow: 0 0 8px #7fd49a; }
.as-close { flex: none; width: 32px; height: 32px; border: 1px solid rgba(240, 200, 145, 0.28); border-radius: 50%; background: transparent; color: var(--as-gold); font-size: 20px; line-height: 1; cursor: pointer; transition: background 0.2s ease; }
.as-close:hover { background: rgba(240, 200, 145, 0.12); }

.as-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; scrollbar-color: rgba(240, 200, 145, 0.3) transparent; overscroll-behavior: contain; }
.as-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; opacity: 0; transform: translateY(8px); transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.85, 0.2, 1); overflow-wrap: anywhere; }
.as-msg.in { opacity: 1; transform: none; }
.as-bot { align-self: flex-start; border-bottom-left-radius: 5px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.06); }
.as-user { align-self: flex-end; border-bottom-right-radius: 5px; background: linear-gradient(180deg, #f0c891, #d8a365); color: #1b1408; }
.as-line { margin: 2px 0; }
.as-msg a { color: var(--as-gold); text-underline-offset: 3px; }
.as-typing { display: flex; gap: 5px; align-items: center; padding: 14px 16px; }
.as-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--as-gold); opacity: 0.4; animation: asDot 1s ease-in-out infinite; }
.as-typing i:nth-child(2) { animation-delay: 0.15s; }
.as-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes asDot { 0%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.as-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 14px 10px; max-height: 128px; overflow-y: auto; }
.as-chips:empty { display: none; }
.as-chip { padding: 7px 12px; border: 1px solid rgba(240, 200, 145, 0.4); border-radius: 999px; background: transparent; color: var(--as-gold); font: inherit; font-size: 12.5px; cursor: pointer; transition: background 0.2s ease, color 0.2s ease; }
.as-chip:hover { background: rgba(240, 200, 145, 0.14); }

.as-form { display: flex; gap: 8px; padding: 10px 12px 10px; border-top: 1px solid rgba(240, 200, 145, 0.14); }
.as-input { flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid rgba(240, 200, 145, 0.25); border-radius: 12px; background: rgba(255, 255, 255, 0.05); color: #fff; font: inherit; font-size: 14px; outline: none; transition: border-color 0.2s ease; }
.as-input:focus { border-color: var(--as-gold); }
.as-input::placeholder { color: rgba(239, 233, 220, 0.4); }
.as-send { flex: none; width: 44px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #f0c891, #d8a365); color: #1b1408; font-size: 18px; cursor: pointer; }
.as-foot { padding: 0 14px 10px; font-size: 10.5px; color: rgba(239, 233, 220, 0.38); text-align: center; }

/* телефон и планшет */
@media (max-width: 1100px) {
  .as-root { bottom: calc(82px + env(safe-area-inset-bottom, 0px)); right: 12px; }
  .as-orb { width: 78px; height: 78px; }
  .as-panel { right: 92px; bottom: 0; width: min(384px, calc(100vw - 112px)); height: min(560px, calc(calc(var(--vh) * 100) - 230px)); }
}
@media (max-width: 600px) {
  .as-teaser { right: 70px; bottom: 22px; max-width: 200px; font-size: 12.5px; }
  .as-root { right: auto; left: 50%; margin-left: -34px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .as-orb { width: 68px; height: 68px; }
  .as-teaser { right: auto; left: 50%; bottom: 86px; transform: translateX(-50%) scale(0.96); transform-origin: center bottom; border-radius: 14px 14px 14px 4px; }
  .as-teaser.on { transform: translateX(-50%); }
  .as-root.is-open .as-orb { opacity: 0; pointer-events: none; }
  .as-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    width: auto;
    height: min(calc(var(--vh) * 56), 520px);
    transform-origin: right bottom;
  }
  .as-msg { max-width: 92%; font-size: 14.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .as-orb { animation: none; }
  .as-panel, .as-msg, .as-teaser { transition-duration: 0.01s; }
  .as-typing i { animation: none; opacity: 0.7; }
}

/* пролёт частиц из кита */
.as-fly { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 8990; pointer-events: none; }

/* разлёт частиц помощника по углам над нижним меню */
.as-spread { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 8990; pointer-events: none; }

/* согласие на cookie в подсказке помощника */
.as-teaser.as-consent { max-width: 330px; align-items: flex-start; cursor: default; }
.as-teaser.as-consent > span { display: block; line-height: 1.5; }
.as-teaser.as-consent a { color: #f0c891; text-decoration: underline; text-underline-offset: 3px; }
.as-cb { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.as-teaser .as-cb button { width: auto; height: auto; padding: 8px 14px; border-radius: 999px; font: inherit; font-size: 12.5px; line-height: 1.2; cursor: pointer; transition: transform 0.2s ease; }
.as-teaser .as-cb button:hover { transform: translateY(-1px); }
.as-teaser .as-cb button[data-ck="1"] { border: 0; background: linear-gradient(180deg, #f0c891, #d8a365); color: #1a1206; font-weight: 600; }
.as-teaser .as-cb button[data-ck="0"] { background: transparent; border: 1px solid rgba(240, 200, 145, 0.4); color: #efe9dc; }
@media (max-width: 560px) { .as-teaser.as-consent { max-width: calc(100vw - 32px); } }

/* подсказка над шаром: ширина по тексту, а не по узкому контейнеру шара */
.as-teaser { width: max-content; }
