/* AI-подборщик: чат, карточки, маскот */
.aih { display: flex; flex-direction: column; font: 15px/1.45 -apple-system, "Helvetica Neue", Arial, sans-serif; color: #111; }
.aih--page { min-height: 520px; max-width: 900px; margin: 0 auto; }
.aih--widget { height: 100%; }
.aih__messages { flex: 1 1 auto; overflow-y: auto; padding: 8px 0; }
.aih--page .aih__messages { max-height: none; overflow: visible; }
.aih__msg { display: flex; margin: 6px 0; }
.aih__msg--user { justify-content: flex-end; }
.aih__bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; white-space: normal; word-wrap: break-word; }
.aih__msg--assistant .aih__bubble { background: #f2f2f2; border-bottom-left-radius: 4px; }
.aih__msg--user .aih__bubble { background: #111; color: #fff; border-bottom-right-radius: 4px; }
.aih__typing i { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: #999; animation: aih-blink 1.2s infinite; }
.aih__typing i:nth-child(2) { animation-delay: .2s; } .aih__typing i:nth-child(3) { animation-delay: .4s; }
@keyframes aih-blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.aih__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.aih__chip { border: 1px solid #ccc; background: #fff; color: #111; border-radius: 20px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.aih__chip:hover { border-color: #111; }
.aih__form { display: flex; gap: 8px; align-items: flex-end; padding-top: 6px; border-top: 1px solid #eee; }
.aih__input { flex: 1 1 auto; resize: none; min-height: 42px; max-height: 120px; padding: 10px 12px; border: 1px solid #ccc; border-radius: 10px; font: inherit; line-height: 1.4; overflow: hidden; box-sizing: border-box; -webkit-appearance: none; }
.aih__input::placeholder { color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aih__input:focus { outline: none; border-color: #111; }
.aih__send { flex: 0 0 auto; height: 42px; padding: 0 18px; border: 0; border-radius: 10px; background: #111; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.aih__send:hover { background: #333; }
.aih__products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.aih--widget .aih__products { grid-template-columns: repeat(2, 1fr); }
.aih__card { display: block; border: 1px solid #e5e5e5; border-radius: 12px; overflow: hidden; text-decoration: none; color: #111; background: #fff; transition: box-shadow .15s; }
.aih__card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.aih__card-img { aspect-ratio: 1 / 1; background: #f6f6f6; }
.aih__card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aih__card-body { padding: 8px 10px 10px; }
.aih__card-name { font-size: 13px; font-weight: 600; line-height: 1.3; max-height: 3.9em; overflow: hidden; }
.aih__card-note { font-size: 12px; color: #666; margin-top: 4px; }
.aih__card-price { font-size: 14px; font-weight: 700; margin-top: 6px; }

/* beta */
.aih-beta { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 7px; border-radius: 10px; background: #fce000; color: #111; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3; }
.aih-page__title .aih-beta { font-size: 12px; vertical-align: middle; }
.aih__note { font-size: 12px; color: #777; padding: 2px 4px 8px; }

/* страница */
.aih-page { max-width: 900px; margin: 20px auto 40px; padding: 0 12px; }
.aih-page__title { margin: 0 0 6px; }
.aih-page__lead { color: #555; margin: 0 0 16px; }
.aih-page__warn { background: #fff4d6; border: 1px solid #f0d48a; padding: 10px 12px; border-radius: 8px; }

/* маскот-кнопка и панель */
.aih-fab { position: fixed; right: 20px; bottom: 20px; z-index: 9990; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border: 0; border-radius: 30px; background: #111; color: #fff; font: 600 15px/1 -apple-system, "Helvetica Neue", Arial, sans-serif; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.aih-fab__icon { font-size: 20px; line-height: 1; }
.aih-fab.is-open { display: none; }
.aih-panel { position: fixed; right: 20px; bottom: 20px; z-index: 9991; width: 400px; max-width: calc(100vw - 40px); height: 640px; max-height: calc(100vh - 40px); display: none; flex-direction: column; background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.28); overflow: hidden; }
.aih-panel.is-open { display: flex; }
.aih-panel__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #111; color: #fff; font-weight: 600; }
.aih-panel__head > span { flex: 1 1 auto; }
.aih-panel__link { color: #ccc; font-size: 12px; font-weight: 400; text-decoration: underline; }
.aih-panel__close { border: 0; background: transparent; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
.aih-panel__body { flex: 1 1 auto; display: flex; flex-direction: column; padding: 8px 12px 12px; min-height: 0; }
.aih-panel__body .aih { height: 100%; min-height: 0; }
@media (max-width: 600px) {
    /* iOS Safari: 100vh выше видимой области — растягиваем панель по краям экрана, а не по vh */
    .aih-panel { top: 0; right: 0; bottom: 0; left: 0; width: auto; max-width: none; height: auto; max-height: none; border-radius: 0; }
    .aih-panel__head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
    .aih-panel__body { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
    .aih-fab { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
    .aih-fab__label { display: none; }
    body.aih-panel-open { overflow: hidden; }
}
