body {
    max-width: 600px;
    margin: 0 auto;
}

#battleArea {
    position: relative;

    display: block;
    overflow: hidden;

    width: auto;
    height: 600px;

    background-image: url('../images/battleBackground.jpg');
    background-position: right bottom ;
}

.unit {
    position: absolute;
    z-index: 1;

    width: 80px;
    height: 80px;
    margin: 8px;

    -webkit-animation-name: none;
         -o-animation-name: none;
            animation-name: none;
    text-align: center;

    border-radius: 50%;
}

.unit::before {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;

    position: absolute;
    z-index: 22;
    top: 0;
    left: 50%;

    display: block;

    padding: 2px 7px;

    content: attr(data-message);
    transition: all 100ms ease-out;
    transform: translateX(-50%);
    white-space: nowrap;

    opacity: 0;
    border-radius: 20px;
    background-color: rgba(238, 238, 236, .85);
    box-shadow: 0 0 5px 5px rgba(238, 238, 236, .85);
}

.unit.showMessage::before {
    -webkit-animation: popup linear;
    -o-animation: popup linear;
    animation: popup linear;
    animation-duration: inherit;
}


.unit[data-message-status='hit']::before {
    color: red;
        background-color: #222;
    box-shadow: 0 0 5px 5px #222;
}

.unit[data-message-status='critical']::before {
    color: #cc1;
    background-color: #248;
    box-shadow: 0 0 5px 5px #248;
}
.unit[data-message-status='say']::before {
     white-space: normal;
}

.unit::after {
    position: absolute;
    z-index: -3;
    right: 38%;
    bottom: 0;

    display: inline-block;

    width: 30%;
    height: 3px;

    content: '';

    border-radius: 50%;
    background-color: rgba(10, 10, 10, .7);
    -webkit-box-shadow: 0 0 10px 6px rgba(10, 10, 10, .7);
            box-shadow: 0 0 10px 6px rgba(10, 10, 10, .7);
}

.unit.active {
    -webkit-animation: shine .4s ease-in infinite alternate;
         -o-animation: shine .4s ease-in infinite alternate;
            animation: shine .4s ease-in infinite alternate;

    background-color: rgba(234, 220, 70, .9);
    box-shadow: 0 8px 10px 10px rgba(234, 220, 70, .9);
}

.unit.selected {
    box-shadow: 0 0 2px 3px #3f2;
}

.unit:hover {
    box-shadow: 0 0 2px 3px #f32;
}


.unit.blink .img {
    -webkit-animation: blink 130ms linear 0s 3;
         -o-animation: blink 130ms linear 0s 3;
            animation: blink 130ms linear 0s 3;
    animation-iteration-count: 5;
}

.img {
    position: relative;

    display: inline-block;

    width: 100%;
    height: 100%;

    transition: transform .15s ease-out;

    background-repeat: no-repeat;
    background-position: bottom;
    -webkit-background-size: contain;
            background-size: contain;
}

.img::after {
    position: absolute;
    top: 15%;

    display: none;

    width: 30px;
    height: 60px;

    content: '';
    transform-origin: 0 100%;

    background-repeat: no-repeat;
    background-position: center;
    -webkit-background-size: contain;
            background-size: contain;
}

.player .img::after {
    right: 0;

    background-image: url('../images/simpleSword.png');
}

.enemy .img::after {
    width: 20px;
    height: 50px;

    background-image: url('../images/rubyShortSword.png');
}

.attack .img::after {
    display: block;

    -webkit-animation: attackSword 300ms ease-in 0s;
         -o-animation: attackSword 300ms ease-in 0s;
            animation: attackSword 300ms ease-in 0s;
}
.enemy.attack .img::after {
    -webkit-animation: inverseAttackSword 300ms ease-in 0s;
         -o-animation: inverseAttackSword 300ms ease-in 0s;
            animation: inverseAttackSword 300ms ease-in 0s;
}

.unit[state='dead'] .img {
    transform: rotate(90deg) translateX(30%);
    -webkit-animation-name: none;
         -o-animation-name: none;
            animation-name: none;
}


.hpBar {
    position: absolute;
    top: -20px;
    left: -5px;

    display: inline-block;

    width: 100%;
    padding: 0 5px;

    cursor: default;
    -webkit-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;

    background-image: linear-gradient(270deg, #5d5 50%, #c55 0%);
    -webkit-background-size: 200%;
            background-size: 200%;
}

.unit[state='dead'] .hpBar {
    visibility: hidden;
}

#enemies {
    position: absolute;
    right: 5px;
    bottom: 0;
}

.enemy {
    font-size: .8em;

    width: 70px;
    height: 70px;
}

.player {
    z-index: 10;
}

.fiat {
    background-image: url(../images/Enemyfiat.png);
}

.Hero {
    background-image: url(../images/player.png);
}

@keyframes fly {
    0% {
        bottom: 0;
    }
    100% {
        bottom: 4px;
    }
}

@keyframes shine {
    100% {
        background-color: rgba(44, 170, 180, .1);
        box-shadow: 0 16px 10px 10px rgba(44, 170, 180, .1);
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@keyframes attackSword {
    50% {
        transform: rotate(90deg);
    }
}

@keyframes inverseAttackSword {
    50% {
        transform: rotate(-90deg);
    }
}

@keyframes popup {
    0% {
        top: -20px; 

        opacity: 0;
    }
    20% {
        top: -40px; 

        opacity: 1;
    }
    75% {
        top: -65px;
        opacity: 1;
    }
    100% {
        top: -73px;
        opacity: 0;
    }
}
