/*
 * Лаборатория Кошмарского — alive.css
 * Уведомления, счетчик посетителей, приписки на фото и диалог «Вы еще здесь?».
 * Работает в паре с js/alive.js. Окна — в стиле «Службы безопасности» (css/karantin.css).
 */

/* ===== УВЕДОМЛЕНИЕ (левый нижний угол: справа живет чат) ===== */
.alive-toast {
    position: fixed;
    left: 16px;
    bottom: 16px;
    /* Выше плашки cookie (95), но ниже чата soser.net (100) и всех окон-перекрытий */
    z-index: 96;
    box-sizing: border-box;
    width: 300px;
    padding: 0 5px 5px;
    background: linear-gradient(#C9DAEE, #AFC6E0);
    border: 1px solid #4B6585;
    border-radius: 6px;
    box-shadow: 0 6px 22px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .7);
    color: #000000;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 13px;
    text-align: left;
    /* Спрятано за нижним краем экрана; класс is-shown выдвигает наверх */
    opacity: 0;
    visibility: hidden;
    transform: translateY(140%);
    transition: transform .45s ease-out, opacity .3s, visibility 0s .45s;
}

.alive-toast.is-shown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: transform .45s ease-out, opacity .3s, visibility 0s;
}

.alive-toast__title,
.alive-dialog__title {
    display: flex;
    align-items: center;
    height: 26px;
    color: #1E1E1E;
    /* «Стеклянная» подпись Windows 7: белое свечение вокруг букв */
    text-shadow: 0 0 8px #ffffff, 0 0 3px #ffffff;
}

.alive-shield {
    flex: 0 0 16px;
    margin: 0 6px 0 2px;
}

.alive-toast__caption,
.alive-dialog__caption {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.alive-toast__close,
.alive-dialog__close {
    width: 34px;
    height: 17px;
    margin-left: auto;
    align-self: flex-start;
    padding: 0;
    border: 1px solid #7A2210;
    border-top: 0;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(#E3A08F, #C7442B 50%, #B32E14);
    color: #ffffff;
    font-size: 10px;
    line-height: 1;
    text-shadow: none;
    cursor: pointer;
}

.alive-toast__close:hover,
.alive-dialog__close:hover {
    background: linear-gradient(#F0B4A3, #DA563B 50%, #C73A1E);
}

.alive-toast__body {
    padding: 9px 11px 8px;
    background: #ffffff;
    border: 1px solid #8DA2BD;
    cursor: pointer;
}

.alive-toast__body:hover {
    background: #F5FAFE;
}

.alive-toast__head {
    margin-bottom: 3px;
    color: #1E395B;
    font-size: 13px;
    font-weight: bold;
}

.alive-toast__text {
    line-height: 1.4;
}

.alive-toast__time {
    margin-top: 5px;
    color: #8A94A0;
    font-size: 11px;
}

/* Редкая тревога: текст красным, как ошибка в карантине */
.alive-toast--alarm .alive-toast__head,
.alive-toast--alarm .alive-toast__text {
    color: #A3262C;
}

.alive-toast--alarm .alive-toast__body {
    cursor: default;
}

/* ===== «СЕЙЧАС НА САЙТЕ» В ВЕРХНЕЙ ПОЛОСЕ ===== */
.alive-online {
    display: flex;
    align-items: center;
    padding: 7px 9px;
    color: #B5B5B5;
    font-family: Tahoma, Verdana, Arial, sans-serif;
    font-size: 11px;
    white-space: nowrap;
    cursor: default;
}

.alive-online__num {
    margin-left: 3px;
    color: #E6E6E6;
    font-weight: bold;
}

/* Зеленая «лампочка», как у статуса в аське */
.alive-online__dot {
    position: relative;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #B8F5A0, #3FAE2A 60%, #23701A);
    box-shadow: 0 0 3px #3FAE2A;
}

.alive-online__dot:after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 11px;
    height: 11px;
    border: 1px solid #3FAE2A;
    border-radius: 50%;
    opacity: 0;
    animation: alive-pulse 2.4s ease-out infinite;
}

@keyframes alive-pulse {
    0%   { transform: scale(.5); opacity: .9; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* ===== ПРИПИСКА ОТ РУКИ НА ФОТО ===== */
.alive-note {
    position: absolute;
    /* Выше слоя .kl-haunt__layer (1) и текста слайда (2) */
    z-index: 3;
    max-width: 80%;
    color: #7A0E12;
    font-family: 'Caveat', 'Comic Sans MS', cursive;
    font-size: 26px;
    font-weight: 500;
    line-height: 1;
    text-shadow: 0 0 3px rgba(255, 255, 255, .45);
    pointer-events: none;
    opacity: 0;
    /* Исчезает быстро... */
    transition: opacity .4s;
}

.alive-note.is-shown {
    opacity: .92;
    /* ...а проступает медленно */
    transition: opacity .8s ease-in;
}

/* Вариант «простым карандашом» */
.alive-note--pencil {
    color: #3A3A3A;
    text-shadow: 0 0 1px rgba(255, 255, 255, .5);
}

/* ===== ДИАЛОГ «ВЫ ЕЩЕ ЗДЕСЬ?» ===== */
.alive-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Поверх зерна страницы (8990), но ниже эффектов horror.js (9000+) и окон согласия/UAC */
    z-index: 8995;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .25);
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 13px;
    text-align: left;
}

.alive-dialog__window {
    box-sizing: border-box;
    width: 320px;
    max-width: calc(100% - 32px);
    padding: 0 6px 6px;
    background: linear-gradient(#C9DAEE, #AFC6E0);
    border: 1px solid #4B6585;
    border-radius: 6px 6px 4px 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .7);
    color: #000000;
    animation: alive-dialog-in .2s ease-out;
}

@keyframes alive-dialog-in {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: scale(1); }
}

.alive-dialog__title {
    height: 30px;
}

.alive-dialog__body {
    display: flex;
    align-items: center;
    padding: 18px 18px 16px;
    background: #ffffff;
    border: 1px solid #8DA2BD;
    border-bottom: 0;
}

/* Синий кружок с вопросом, как у системных вопросов Windows */
.alive-dialog__icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    margin-right: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #8DC2F5, #2F6FC0 65%, #1E4F91);
    color: #ffffff;
    font: bold 20px/32px Georgia, 'Times New Roman', serif;
    text-align: center;
}

.alive-dialog__text {
    margin: 0;
    color: #1E395B;
    font-size: 15px;
}

.alive-dialog__foot {
    padding: 10px 12px;
    background: #F0F0F0;
    border: 1px solid #8DA2BD;
    border-top: 1px solid #DFDFDF;
    text-align: right;
}

.alive-dialog__btn {
    min-width: 86px;
    margin-left: 6px;
    padding: 4px 14px;
    border: 1px solid #707070;
    border-radius: 3px;
    background: linear-gradient(#F2F2F2, #EBEBEB 50%, #DDDDDD 51%, #CFCFCF);
    color: #000000;
    font: inherit;
    cursor: pointer;
}

.alive-dialog__btn:hover,
.alive-dialog__btn:focus {
    border-color: #3C7FB1;
    background: linear-gradient(#EAF6FD, #D9F0FC 50%, #BEE6FD 51%, #A7D9F5);
    outline: none;
}

/* ===== ТЕЛЕФОН ===== */
@media (max-width: 600px) {
    .alive-toast {
        left: 12px;
        width: calc(100% - 24px);
        max-width: 300px;
    }

    /* В узкой верхней полосе места нет */
    .alive-online {
        display: none;
    }
}

/* ===== БЕЗ АНИМАЦИЙ ===== */
@media (prefers-reduced-motion: reduce) {
    .alive-toast,
    .alive-toast.is-shown {
        transform: none;
        transition: none;
    }

    .alive-note,
    .alive-note.is-shown {
        transition: none;
    }

    .alive-online__dot:after {
        animation: none;
    }

    .alive-dialog__window {
        animation: none;
    }
}
