* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #05070d;
    font-family: Arial, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

#game {
    width: 100%;
    max-width: 1100px;
    height: 100vh;
    max-height: 850px;
    position: relative;
    overflow: hidden;
    background: #111;
}

/* ================= TOP UI ================= */

.top-ui {
    height: 90px;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 50;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 18px;

    background:
        linear-gradient(
            rgba(4, 7, 15, .96),
            rgba(4, 7, 15, .72)
        );
}

.fighter-box {
    width: 39%;
}

.name {
    color: white;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.enemy-box {
    text-align: right;
}

.health-bg,
.rage-bg {
    height: 18px;
    border: 2px solid #eee;
    background: #222;
    overflow: hidden;
}

.health {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        #13d66e,
        #b8ff48
    );
    transition: width .15s;
}

.enemy-box .health {
    float: right;
}

.rage-bg {
    height: 6px;
    margin-top: 5px;
    border: 0;
}

.rage {
    height: 100%;
    width: 0%;
    background: #ffb000;
    transition: width .15s;
}

.round-info {
    width: 100px;
    text-align: center;
    color: white;
}

#roundText {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
}

#timer {
    font-size: 30px;
    font-weight: 900;
}

/* ================= ARENA ================= */

#arena {
    position: absolute;
    top: 90px;
    left: 0;
    right: 0;
    bottom: 150px;

    overflow: hidden;

    background:
        linear-gradient(
            #16223e 0%,
            #364d70 48%,
            #d58b52 49%,
            #6e3c25 72%,
            #251713 100%
        );
}

/* SUN */

.sun {
    position: absolute;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: #ffd56a;
    right: 15%;
    top: 13%;
    box-shadow: 0 0 80px #ffae44;
}

/* MOUNTAINS */

.mountain {
    position: absolute;
    bottom: 30%;
    width: 0;
    height: 0;
    border-left: 180px solid transparent;
    border-right: 180px solid transparent;
    border-bottom: 240px solid #26334c;
}

.mountain1 {
    left: 5%;
}

.mountain2 {
    right: 2%;
    border-left-width: 230px;
    border-right-width: 230px;
    border-bottom-width: 300px;
}

/* BUILDINGS */

.building {
    position: absolute;
    bottom: 31%;
    width: 80px;
    background: #182030;
}

.b1 {
    left: 20%;
    height: 130px;
}

.b2 {
    left: 35%;
    height: 170px;
    width: 110px;
}

.b3 {
    right: 20%;
    height: 145px;
    width: 90px;
}

.building::after {
    content: "";
    position: absolute;
    inset: 15px;
    background:
        repeating-linear-gradient(
            0deg,
            #e9bb5d 0 8px,
            transparent 8px 25px
        );
    opacity: .35;
}

/* ================= FIGHTERS ================= */

.fighter {
    position: absolute;
    width: 90px;
    height: 190px;

    bottom: 15%;

    transition:
        left .08s linear,
        transform .08s linear;
}

.player {
    left: 25%;
}

.enemy {
    left: 67%;
    transform: scaleX(-1);
}

/* SHADOW */

.shadow {
    position: absolute;
    bottom: 0;
    left: 5px;

    width: 90px;
    height: 18px;

    border-radius: 50%;
    background: rgba(0,0,0,.5);
    filter: blur(4px);
}

/* HEAD */

.head {
    position: absolute;

    width: 48px;
    height: 48px;

    top: 5px;
    left: 21px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 35% 35%,
            #ffd3a0,
            #bd7045
        );

    border: 3px solid #161616;
}

.head::after {
    content: "";

    position: absolute;

    width: 52px;
    height: 18px;

    left: -5px;
    top: -5px;

    border-radius: 50% 50% 0 0;

    background: #151923;
}

/* BODY */

.body {
    position: absolute;

    width: 62px;
    height: 78px;

    top: 50px;
    left: 14px;

    border-radius: 18px 18px 10px 10px;

    background:
        linear-gradient(
            90deg,
            #db2438,
            #67121e
        );

    border: 3px solid #171717;
}

/* PLAYER DIFFERENCE */

.player .body {
    background:
        linear-gradient(
            90deg,
            #22b8ff,
            #123f88
        );
}

/* ARMS */

.arm {
    position: absolute;

    width: 20px;
    height: 72px;

    top: 54px;

    border-radius: 15px;

    background: #bf7149;

    border: 3px solid #171717;

    transform-origin: top center;
}

.arm1 {
    left: 4px;
    transform: rotate(30deg);
}

.arm2 {
    right: 4px;
    transform: rotate(-30deg);
}

/* LEGS */

.leg {
    position: absolute;

    width: 23px;
    height: 75px;

    top: 120px;

    border-radius: 12px;

    background: #20242c;

    border: 3px solid #111;

    transform-origin: top center;
}

.leg1 {
    left: 19px;
    transform: rotate(5deg);
}

.leg2 {
    right: 19px;
    transform: rotate(-5deg);
}

/* ================= ATTACK ANIMATION ================= */

.fighter.punching .arm1 {
    transform: rotate(80deg) translateY(8px);
}

.fighter.kicking .leg1 {
    transform: rotate(70deg);
}

.fighter.specialing {
    filter:
        drop-shadow(0 0 12px #ffbf00)
        drop-shadow(0 0 25px #ff4d00);
}

.fighter.hit {
    animation: hitShake .18s linear;
}

@keyframes hitShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-7px); }
    100% { transform: translateX(0); }
}

/* ================= HIT EFFECT ================= */

#hitEffect {
    position: absolute;

    width: 100px;
    height: 100px;

    border-radius: 50%;

    pointer-events: none;

    opacity: 0;
}

#hitEffect.show {
    animation: hitFlash .3s ease-out;
}

@keyframes hitFlash {
    0% {
        opacity: 1;
        transform: scale(.3);
        box-shadow:
            0 0 10px #fff,
            0 0 30px #ffdf00,
            0 0 70px #ff4400;
    }

    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

/* ================= MESSAGE ================= */

#message {
    position: absolute;

    top: 35%;
    left: 50%;

    transform: translate(-50%, -50%);

    color: white;

    font-size: 50px;
    font-weight: 1000;

    font-style: italic;

    text-shadow:
        4px 4px 0 #000,
        0 0 20px #ff3b3b;

    opacity: 0;
    pointer-events: none;
}

#message.show {
    animation: messagePop .7s ease-out;
}

@keyframes messagePop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(.4);
    }

    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ================= CONTROLS ================= */

.controls {
    position: absolute;

    bottom: 0;
    left: 0;

    width: 100%;
    height: 150px;

    display: flex;

    justify-content: space-between;
    align-items: center;

    padding: 18px 25px;

    background:
        linear-gradient(
            #111722,
            #080b11
        );

    z-index: 60;
}

.movement {
    display: flex;
    gap: 15px;
}

.attacks {
    display: flex;
    gap: 10px;
}

.control {
    border: 2px solid rgba(255,255,255,.25);

    color: white;

    background:
        linear-gradient(
            #353c4b,
            #151a23
        );

    border-radius: 16px;

    box-shadow:
        inset 0 1px rgba(255,255,255,.2),
        0 5px 12px rgba(0,0,0,.5);

    touch-action: manipulation;

    cursor: pointer;

    font-weight: 900;
}

.control:active {
    transform: scale(.9);
    background: #59657a;
}

.move {
    width: 70px;
    height: 70px;
    font-size: 28px;
}

.attacks .control {
    width: 82px;
    height: 72px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 4px;

    font-size: 25px;
}

.attacks span {
    font-size: 9px;
    letter-spacing: .5px;
}

.special {
    border-color: #ffb000;
    box-shadow:
        0 0 12px rgba(255,170,0,.35);
}

.block {
    border-color: #35aaff;
}

/* ================= GAME OVER ================= */

.overlay {
    position: absolute;

    inset: 0;

    z-index: 100;

    background: rgba(0,0,0,.75);

    display: flex;

    align-items: center;
    justify-content: center;
}

.hidden {
    display: none;
}

.result-card {
    width: min(90%, 400px);

    padding: 40px 25px;

    text-align: center;

    border-radius: 25px;

    background:
        linear-gradient(
            145deg,
            #242a38,
            #0d1119
        );

    border: 2px solid #777;

    box-shadow:
        0 20px 60px #000;
}

.result-card h1 {
    color: #ffcc45;

    font-size: 58px;

    font-style: italic;
}

.result-card p {
    color: white;

    font-size: 22px;

    margin: 10px 0 25px;
}

#restartBtn {
    border: 0;

    padding: 15px 30px;

    border-radius: 12px;

    background: #e82b42;

    color: white;

    font-weight: 900;

    font-size: 15px;

    cursor: pointer;
}

/* ================= MOBILE ================= */

@media (max-width: 700px) {

    #game {
        max-height: none;
    }

    .top-ui {
        height: 75px;
        padding: 8px 10px;
    }

    .round-info {
        width: 65px;
    }

    #timer {
        font-size: 24px;
    }

    #arena {
        top: 75px;
        bottom: 135px;
    }

    .controls {
        height: 135px;
        padding: 10px;
    }

    .movement {
        gap: 7px;
    }

    .move {
        width: 58px;
        height: 58px;
    }

    .attacks {
        gap: 5px;
    }

    .attacks .control {
        width: 64px;
        height: 62px;
        font-size: 20px;
    }

    .fighter {
        transform: scale(.8);
        transform-origin: bottom center;
    }

    .enemy {
        transform: scaleX(-1) scale(.8);
    }

    .sun {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 420px) {

    .name {
        font-size: 11px;
    }

    .health-bg {
        height: 14px;
    }

    .attacks .control {
        width: 57px;
        height: 58px;
    }

    .attacks span {
        font-size: 7px;
    }

    .move {
        width: 52px;
        height: 52px;
    }
}
