/* STYLIZACJA POSTACI GENEROWANEJ KODEM (CSS ART) */

/* 
  Definicje domyślnych kolorów. 
  JS będzie je nadpisywać per postać (dla lokalnego gracza i zdalnych).
*/
:root {
    --hair-color: #5d4037;   /* Brązowy domyślny */
    --skin-color: #ffdbac;   /* Jasna skóra domyślna */
    --clothes-color: #ffffff; /* Biała koszula domyślna */
    --acc-color: #ff4757;     /* Kolor akcesoriów (kokardka) */
}

/* KONTENER GŁÓWNY POSTACI */
/* Używamy stylu inline w HTML dla zmiennych per instancja */
.anime-girl-css {
    position: relative;
    width: 200px;
    height: 350px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: float 4s ease-in-out infinite;
    
    /* Zmienne lokalne dla tej konkretnej instancji */
    --local-hair: var(--hair-color);
    --local-skin: var(--skin-color);
    --local-clothes: var(--clothes-color);
    --local-acc: var(--acc-color);
}

/* WŁOSY Z TYŁU */
.hair-back {
    position: absolute;
    top: 20px;
    left: 10px;
    width: 180px;
    height: 250px;
    background: var(--local-hair);
    border-radius: 50px 50px 20px 20px;
    z-index: 1;
    transition: background-color 0.3s;
}

/* CIAŁO (Ubranie) */
.body {
    position: absolute;
    bottom: 20px;
    left: 50px;
    width: 100px;
    height: 150px;
    background: var(--local-clothes);
    border-radius: 30px 30px 10px 10px;
    border: 2px solid rgba(0,0,0,0.1);
    z-index: 2;
    transition: background-color 0.3s;
    overflow: hidden; /* Aby wzory nie wystawały */
}

/* Detal ubrania (np. pasek lub wzór) - domyślnie ukryty, chyba że kupiony */
.clothes-detail {
    position: absolute;
    top: 40px;
    left: 0;
    width: 100%;
    height: 20px;
    background: rgba(0,0,0,0.1);
    display: none; /* JS włączy to klasą .has-stripe */
}
.body.has-stripe .clothes-detail { display: block; }

/* TWARZ */
.face {
    position: absolute;
    top: 40px;
    left: 45px;
    width: 110px;
    height: 120px;
    background: var(--local-skin);
    border-radius: 50% 50% 45% 45%;
    z-index: 4;
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.05);
    transition: background-color 0.3s;
}

/* OCZY */
.eyes {
    display: flex;
    justify-content: space-around;
    margin-top: 45px;
    padding: 0 15px;
}

.eye {
    width: 22px;
    height: 28px;
    background: white;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 2px solid #333;
}

.pupil {
    width: 12px;
    height: 16px;
    background: #a855f7; /* Domyślny fiolet */
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 3px;
    transition: 0.3s;
}

/* RUMIEŃCE */
.blush-css {
    position: absolute;
    top: 75px;
    left: 10px;
    width: 90px;
    height: 15px;
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.blush-css::before, .blush-css::after {
    content: '';
    width: 20px;
    height: 10px;
    background: rgba(255, 107, 129, 0.4);
    border-radius: 50%;
}

/* USTA */
.mouth {
    position: absolute;
    bottom: 20px;
    left: 45px;
    width: 20px;
    height: 10px;
    border-bottom: 3px solid #724e41;
    border-radius: 50%;
    transition: 0.3s;
}

/* WŁOSY Z PRZODU (GRZYWKA) */
.hair-front {
    position: absolute;
    top: 15px;
    left: 35px;
    width: 130px;
    height: 60px;
    background: var(--local-hair);
    border-radius: 40px 40px 10px 10px;
    z-index: 5;
    transition: background-color 0.3s;
}

/* AKCESORIA (KOKARDKA) */
.accessory-slot {
    position: absolute;
    top: -10px;
    right: 10px;
    display: none; /* Domyślnie brak */
}

/* Styl kokardki */
.accessory-slot.has-bow {
    display: block;
    width: 40px;
    height: 20px;
    background: var(--local-acc);
    border-radius: 50%;
}
.accessory-slot.has-bow::before,
.accessory-slot.has-bow::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 30px;
    background: var(--local-acc);
    border-radius: 20px;
    z-index: -1;
}
.accessory-slot.has-bow::before { transform: rotate(-30deg); left: -5px; }
.accessory-slot.has-bow::after { transform: rotate(30deg); right: -5px; }


/* --- EMOCJE W CSS --- */

/* Szczęśliwa */
.anime-girl-css.happy .mouth {
    height: 15px;
    width: 30px;
    left: 40px;
    background: #ff6b9d;
    border-radius: 0 0 50px 50px;
    border: none;
}

/* Zawstydzona (Blush) */
.anime-girl-css.shy .blush-css {
    opacity: 1;
}

/* Podekscytowana (gwiazdki) */
.anime-girl-css.excited .pupil {
    background: #ffd700;
    transform: scale(1.2);
    box-shadow: 0 0 5px #ffd700;
}
.anime-girl-css.excited .mouth {
    height: 20px;
    width: 30px;
    left: 40px;
    background: #444;
    border-radius: 50% 50% 50% 50% / 10% 10% 90% 90%;
    border: none;
}

/* Smutna */
.anime-girl-css.sad .mouth {
    height: 5px;
    width: 20px;
    border-bottom: none;
    border-top: 3px solid #724e41;
    border-radius: 50% 50% 0 0;
    bottom: 15px;
}
.anime-girl-css.sad .pupil {
    top: 8px; /* Patrzy w dół */
}

/* --- ANIMACJE BAZOWE --- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.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); }
}

/* Dymek dialogowy */
.speech-bubble {
    position: absolute;
    top: -110px; /* Wyżej, bo dodaliśmy alert prezentu */
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #333;
    padding: 12px 15px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: none;
    min-width: 140px;
    max-width: 200px;
    z-index: 100;
    text-align: center;
    font-size: 0.85rem;
    pointer-events: none;
}

/* Strzałka dymku */
.bubble-tail {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}