* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #0d2b49;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: black;
    overflow: hidden;
    position: relative;

}

.background {
    width: 550px;
    height: 100%;
    position: relative;
    background-color: red;
    overflow: hidden;
}

.background .bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header {
    position: absolute;
    top: 5%;
    left: 0;
    width: 100%;
    max-width: 500px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.header img {
    width: 100%;
    height: 100%;

    margin-left: 25%;
    max-width: 300px;
    object-fit: cover;
}

.title {
    position: absolute;
    top: 12%;
    left: 0;
    width: 100%;
    max-width: 500px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.title-img {
    position: absolute;
    z-index: 4;
    left: 10%;
    max-width: 450px;
}

.title-gif {
    position: absolute;
    z-index: 5;
    margin-top: 5%;
    left: 67%;
    max-width: 80px;
}

.content {
    position: absolute;
    z-index: 3;
    top: 23%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 400px;
    animation: content-glide 3.2s ease-in-out infinite alternate;
}

.rope {
    position: absolute;
    z-index: 3;
    /* top: 15%; */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 50px;
}

.ball-content {
    position: absolute;
    z-index: 20;
    top: 27%;
    /* margin-top: 44%; */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 50px;
    /* transition: top 0.6s ease, margin-top 0.6s ease, left 0.6s ease; */
    animation: content-glide 3.2s ease-in-out infinite alternate;
    --drop-left: 50%;
}

.ball-content img {
    max-width: 50px;
}

.dropping .ball-content {
    animation: ball-drop 0.9s ease-in forwards;
    left: var(--drop-left);
}

@keyframes content-glide {
    0% {
        transform: translate(-50%, -50%) translateX(-190px);
    }

    50% {
        transform: translate(-50%, -50%) translateX(190px);
    }

    100% {
        transform: translate(-50%, -50%) translateX(-190px);
    }
}

.middle-content {
    position: absolute;
    z-index: 3;
    top: 33%;
    left: 18%;
    width: 100%;
    max-width: 550px;
    height: 350px;
}

.stone1,
.stone2,
.stone3,
.stone4 {
    position: absolute;
    display: block;
}

.stone1 {
    width: 70px;
    top: -10px;
    left: -50px;
}

.stone2 {
    width: 170px;
    top: 90px;
    left: 250px;
}

.stone3 {
    width: 170px;
    top: 190px;
    left: -50px;
}

.stone4 {
    width: 150px;
    top: 280px;
    left: 250px;
}

.stone1,
.stone3 {
    animation: stone-left-right 2s ease-in-out infinite alternate;
}

.stone2,
.stone4 {
    animation: stone-right-left 2s ease-in-out infinite alternate;
}

@keyframes stone-left-right {
    from {
        transform: translateX(-100px);
    }

    to {
        transform: translateX(230px);
    }
}

@keyframes stone-right-left {
    from {
        transform: translateX(200px);
    }

    to {
        transform: translateX(-200px);
    }
}

.dropping .content,
.stopped .content {
    animation: none;
    transform: translate(-50%, -50%);
}

.dropping .stone1,
.dropping .stone2,
.dropping .stone3,
.dropping .stone4,
.stopped .stone1,
.stopped .stone2,
.stopped .stone3,
.stopped .stone4 {
    animation: none;
    transform: none;
}

.stopped .ball-content,
.show-overlay .ball-content {
    top: 73%;
    margin-top: 0;
    left: var(--drop-left);
    transform: translate(-50%, -50%);
    animation: none;
}

@keyframes ball-drop {
    0% {
        top: 37%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    100% {
        top: 74%;
        margin-top: 0;
        left: var(--drop-left);
        transform: translate(-50%, -50%);
    }
}

.bg-stone {
    position: absolute;
    z-index: 3;
    top: 75%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
}

.bg-stone img {
    max-width: 450px;
}

.gift-item {
    position: absolute;
    z-index: 3;
    top: 77%;
    left: 50%;
    width: 100%;
    max-width: 500px;
    gap: 10px;
    display: flex;
    transform: translateX(-50%);
    justify-content: center;
}

.gift-item img {
    max-width: 66px;
}

.pointer {
    position: absolute;
    z-index: 3;
    top: 75%;
    left: var(--pointer-left, 50%);
    width: 100%;
    max-width: 500px;
    transform: translateX(-50%);
    --pointer-left: 50%;
    transition: left 0.35s ease;
}

.pointer img {
    max-width: 50px;
}

.btnplay {
    position: absolute;
    z-index: 3;
    top: 90%;
    left: 50%;
    width: 100%;
    max-width: 500px;
    cursor: pointer;
    transform: translateX(-50%);
}

.btnplay img {
    max-width: 200px;
}

.ball-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 950;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.show-overlay .ball-overlay {
    opacity: 1;
    pointer-events: auto;
}

.lose-message-popup,
.win-message-popup {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lose-message-popup-content,
.win-message-popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.lose-message-popup img,
.win-message-popup img {
    max-width: 320px;
    width: 100%;
}

.show-lose .lose-message-popup,
.show-win .win-message-popup {
    opacity: 1;
    pointer-events: auto;
}

.btn-try,
.btn-claim {
    max-width: 100px;
    width: 100%;
    cursor: pointer;
}

@media (max-width: 768px) {
    .background {
        width: 100%;
    }

    .header img {
        margin-left: 50%;
        width: 50%;
    }

    .title-img {
        left: 20%;
        transform: translateX(-50%, -50%);
        max-width: 600px;
    }

    .title-gif {
        left: 96%;
        max-width: 100px;
    }

    .content {
        top: 25%;
        max-width: 320px;
    }

    .ball-content {
        top: 30%;
        max-width: 44px;
    }

    .ball-content img {
        max-width: 44px;
    }

    .gift-item img {
        max-width: 60px;
    }

    .bg-stone img {
        max-width: 420px;
    }

    .middle-content {
        position: absolute;
        z-index: 3;
        top: 34%;
        left: 20%;
        width: 100%;
        max-width: 550px;

    }

    @keyframes stone-left-right {
        from {
            transform: translateX(-100px);
        }

        to {
            transform: translateX(230px);
        }
    }

    @keyframes stone-right-left {
        from {
            transform: translateX(200px);
        }

        to {
            transform: translateX(-400px);
        }
    }

    .header img {
        margin-left: 50%;
        width: 50%;
    }

    .stone1 {
        width: 70px;
        top: -10px;
        left: -50px;
    }

    .stone2 {
        width: 170px;
        top: 90px;
        left: 350px;
    }

    .stone3 {
        width: 170px;
        top: 190px;
        left: -50px;
    }

    .stone4 {
        width: 150px;
        top: 280px;
        left: 350px;
    }

}

@media (max-width: 450px) {
    .container {
        height: 100vh;
    }

    .title {
        top: 10%;
    }

    .title-img {

        left: 0%;
        max-width: 450px;
    }

    .title-gif {
        left: 60%;
        max-width: 48px;
    }

    .content {
        top: 20%;
        max-width: 290px;
    }

    .rope {
        max-width: 35px;
    }

    .ball-content {
        top: 25%;
        left: 49%;
        max-width: 35px;
    }

    .ball-content img {
        max-width: 40px;
    }

    .pointer img {
        max-width: 42px;
    }

    .gift-item {
        gap: 8px;
    }

    .gift-item img {
        max-width: 56px;
    }

    .btnplay img {
        max-width: 170px;
    }

    .middle-content {
        position: absolute;
        z-index: 3;
        top: 30%;
        left: 20%;
        width: 100%;
        max-width: 550px;

    }

    @keyframes stone-left-right {
        from {
            transform: translateX(-100px);
        }

        to {
            transform: translateX(130px);
        }
    }

    @keyframes stone-right-left {
        from {
            transform: translateX(100px);
        }

        to {
            transform: translateX(-400px);
        }
    }

    .header img {
        margin-left: 35%;
        width: 40%;
    }

    .stone1 {
        width: 70px;
        top: -10px;
        left: -70px;
    }

    .stone2 {
        width: 170px;
        top: 90px;
        left: 250px;
    }

    .stone3 {
        width: 170px;
        top: 190px;
        left: -70px;
    }

    .stone4 {
        width: 150px;
        top: 280px;
        left: 250px;
    }
}

@media (max-width: 430px) {

    .title-img {
        left: 2%;
        max-width: 400px;
    }

    .title-gif {
        left:60%;
        max-width: 55px;
    }

    .content {
        max-width: 220px;
    }

    .bg-stone img {
        max-width: 360px;
    }

    .gift-item {
        gap: 6px;
    }

    .gift-item img {
        max-width: 52px;
    }

    .middle-content {
        position: absolute;
        z-index: 3;
        top: 30%;
        left: 20%;
        width: 100%;
        max-width: 550px;

    }

    @keyframes stone-left-right {
        from {
            transform: translateX(-100px);
        }

        to {
            transform: translateX(300px);
        }
    }

    @keyframes stone-right-left {
        from {
            transform: translateX(100px);
        }

        to {
            transform: translateX(-300px);
        }
    }

    .header img {
        margin-left: 35%;
        width: 40%;
    }

    .stone1 {
        width: 60px;
        top: -10px;
        left: -70px;
    }

    .stone2 {
        width: 140px;
        top: 90px;
        left: 200px;
    }

    .stone3 {
        width: 140px;
        top: 190px;
        left: -70px;
    }

    .stone4 {
        width: 120px;
        top: 280px;
        left: 220px;
    }
    .btnplay {
        position: absolute;
        z-index: 3;
        top: 88%;
        left: 50%;
        width: 100%;
        max-width: 500px;
        cursor: pointer;
        transform: translateX(-50%);
    }
    
}

@media (max-width: 390px) {
    .title-img {
        max-width: 370px;
    }

    .title-gif {
        left: 65%;
        max-width: 48px;
    }

    .content {
        max-width: 220px;
    }

    .rope {
        max-width: 36px;
    }

    .ball-content {
        max-width: 34px;
    }

    .ball-content img {
        max-width: 34px;
    }

    .bg-stone img {
        max-width: 320px;
    }

    .gift-item {
        flex-wrap: wrap;
        max-width: 320px;
    }

    .gift-item img {
        max-width: 50px;
    }

    .btnplay img {
        max-width: 150px;
    }

    .middle-content {
        position: absolute;
        z-index: 3;
        top: 30%;
        left: 20%;
        width: 100%;
        max-width: 500px;

    }

    @keyframes stone-left-right {
        from {
            transform: translateX(-100px);
        }

        to {
            transform: translateX(250px);
        }
    }

    @keyframes stone-right-left {
        from {
            transform: translateX(100px);
        }

        to {
            transform: translateX(-250px);
        }
    }

    .header img {
        margin-left: 35%;
        width: 40%;
    }

    .stone1 {
        width: 60px;
        top: -10px;
        left: -70px;
    }

    .stone2 {
        width: 140px;
        top: 80px;
        left: 200px;
    }

    .stone3 {
        width: 140px;
        top: 160px;
        left: -70px;
    }

    .stone4 {
        width: 120px;
        top: 220px;
        left: 220px;
    }
    .btnplay {
        position: absolute;
        z-index: 3;
        top: 88%;
        left: 50%;
        width: 100%;
        max-width: 500px;
        cursor: pointer;
        transform: translateX(-50%);
    }
}