/* 
   ANIME COMPANION - CHARACTER STYLE v2.2
   Dodano: Wygląd Dziecka, Stan "Szerokie Oczy", Poprawki animacji.
*/

:root {
    /* Domyślne kolory (nadpisywane przez JS) */
    --hair-color: #5d4037;
    --skin-color: #ffdbac;
    --clothes-color: #ffffff;
    --acc-color: #ff4757;
    --eye-color: #a855f7;
    
    /* Skala wielkości biustu (0.5 do 1.5) */
    --bust-size: 1.0;
}

/* KONTENER GŁÓWNY POSTACI */
.anime-girl-css {
    position: relative;
    width: 220px;
    height: 400px; /* Wysokość całkowita */
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: float 4s ease-in-out infinite;
    transform-style: preserve-3d; /* Dla lepszych obrotów */

    /* Zmienne lokalne */
    --local-hair: var(--hair-color);
    --local-skin: var(--skin-color);
    --local-clothes: var(--clothes-color);
}

/* --- WARSTWY CIAŁA --- */

/* WŁOSY Z TYŁU */
.hair-back {
    position: absolute;
    top: 15px;
    left: 5%;
    width: 90%;
    height: 280px;
    background: var(--local-hair);
    border-radius: 60px 60px 30px 30px;
    box-shadow: inset -15px 0 20px rgba(0,0,0,0.2);
    z-index: 1;
}

/* TUŁÓW I UBRANIE */
.body {
    position: absolute;
    bottom: 30px;
    left: 55px;
    width: 110px;
    height: 180px;
    background: var(--local-clothes);
    /* Kształt tułowia */
    border-radius: 40% 40% 30% 30% / 20% 20% 80% 80%;
    z-index: 2;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 -20px 30px rgba(0,0,0,0.1), /* Cień na dole */
        0 5px 15px rgba(0,0,0,0.2);         /* Cień rzucany na tło */
    overflow: hidden; /* Ważne dla pasków i wzorów */
}

/* ANATOMIA (BIUST) */
.body::before, .body::after {
    content: '';
    position: absolute;
    top: 25%;
    /* Rozmiar zależny od zmiennej --bust-size */
    width: calc(45px * var(--bust-size));
    height: calc(40px * var(--bust-size));
    background: inherit; /* Dziedziczy kolor ubrania */
    border-radius: 50%;
    
    /* Cieniowanie 3D */
    box-shadow: 
        inset 0 -10px 15px rgba(0, 0, 0, 0.15), 
        0 4px 8px rgba(0, 0, 0, 0.1);
        
    transition: all 0.3s ease;
    z-index: 3;
}

.body::before { left: 50%; transform: translateX(-95%) rotate(10deg); }
.body::after { right: 50%; transform: translateX(95%) rotate(-10deg); }

/* STYLIZACJA STROJÓW */
.body.has-stripe {
    background: repeating-linear-gradient(
        45deg,
        var(--local-clothes),
        var(--local-clothes) 10px,
        #f0f0f0 10px,
        #f0f0f0 20px
    );
}

.body.outfit-uniform { background: #2d3436; }
.body.outfit-uniform .clothes-detail {
    background: white;
    height: 25px;
    width: 60%;
    left: 20%;
    top: 0;
    position: absolute;
    border-radius: 0 0 10px 10px;
    z-index: 4;
}

.body.outfit-summer {
    background: #ff7675;
    background-image: radial-gradient(circle, #fff 10%, transparent 10%);
    background-size: 20px 20px;
}

/* TWARZ */
.face {
    position: absolute;
    top: 30px;
    left: 50px;
    width: 120px;
    height: 130px;
    background: var(--local-skin);
    border-radius: 50% 50% 48% 48% / 40% 40% 60% 60%;
    z-index: 4;
    box-shadow: 
        inset 0 -10px 15px rgba(255, 183, 197, 0.3),
        0 4px 10px rgba(0,0,0,0.1);
}

/* OCZY */
.eyes {
    display: flex;
    justify-content: space-between;
    margin-top: 55px;
    padding: 0 18px;
    position: relative;
}

.eye {
    width: 30px;
    height: 38px;
    background: white;
    border-radius: 50% 50% 40% 40%;
    position: relative;
    border-top: 3px solid #333;
    border-left: 1px solid rgba(0,0,0,0.1);
    border-right: 1px solid rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.pupil {
    width: 18px;
    height: 24px;
    background: var(--eye-color);
    border-radius: 50%;
    position: absolute;
    bottom: 2px;
    left: 5px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.7);
    transition: transform 0.3s;
}

.pupil::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 3px;
    width: 7px;
    height: 7px;
    background: white;
    border-radius: 50%;
    opacity: 0.9;
}

/* RUMIEŃCE */
.blush-css {
    position: absolute;
    top: 85px;
    left: 15px;
    width: 90px;
    height: 20px;
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.blush-css::before, .blush-css::after {
    content: '';
    width: 25px;
    height: 12px;
    background: radial-gradient(circle, rgba(255,107,129,0.5) 0%, transparent 70%);
    border-radius: 50%;
}

/* USTA */
.mouth {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 5px;
    border-bottom: 2px solid #724e41;
    border-radius: 0 0 10px 10px;
    transition: all 0.2s;
}

/* WŁOSY Z PRZODU */
.hair-front {
    position: absolute;
    top: 10px;
    left: 45px;
    width: 130px;
    height: 70px;
    background: var(--local-hair);
    border-radius: 50px 50px 20px 20px;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* AKCESORIA */
.accessory-slot { display: none; }
.accessory-slot.has-bow {
    display: block;
    position: absolute;
    top: 5px;
    right: 15px;
    width: 40px;
    height: 25px;
    background: var(--acc-color);
    border-radius: 5px;
    z-index: 6;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.accessory-slot.has-bow::before {
    content: '';
    position: absolute;
    left: 15px;
    top: -2px;
    width: 10px;
    height: 30px;
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* --- STAN SZEROKICH OCZU (SHOCK/BIRTH) --- */
.anime-girl-css.wide-eyed .eye {
    height: 42px; /* Bardzo wysokie oczy */
    border-radius: 50%; /* Okrągłe */
    border-top: 1px solid #333; /* Cienka powieka (szok) */
    background: #fff;
}
.anime-girl-css.wide-eyed .pupil {
    transform: scale(0.9); /* Nieco mniejsze źrenice */
    left: 6px;
    bottom: 6px;
}
.anime-girl-css.wide-eyed .mouth {
    width: 8px;
    height: 8px;
    border: 2px solid #724e41;
    border-radius: 50%; /* Małe kółeczko "o" */
    background: #333;
    bottom: 20px;
}

/* --- DZIECKO (BABY) --- */
/* Kontener dziecka - będzie wstawiany przez JS obok głównej postaci */
.baby-css {
    position: absolute;
    bottom: 0;
    right: -70px; /* Po prawej stronie matki */
    width: 60px;
    height: 70px;
    z-index: 4;
    animation: float 3s infinite ease-in-out 1s; /* Lewituje z opóźnieniem */
}

/* Kocyk */
.baby-body {
    width: 100%;
    height: 50px;
    background: #ffffff;
    border-radius: 20px 20px 30px 30px;
    position: absolute;
    bottom: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow: hidden;
}
.baby-body::after { /* Wzorek na kocyku */
    content: '';
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    height: 10px;
    background: var(--secondary);
    opacity: 0.3;
}

/* Głowa dziecka */
.baby-head {
    width: 45px;
    height: 45px;
    background: var(--local-skin); /* Dziedziczy kolor skóry */
    border-radius: 50%;
    position: absolute;
    top: -10px;
    left: 7.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Twarz dziecka */
.baby-eye {
    width: 4px;
    height: 4px;
    background: #333;
    border-radius: 50%;
    position: absolute;
    top: 18px;
}
.baby-eye.left { left: 12px; }
.baby-eye.right { right: 12px; }

.baby-mouth {
    width: 6px;
    height: 4px;
    background: #ffaaaa;
    border-radius: 0 0 50% 50%;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.baby-hair {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    border-left: 2px solid var(--local-hair);
    border-top: 2px solid var(--local-hair);
    border-radius: 50% 0 0 0;
}

/* --- EMOCJE --- */
.anime-girl-css.happy .mouth {
    width: 25px;
    height: 12px;
    border: none;
    background: #ff6b9d;
    border-radius: 0 0 20px 20px;
}
.anime-girl-css.happy .pupil { transform: scale(1.1); }

.anime-girl-css.sad .eye {
    height: 28px;
    margin-top: 10px;
    border-radius: 50% 50% 40% 40%;
    border-top: 5px solid #333;
}
.anime-girl-css.sad .mouth {
    border-bottom: none;
    border-top: 2px solid #724e41;
    border-radius: 10px 10px 0 0;
    bottom: 20px;
    width: 12px;
}

.anime-girl-css.shy .blush-css { opacity: 1; }
.anime-girl-css.shy .mouth {
    width: 8px;
    height: 8px;
    background: #724e41;
    border-radius: 50%;
    border: none;
}

.anime-girl-css.excited .mouth {
    width: 30px;
    height: 15px;
    background: #fab1a0;
    border-radius: 5px 5px 20px 20px;
}
.anime-girl-css.excited { animation: jumpExcited 0.5s infinite alternate; }

@keyframes jumpExcited {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

/* Animacje ogólne */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

.shake-anim { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}

.remote-sprite {
    cursor: default;
    animation: float 5s ease-in-out infinite reverse;
}