/* hahmo VASEN LAITA */
#external-character {
    position: fixed;
    left: 40px; /* Muutettu right -> left */
    bottom: -8px;
    width: 140px;
    z-index: 99999;
    transform: translateY(100%);
    opacity: 0;
    transition: transform .6s ease, opacity .4s;
    cursor: pointer;
    display: block;
}

#external-character.is-visible {
    transform: translateY(0);
    opacity: 1;
}

#external-character.is-hidden {
    display: none !important;
}

/* kuva */
#external-character img {
    width: 100%;
    animation: knock-antti 2s infinite 3s;
    transform-origin: bottom center;
}

@keyframes knock-antti {
    0%,100% { transform: rotate(0); }
    20% { transform: rotate(-3deg); }
    40% { transform: rotate(3deg); }
}

/* sulje-nappi (Hahmon päällä) */
#external-close {
    position: absolute;
    top: -94px;
    right: -29px;
    background: #000;
    color: #fff;
    border-radius: 50%;
    width: 23px;
    height: 23px;
    font-size: 22px;
    line-height: 21px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
}

/* puhekupla */
#external-bubble {
   position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    background: #fff;
    padding: 10px 14px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    /* white-space: nowrap; */
    pointer-events: auto;
    cursor: pointer;
    width: 200px;
    height: auto;
    text-align: center;
}

#external-character.is-visible #external-bubble {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px) scale(1);
}

/* PALAUTUSPAINIKE (Vasen laita & musta reunus) */
#antti-restore {
    display: none;
    position: fixed;
    left: 40px;   /* Muutettu right -> left */
    bottom: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff; /* Valkoinen tausta */
    border: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    font-size: 22px;
    cursor: pointer;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

#antti-restore.is-visible {
    display: flex;
    animation: fadeInAntti 0.4s ease forwards;
}

#antti-restore:hover {
    transform: scale(1.1);
}

@keyframes fadeInAntti {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* Mobiiliasettelut */
@media (max-width: 450px) {
    #external-character { 
        width: 95px !important;
        left: 2px !important;
        height: auto !important;
        bottom: -5px !important;
    }
    #external-close { 
        right: -50px !important;
        top: -83px !important;
    }
    #antti-restore { 
        left: 16px !important;  /* Muutettu right -> left */
        right: auto !important;
        bottom: 16px !important; 
    }
    #external-bubble {
        width: 150px !important;
        font-size: 12px !important;
        left: 0 !important;
        transform: translateY(-10px) !important;
    }
}