.ai-companion { --ai-ink: #20352a; --ai-lime: #d8ed8c; color: var(--ai-ink); }
.ai-companion[hidden], .ai-mascot[hidden] { display: none; }
.ai-mascot { position: fixed; right: 0; bottom: env(safe-area-inset-bottom, 0px); width: 122px; height: 130px; overflow: clip; z-index: 15; pointer-events: none; }
.ai-mascot__button { position: absolute; right: 14px; bottom: 0; width: 85.76px; height: 103.18px; display: block; padding: 0; border: 0; border-radius: 40px; background: transparent; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; pointer-events: auto; }
.ai-mascot__button:focus-visible { outline: 3px solid #547a29; outline-offset: 2px; background: #ffffff80; }
.ai-mascot__entrance { display: block; width: 100%; height: 100%; transform-origin: 85% 65%; }
.ai-mascot[data-state="peeking"] .ai-mascot__entrance { animation: ai-peek 1.6s ease-out both; }
.ai-mascot__figure { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 4px 3px #14251a18); animation: ai-float 4.5s ease-in-out infinite; }
.ai-mascot[data-state="peeking"] .ai-mascot__figure { animation: none; }
.ai-robot__eyes { transform-origin: 76px 74px; animation: ai-blink 7s infinite; }
.ai-robot__arm--wave { transform-origin: 42px 110px; transform: rotate(-8deg); }
.ai-mascot[data-state="waving"] .ai-robot__arm--wave { animation: ai-wave .55s ease-in-out 4 alternate; }
.ai-mascot__shadow { transform-origin: 77px 159px; animation: ai-shadow 4.5s ease-in-out infinite; }
.ai-companion[data-motion="paused"] .ai-mascot__figure,
.ai-companion[data-motion="paused"] .ai-robot__eyes,
.ai-companion[data-motion="paused"] .ai-robot__arm--wave,
.ai-companion[data-motion="paused"] .ai-mascot__shadow { animation-play-state: paused; }
.ai-greeting { position: fixed; right: 108px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 16; width: 194px; max-width: calc(100vw - 124px); padding: 15px 17px; border: 1px solid #deebc4; border-radius: 18px 18px 4px 18px; background: #f6fbeaff; box-shadow: 0 8px 30px #1a2d1f16; color: #20352a; pointer-events: none; opacity: 0; visibility: hidden; transform: translateY(5px); transition: opacity .3s, transform .3s, visibility .3s; }
.ai-greeting strong { display: block; font-size: 14px; letter-spacing: -.02em; }
.ai-greeting span { display: block; margin-top: 4px; font-size: 14px; color: #5a6f4d; }
.ai-companion[data-greeting="true"] .ai-greeting,
.ai-companion:has(.ai-mascot__button:hover) .ai-greeting,
.ai-companion:has(.ai-mascot__button:focus-visible) .ai-greeting { opacity: 1; visibility: visible; transform: translateY(0); }
.ai-companion:has(.ai-dialog[open]) .ai-greeting { opacity: 0; visibility: hidden; }
@keyframes ai-peek { 0% { transform: translateX(110px) rotate(-16deg); } 45% { transform: translateX(25px) rotate(-10deg); } 65% { transform: translateX(32px) rotate(-8deg); } 100% { transform: translateX(0) rotate(0); } }
@keyframes ai-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes ai-shadow { 0%, 100% { opacity: 1; transform: scaleX(1); } 50% { opacity: .55; transform: scaleX(.82); } }
@keyframes ai-wave { from { transform: rotate(-16deg); } to { transform: rotate(17deg); } }
@keyframes ai-blink { 0%, 43%, 47%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.08); } }
.ai-dialog { position: fixed; inset: auto 24px 24px auto; width: 410px; max-width: calc(100vw - 32px); max-height: min(720px, calc(100dvh - 48px)); margin: 0; padding: 0; overflow: hidden; border: 1px solid #dce4d5; border-radius: 22px; background: #fff; color: #20352a; box-shadow: 0 20px 90px #122a2438; font-family: "Segoe UI", Arial, sans-serif; }
.ai-dialog[open] { display: flex; flex-direction: column; }
.ai-dialog::backdrop { background: #12251c26; }
body:has(.ai-dialog[open]) { overflow: hidden; }
.ai-dialog__header { display: flex; align-items: center; gap: 12px; padding: 20px; background: #f4f8ed; flex-shrink: 0; }
.ai-dialog__avatar { width: 44px; height: 44px; display: grid; place-items: center; background: #e0edc1; border-radius: 14px; flex-shrink: 0; }
.ai-dialog__avatar svg { width: 35px; height: 35px; }
.ai-dialog__header h2 { display: flex; align-items: center; gap: 8px; font-size: 21px; letter-spacing: -.04em; }
.ai-dialog__header h2 span { padding: 3px 6px; background: #e2eccd; border-radius: 5px; font-size: 11px; letter-spacing: .04em; }
.ai-dialog__header p { margin-top: 3px; font-size: 13px; color: #63725f; }
.ai-dialog__close { margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 50%; font-size: 27px; font-weight: 300; background: transparent; color: #20352a; cursor: pointer; }
.ai-dialog__close:hover { background: #e6eddb; }
.ai-dialog__demo { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-bottom: 1px solid #edf0e8; color: #66765c; font-size: 13px; flex-shrink: 0; }
.ai-dialog__demo > span { width: 5px; height: 5px; background: #86ad50; border-radius: 50%; }
.ai-dialog__messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px; scrollbar-width: thin; }
.ai-message { width: fit-content; max-width: 94%; padding: 13px 15px; margin-bottom: 15px; border-radius: 15px 15px 15px 3px; background: #f2f5ee; color: #32402e; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; white-space: pre-line; }
.ai-message:last-child { margin-bottom: 0; }
.ai-message p + p { margin-top: 10px; }
.ai-message__author { display: block; margin-bottom: 5px; color: #54782d; font-size: 12px; font-weight: 700; }
.ai-message--user { margin-left: auto; border-radius: 15px 15px 3px 15px; background: #e2efc8; }
.ai-message--typing { color: #68795d; font-size: 13px; }
.ai-dialog__suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 20px 16px; flex-shrink: 0; }
.ai-dialog__suggestions button { min-height: 36px; padding: 7px 10px; border: 1px solid #dce5d3; border-radius: 9px; background: white; color: #435b35; font-size: 13px; cursor: pointer; }
.ai-dialog__suggestions button:hover { background: #f2f7e9; border-color: #9cbd73; }
.ai-dialog__suggestions button:disabled { opacity: .5; cursor: wait; }
.ai-dialog__composer { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid #e8eddf; flex-shrink: 0; }
.ai-dialog__composer input { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid #dce5d3; border-radius: 10px; background: #fbfcf8; color: #20352a; font: inherit; font-size: 15px; }
.ai-dialog__composer input::placeholder { color: #798773; opacity: 1; }
.ai-dialog__composer button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: #d8ed8c; color: #20352a; cursor: pointer; }
.ai-dialog__composer button:disabled { opacity: .5; cursor: wait; }
.ai-dialog__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px 12px; color: #76816e; font-size: 11px; flex-shrink: 0; }
.ai-dialog__footer button { min-height: 32px; padding: 4px 0; border: 0; background: transparent; color: #577a34; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ai-message--error { background:#fff1f1;border:1px solid #efb5b5;color:#922c2c; }
.ai-message__links { display:flex;flex-wrap:wrap;gap:8px;margin-top:10px; }
.ai-message__links a { display:inline-block;padding:6px 10px;border:1px solid #cbd7be;background:white;border-radius:8px;color:#314c24;text-decoration:none;font-weight:600; }
.ai-message__links a:hover { background:#e6eddb; }
.ai-companion :focus-visible { outline: 2px solid #547a29; outline-offset: 3px; }
@media (max-width: 600px) {
    .ai-mascot { width: 104px; height: 110px; }
    .ai-mascot__button { width: 71.02px; height: 85.76px; right: 10px; }
    .ai-greeting { right: 91px; bottom: calc(64px + env(safe-area-inset-bottom)); max-width: calc(100vw - 107px); padding: 12px 14px; }
    .ai-dialog { inset: auto 12px 12px auto; width: calc(100vw - 24px); max-width: none; max-height: min(680px, calc(100dvh - 24px)); border-radius: 18px; }
    .ai-dialog__header { padding: 15px; }
    .ai-dialog__messages { padding: 16px; }
    .ai-dialog__suggestions { padding-inline: 16px; }
    .ai-dialog__composer input { font-size: 17px; }
    .ai-dialog__footer { padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .ai-companion *, .ai-companion *::before, .ai-companion *::after { animation: none !important; transition: none !important; }
}
@media (max-height: 520px) {
    .ai-dialog__suggestions { display: none; }
    .ai-dialog__header { padding-block: 10px; }
}
