/* --ga-player-size is set from JS (screen width) — this is the fallback. */
.game-animation {
    --ga-player-size: 50px;
    background-image: url("../../assets/football-field-horizontal.jpg");
    background-size: cover;
    background-position: 50% 50%;
    aspect-ratio: 2 / 1;
    width: calc(100% + 2rem);
    margin: 0 -1rem 2rem;
    position: relative;
}

.game-animation .player {
    position: absolute;
    color: rgb(var(--app-white-rgb));
    font-size: max(9px, calc(var(--ga-player-size) * 0.2));
    letter-spacing: -0.5px;
    width: var(--ga-player-size);
    text-shadow: 1px 1px 2px black;
    white-space: nowrap;
    transition: top 0.5s ease-in-out, left 1s ease-in-out, right 1s ease-in-out;
    top: 50%;
    left: 25%;
    text-align: center;
}

.game-animation .play-button {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 5;
    border: solid 2px white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    padding-left: 3px;
}

.game-animation .play-button:hover {
    transform: scale(1.1);
    cursor: pointer;
}

.game-animation .away {
    left: initial;
    right: 25%;
}

.game-animation .player .player-image {
    position: absolute;
    float: none;
    /* Image height is size * 234/224, so lift it by just over its own height. */
    top: calc(var(--ga-player-size) * -1.045);
    left: 50%;
    transform: translateX(calc(var(--ga-player-size) / -2));
}

.game-animation .ball {
    position: absolute;
    z-index: 4;
    top: 0;
    left: 0;
    width: var(--ga-player-size);
    height: calc(var(--ga-player-size) * 0.4);
    transition: left 0.5s ease-out, top 0.5s ease-out, right 0.5s ease-out;
    display: flex;
}

.game-animation .ball img {
    width: calc(var(--ga-player-size) * 0.4);
    height: calc(var(--ga-player-size) * 0.4);
    display: block;
    margin: auto;
}

.game-animation .timer {
    position: absolute;
    z-index: 4;
    bottom: 2rem;
    left: 2rem;
    width: 34px;
    height: 20px;
    color: rgb(var(--app-white-rgb));
    font-size: 20px;
}

.game-animation .message {
    position: absolute;
    top: 4rem;
    color: rgb(var(--app-white-rgb));
    left: calc(50% - 175px);
    width: 350px;
    text-align: center;
    font-size: 40px;
}

/** PLAYER POSITIONS */

.game-animation .home.GK {
    top: 50%;
    left: 1%;
    transition: none;
}

.game-animation .home.LD {
    top: 15%;
    left: 11%;
}

.game-animation .home.CD {
    top: 50%;
    left: 11%;
}

.game-animation .home.RD {
    top: 89%;
    left: 11%;
}

.game-animation .home.CM {
    top: 50%;
    left: 27%;
}

.game-animation .home.LM {
    top: 15%;
    left: 27%;
}

.game-animation .home.RM {
    top: 89%;
    left: 27%;
}

.game-animation .home.DM {
    top: 50%;
    left: 21%;
}

.game-animation .home.OM {
    top: 50%;
    left: 30%;
}

.game-animation .home.CA {
    top: 50%;
    left: 40%;
}

.game-animation .home.RA {
    top: 84%;
    left: 40%;
}

.game-animation .home.LA {
    top: 20%;
    left: 40%;
}

.game-animation .away.GK {
    top: 50%;
    right: 1%;
    transition: none;
}

.game-animation .away.LD {
    top: 89%;
    right: 11%;
}

.game-animation .away.CD {
    top: 50%;
    right: 11%;
}

.game-animation .away.RD {
    top: 15%;
    right: 11%;
}

.game-animation .away.CM {
    top: 50%;
    right: 27%;
}

.game-animation .away.LM {
    top: 89%;
    right: 27%;
}

.game-animation .away.RM {
    top: 15%;
    right: 27%;
}

.game-animation .away.DM {
    top: 50%;
    right: 21%;
}

.game-animation .away.OM {
    top: 50%;
    right: 30%;
}

.game-animation .away.CA {
    top: 50%;
    right: 40%;
}

.game-animation .away.RA {
    top: 20%;
    right: 40%;
}

.game-animation .away.LA {
    top: 84%;
    right: 40%;
}

/** PLAYER POSITIONS WHEN PLAYING ANIMATION */

.game-animation.play .home.LD {
    left: 11%;
}

.game-animation.play .home.CD {
    left: 11%;
}

.game-animation.play .home.RD {
    left: 11%;
}

.game-animation.play .home.CM {
    left: 43%;
}

.game-animation.play .home.LM {
    left: 43%;
}

.game-animation.play .home.RM {
    left: 43%;
}

.game-animation.play .home.DM {
    left: 25%;
}

.game-animation.play .home.OM {
    left: 60%;
}

.game-animation.play .home.CA {
    left: 75%;
}

.game-animation.play .home.RA {
    left: 75%;
}

.game-animation.play .home.LA {
    left: 75%;
}


.game-animation.play .away.LD {
    right: 11%;
}

.game-animation.play .away.CD {
    right: 11%;
}

.game-animation.play .away.RD {
    right: 11%;
}

.game-animation.play .away.CM {
    right: 43%;
}

.game-animation.play .away.LM {
    right: 43%;
}

.game-animation.play .away.RM {
    right: 43%;
}

.game-animation.play .away.DM {
    right: 25%;
}

.game-animation.play .away.OM {
    right: 60%;
}

.game-animation.play .away.CA {
    right: 75%;
}

.game-animation.play .away.RA {
    right: 75%;
}

.game-animation.play .away.LA {
    right: 75%;
}
