/* ИИ-консультант (assistant.js): точка из логотипа в углу экрана, бегущая надпись вокруг, окно чата поверх сайта. */
.ai-fab {
  --ai-size: 112px; --ai-ball: 58px;
  position: fixed; right: 18px; bottom: 18px; z-index: 60; width: var(--ai-size); height: var(--ai-size);
  padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ai-fab[hidden] { display: none; }
.ai-ring-wrap { position: absolute; inset: 0; border-radius: 50%; background: rgb(10 10 10 / .88); box-shadow: 0 10px 30px rgb(0 0 0 / .35), inset 0 0 0 1px #2c2e28; transform-origin: 50% 50%; }
.ai-ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: ai-spin 14s linear infinite; }
.ai-ring text { fill: var(--lime, #cbff38); font: 700 9.6px/1 Inter, Arial, sans-serif; letter-spacing: .14em; }
.ai-ball {
  position: absolute; left: 50%; top: 50%; width: var(--ai-ball); height: var(--ai-ball); margin: calc(var(--ai-ball) / -2) 0 0 calc(var(--ai-ball) / -2);
  border-radius: 50%; transform-origin: 50% 50%; will-change: transform;
}
.ai-ball img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 8px rgb(0 0 0 / .25)); }
/* значок касания: кончик пальца (точка 11.5×5 из 24) ставим в центр мяча */
.ai-tap { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -6px 0 0 -13.4px; fill: #171a11; pointer-events: none; transform-origin: 48% 21%; filter: drop-shadow(0 1px 0 rgb(247 245 240 / .55)); }
.ai-fab:hover .ai-ball, .ai-fab:focus-visible .ai-ball { filter: brightness(1.06); }
.ai-fab:focus-visible { outline: none; }
.ai-fab:focus-visible .ai-ring-wrap { box-shadow: 0 0 0 3px var(--lime, #cbff38); }
.ai-fab .ai-pulse { position: absolute; left: 50%; top: 50%; width: var(--ai-ball); height: var(--ai-ball); margin: calc(var(--ai-ball) / -2) 0 0 calc(var(--ai-ball) / -2); border-radius: 50%; border: 2px solid var(--lime, #cbff38); opacity: 0; pointer-events: none; }
/* в углу: палец каждые 2,8 с нажимает на точку — мяч продавливается, от него расходится волна */
.ai-fab.is-docked .ai-tap { animation: ai-tap 2.8s cubic-bezier(.45, 0, .55, 1) .6s infinite; }
.ai-fab.is-docked .ai-ball img { animation: ai-press 2.8s cubic-bezier(.45, 0, .55, 1) .6s infinite; transform-origin: 50% 50%; }
.ai-fab.is-docked .ai-pulse { animation: ai-pulse 2.8s ease-out .6s infinite; }
.ai-fab:hover .ai-tap, .ai-fab:hover .ai-ball img, .ai-fab:hover .ai-pulse { animation-play-state: paused; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@keyframes ai-tap {
  0%, 38% { transform: translate(7px, 9px) scale(1.12) rotate(-6deg); }   /* рука поднята и отведена */
  52% { transform: translate(0, 0) scale(1) rotate(0); }                  /* опускается к точке */
  58% { transform: translate(0, 1px) scale(.9) rotate(0); }               /* нажатие */
  66% { transform: translate(0, 0) scale(.98) rotate(0); }                /* отпускает */
  84%, 100% { transform: translate(7px, 9px) scale(1.12) rotate(-6deg); }
}
@keyframes ai-press { 0%, 54% { transform: scale(1); } 59% { transform: scale(.88, .86); } 67% { transform: scale(1.04); } 74%, 100% { transform: scale(1); } }
@keyframes ai-pulse { 0%, 57% { transform: scale(1); opacity: 0; } 59% { transform: scale(1); opacity: .8; } 95%, 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ai-ring, .ai-fab.is-docked .ai-pulse, .ai-fab.is-docked .ai-tap, .ai-fab.is-docked .ai-ball img { animation: none; } }
@media (max-width: 600px) { .ai-fab { --ai-size: 92px; --ai-ball: 48px; right: 12px; bottom: 12px; } .ai-ring text { font-size: 9.9px; } }

/* окно чата */
.ai-panel {
  position: fixed; right: 18px; bottom: 142px; z-index: 61; width: min(400px, calc(100vw - 36px)); height: min(600px, calc(100vh - 170px));
  display: grid; grid-template-rows: auto 1fr auto auto; overflow: hidden;
  border-radius: 22px; background: #121311; border: 1px solid #2f312b; box-shadow: 0 24px 60px rgb(0 0 0 / .5); color: #e7e8e1;
  transform-origin: 100% 100%; animation: ai-open .32s var(--ease-out, ease) both;
}
.ai-panel[hidden] { display: none; }
@keyframes ai-open { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.ai-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px 16px; border-bottom: 1px solid #262823; }
.ai-head img { width: 34px; height: 34px; }
.ai-head b { display: block; font-size: 1rem; color: #fafaf8; }
.ai-head small { display: block; font-size: .8rem; color: #8d9188; }
.ai-close { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; border: 1px solid #33352e; background: none; color: #e7e8e1; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.ai-close:hover { background: #20221d; }
.ai-log { overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 86%; padding: 11px 14px; border-radius: 16px; font-size: .97rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-msg.bot { align-self: flex-start; background: var(--paper, #f7f5f0); color: #171a11; border-bottom-left-radius: 6px; }
.ai-msg.me { align-self: flex-end; background: #2a2c26; color: #fafaf8; border-bottom-right-radius: 6px; }
.ai-actions { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 8px; }
.ai-actions a, .ai-actions button { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 0; font: inherit; font-size: .88rem; font-weight: 650; text-decoration: none; cursor: pointer; }
.ai-actions .lead { background: var(--lime, #cbff38); color: #171a11; }
.ai-actions .more { background: #262823; color: #e7e8e1; }
.ai-typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; border-radius: 16px; background: var(--paper, #f7f5f0); }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: #171a11; opacity: .3; animation: ai-dot 1s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; } .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 50% { opacity: 1; transform: translateY(-3px); } }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.ai-chips[hidden] { display: none; }
.ai-chips button { min-height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid #3a3c35; background: none; color: #e7e8e1; font: inherit; font-size: .87rem; cursor: pointer; }
.ai-chips button:hover { border-color: var(--lime, #cbff38); color: var(--lime, #cbff38); }
.ai-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border-top: 1px solid #262823; }
.ai-form textarea { resize: none; min-height: 44px; max-height: 120px; padding: 11px 14px; border-radius: 14px; border: 1px solid #33352e; background: #1a1b18; color: #fafaf8; font: inherit; font-size: .97rem; line-height: 1.35; }
.ai-form textarea:focus { outline: none; border-color: var(--lime, #cbff38); }
.ai-form button { width: 44px; height: 44px; align-self: end; border-radius: 50%; border: 0; background: var(--lime, #cbff38); color: #171a11; font-size: 1.2rem; font-weight: 800; cursor: pointer; }
.ai-form button:disabled { opacity: .45; cursor: default; }
.ai-note { grid-column: 1 / -1; margin: 0; font-size: .74rem; line-height: 1.35; color: #7c8077; }
@media (max-width: 600px) {
  /* телефон: окно по видимой части экрана (dvh без панелей Safari), низ — с запасом под полоску «Домой»;
     когда открыта клавиатура, высоту и сдвиг подстраивает assistant.js по visualViewport */
  .ai-panel { inset: 0 0 auto 0; width: auto; height: 100vh; height: 100dvh; border-radius: 0; border: 0; animation-name: ai-open-m; }
  .ai-form { padding-bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px)); }
  .ai-form textarea { font-size: 16px; } /* меньше 16 px — айфон сам приближает страницу при вводе */
  .ai-note { padding-bottom: 4px; }
  .ai-panel ~ .ai-fab, body.ai-open .ai-fab { display: none; }
  @keyframes ai-open-m { from { opacity: 0; transform: translateY(24px); } }
}
