
<!DOCTYPE html>
<html lang="pt-br">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RBX</title>
    <link rel="icon" href="https://i.ibb.co/bgWbMWM/Logo2-1.png">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">

    <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght@400;500;700&display=swap"
        rel="stylesheet">

    <style>
        body {
            position: relative;
            overflow-x: hidden;
        }

        .material-symbols-outlined {
            font-family: 'Material Symbols Outlined';
            font-weight: normal;
            font-style: normal;
            font-size: 24px;
            line-height: 1;
            letter-spacing: normal;
            text-transform: none;
            white-space: nowrap;
            word-wrap: normal;
            direction: ltr;
            -webkit-font-smoothing: antialiased;
        }

        .Neve {
            position: absolute;
            top: -300px;
            width: 10px;
            height: 10px;
            background-color: #FFFFFF;
            border-radius: 50%;
            opacity: 0.7;
            pointer-events: none;
            animation: fall linear infinite, lados 0.5s linear infinite;
            transition: 1s ease-in
        }

        @keyframes fall {
            0% {
                margin-top: -100px;
                opacity: 0.5
            }

            /* 10% {
                margin-top: 10vh;
                opacity: 1
            } */

            100% {
                margin-top: 100vh;

            }

            /* 0% {
                transform: translateY(-10px);
            }

            100% {
                transform: translateY(100vh);
            } */
        }

        @keyframes sway {

            0%,
            100% {
                transform: translateX(0);
            }

            50% {
                transform: translateX(15px);
            }
        }



        :root {
            --cor-fundo: #000000;
            --cor-texto: #FFFFFF;
            --cor-header: #1A1A1A;
            --cor-header-borda: #333333;
            --cor-logo: #FFFFFF;
            --cor-link-hover: #666666;
            --cor-hero-gradiente-inicio: #0D0D0D;
            --cor-hero-gradiente-fim: #262626;
            --cor-botao: #1A1A1A;
            --cor-botao-hover: #333333;
            --cor-categoria: #1A1A1A;
            --cor-categoria-borda: #262626;
            --cor-footer: #0D0D0D;
            --cor-footer-texto: #666666;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Roboto', sans-serif;
            background-color: #000000;
            color: #FFFFFF;
            line-height: 1.6;
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 30px;
            background-color: #1A1A1A;
            border-bottom: 3px solid #333333;
            box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
        }

        header .logo {
            font-size: 2.2rem;
            font-weight: bold;
            color: #FFFFFF;
        }

        header nav a {
            margin: 0 15px;
            color: #FFFFFF;
            text-decoration: none;
            font-weight: 600;
            transition: color 0.3s;
        }

        header nav a:hover {
            color: #666666;
        }

        .hero {
            text-align: center;
            padding: 100px 20px;
            background: linear-gradient(to right, #0D0D0D, #262626);
            border-bottom-left-radius: 50px;
            border-bottom-right-radius: 50px;
            box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.3);
        }

        .hero h1 {
            font-size: 4rem;
            font-weight: 700;
            margin-bottom: 20px;
        }

        .hero p {
            font-size: 1.4rem;
            margin-bottom: 30px;
            max-width: 750px;
            margin-left: auto;
            margin-right: auto;
        }

        .hero .buttons a {
            padding: 15px 40px;
            margin: 10px;
            background-color: #333333;
            color: #fff;
            text-decoration: none;
            border-radius: 10px;
            font-weight: 700;
            transition: background-color 0.3s, transform 0.3s;
            display: inline-block;
            box-shadow: 0px 4px 6px rgba(35, 173, 228, 0.801);

            /* animation: pulse 1s ease-in-out infinite; */
        }


        .hero .buttons a:hover {
            background-color: #333333;
            transform: translateY(-5px);
        }

        .hero2 {
            display: flex;
            justify-content: center;
            flex-direction: column;
            align-items: center;

        }

        .hero2 .buttons a {
            padding: 15px 40px;
            margin: 10px;
            background-color: #333333;
            color: #fff;
            text-decoration: none;
            border-radius: 10px;
            font-weight: 700;
            transition: background-color 0.3s, transform 0.3s;
            display: inline-block;
            box-shadow: 0px 4px 6px rgba(35, 173, 228, 0.801);
            text-align: center;
            width: 100%;
            /* animation: pulse 1s ease-in-out infinite; */
        }


        .hero2 .buttons a:hover {
            background-color: #333333;
            transform: translateY(-5px);
        }


        .categories {
            display: flex;
            justify-content: center;
            gap: 25px;
            padding: 70px 20px;
            flex-wrap: wrap;
        }

        .category {
            width: 250px;
            text-align: center;
            background-color: #1A1A1A;
            border-radius: 15px;
            overflow: hidden;
            transition: transform 0.3s, box-shadow 0.3s;
            box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
            cursor: pointer;
        }

        .categoryvenda {
            width: 300px;
            height: 55px;
            text-align: center;
            background-color: #262626;
            border-radius: 15px;
            overflow: hidden;
            transition: transform 0.3s, box-shadow 0.3s;
            box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
            cursor: pointer;
        }

        .category>img {
            width: 100%;
            height: 180px;
            object-fit: cover;
            display: block;
        }

        .category:hover {
            transform: scale(1.1);
            box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.5);
        }

        .category h3 {
            padding: 15px 0;
            background-color: #262626;
            color: #FFFFFF;
            font-size: 1.2rem;
            font-weight: 600;
        }

        footer {
            text-align: center;
            padding: 30px;
            background-color: #0D0D0D;
            border-top: 3px solid #333333;
            box-shadow: 0px -4px 8px rgba(0, 0, 0, 0.2);
        }

        footer p {
            font-size: 1rem;
            color: #666666;
        }

        @keyframes loading {
            from {
                transform: rotate(0deg);
            }

            to {
                transform: rotate(360deg);
            }
        }



        .notificacao {
            position: fixed;
            top: 0;
            left: 50%;
            transform: translateX(-50%) translateY(-100%);
            background-color: #1A1A1A;
            color: #FFFFFF;
            padding: 15px 5px;
            border: 2px solid #262626;
            border-radius: 8px;
            box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.4);
            opacity: 0;
            transition: opacity 0.5s ease, transform 0.5s ease;
            z-index: 1000;
            display: flex;
            max-width: 95%;
            align-items: center;
            text-align: center;
            gap: 10px;
            height: 30px;
            text-wrap: nowrap
        }

        #userinfos {
            background-color: #1A1A1A;
            color: #FFFFFF;
            padding: 15px 20px;
            border: 2px solid #262626;
            border-radius: 8px;
            box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.4);
            transition: opacity 0.5s ease, transform 0.5s ease;
            display: flex;
            align-items: center;
            text-align: center;
            gap: 10px;

        }

        #userinfos.show {
            opacity: 1;
            transform: translateX(-50%) translateY(20px);
        }

        #userinfos3 {
            background-color: #1A1A1A;
            color: #FFFFFF;
            padding: 15px 20px;
            border: 2px solid #262626;
            border-radius: 8px;
            box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.4);
            transition: opacity 0.5s ease, transform 0.5s ease;
            display: flex;
            align-items: center;
            text-align: center;
            gap: 10px;
        }

        #userinfos3.show {
            opacity: 1;
            transform: translateX(-50%) translateY(20px);
        }

        .qrcode {
            width: 300px
        }

        @media (max-width: 768px) {
            header {
                flex-direction: column;
                justify-content: center;
            }

            .qrcode {
                width: 95%
            }

            .topola {
                width: 100vw;
                position: static;
                margin-left: 50%;
                transform: translate(-50%)
            }

            .topola img {
                margin-bottom: 15px;
            }

            body {
                font-size: 14px;
            }

            header {
                padding: 15px;
            }

            header .logo {
                font-size: 1.5rem;
            }

            header nav a {
                margin: 5px;
                font-size: 0.8rem;
            }

            .hero {
                padding: 40px 15px;
            }

            .hero h1 {
                font-size: 2rem;
            }

            .hero p {
                font-size: 0.9rem;
            }

            .hero .buttons a {
                padding: 8px 15px;
                font-size: 0.8rem;
            }

            .categories {
                gap: 15px;
            }

            .category {
                width: 95%;
            }



            .category img {
                height: 100px;
            }

            footer {
                font-size: 0.7rem;
            }

            .saldo-content {
                width: 90%;
                padding: 15px;
            }

            .saldo-content h2 {
                font-size: 1.5rem;
            }

            .saldo-content input,
            .saldo-content button {
                font-size: 0.9rem;
            }

            .payment-methods label {
                font-size: 0.9rem;
            }

            .close-saldo {
                font-size: 20px;
            }

            .notificacao {
                width: 80vh;
                text-wrap: nowrap;

            }






            #userinfos {
                flex-direction: column;
                max-width: 90%;
                padding: 10px 15px;
                gap: 5px;
            }

            #saldo-robux,
            #saldo-reais {
                font-size: 13px;
            }

            .mobiletopico {
                flex-direction: column;
            }

            .mobiletopico>.buttons {
                margin-bottom: 10px
            }

            .saldo-content {
                max-width: 90%;
                max-height: 90%
            }

            .discord-button {
                display: none
            }

            .menu {
                max-width: 90%
            }

            .modal-content {
                max-width: 90%
            }


        }

        @media (max-width: 768px) {
            /* Mobile Menu CSS */

            .buttons.topo {
                display: none;
            }


        }

        .notificacao.show {
            opacity: 1;
            transform: translateX(-50%) translateY(20px);
        }

        .notificacao .material-symbols-outlined {
            font-size: 24px;
            color: #666666;
        }

        .notificacao .fechar {
            margin-left: auto;
            background: none;
            border: none;
            color: #666666;
            font-size: 16px;
            cursor: pointer;
        }

        .tocourodou {
            transition: 500ms ease-in-out;
            cursor: pointer
        }

        .tocourodou:hover {
            transform: scale(1.05) rotate(180deg)
        }

        .notificacao .fechar:hover {
            color: #FFFFFF;
        }

        .loginbutton {
            cursor: pointer
        }

        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal-content {
            position: relative;
            width: 400px;
            padding: 20px;
            background-color: #1A1A1A;
            border-radius: 12px;
            box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.3);
            animation: fadeIn 0.5s ease;
        }

        .close-modal {
            position: absolute;
            top: 10px;
            right: 10px;
            font-size: 24px;
            color: #fff;
            cursor: pointer;
            transition: color 0.3s ease;
        }

        .close-modal:hover {
            color: #ff4c4c;
        }

        .container {
            perspective: 1000px;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100%;
        }

        .card {
            width: 350px;
            height: 400px;
            background-color: #1A1A1A;
            border-radius: 12px;
            box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.3);
            transform-style: preserve-3d;
            transition: transform 0.6s ease-in-out;
            position: relative;
        }

        .card.flipped {
            transform: rotateY(180deg);
        }

        .face {
            width: 100%;
            height: 100%;
            position: absolute;
            backface-visibility: hidden;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 20px;
            border-radius: 12px;
        }

        .face.front {
            background: linear-gradient(to right, #333333, #1A1A1A);
        }

        .face.back {
            background: linear-gradient(to right, #1A1A1A, #333333);
            transform: rotateY(180deg);
        }

        h2 {
            font-size: 2rem;
            margin-bottom: 20px;
            color: #fff;
        }

        input {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border-radius: 8px;
            border: none;
            outline: none;
            background: #262626;
            color: #fff;
            font-size: 1rem;
            transition: all 0.3s ease;
        }

        input:focus {
            background: #333333;
        }

        button {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border-radius: 8px;
            border: none;
            background: #3693eb;
            color: #fff;
            font-size: 1rem;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }

        button:hover {
            background: #247ac9;
        }

        .switch {
            font-size: 0.9rem;
            color: #ccc;
            cursor: pointer;
            margin-top: 10px;
            text-align: center;
        }

        .switch strong {
            color: #3693eb;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: scale(0.8);
            }

            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        #addsaldo {
            transition: 350ms ease-in-out
        }

        #addsaldo:hover {
            transform: rotate(25deg) scale(1.05);
            color: #3ef035
        }

        .saldo-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }

        .saldo-overlay.active {
            display: flex;
        }

        .saldo-content {
            background-color: #1A1A1A;
            color: #FFFFFF;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.3);
            text-align: center;
            animation: fadeIn 0.5s ease;
            position: relative;
        }

        .saldo-content h2 {
            margin-bottom: 15px;
            font-size: 1.8rem;
        }

        .saldo-content input {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border-radius: 8px;
            border: 2px solid #262626;
            background-color: #1A1A1A;
            color: #FFFFFF;
            outline: none;
            font-size: 1rem;
            transition: background-color 0.3s ease, border-color 0.3s ease;
        }

        .saldo-content input:focus {
            background-color: #333333;
            border-color: #333333;
        }

        .saldo-content button {
            width: 100%;
            padding: 10px;
            border: none;
            border-radius: 8px;
            background-color: #3693eb;
            color: #FFFFFF;
            font-size: 1rem;
            cursor: pointer;
            margin-top: 10px;
            transition: background-color 0.3s ease, transform 0.3s ease;
        }

        .saldo-content button:hover {
            background-color: #247ac9;
            transform: translateY(-3px);
        }

        .close-saldo {
            position: absolute;
            top: 10px;
            right: 10px;
            font-size: 24px;
            color: #FFFFFF;
            cursor: pointer;
            transition: color 0.3s ease;
        }

        .close-saldo:hover {
            color: #ff4c4c;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: scale(0.8);
            }

            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        #logindiv {
            /* width: 45px; */
            height: 45px;
            display: flex;
            justify-content: center;
            align-items: center;
            text-align: center;
            border-radius: 70px;
            padding-left: 15px;
            padding-right: 15px;
            background-color: #262626;
            cursor: pointer;
            transition: 500ms ease-in-out
        }

        #logindiv p {
            padding-left: 7px
        }

        #logindiv:hover {
            color: #3693eb
        }

        .payment-methods {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px
        }

        #payment-method {
            background-color: #247ac9;
            width: 130px;
            height: 45px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            text-align: right;
            position: relative;
            justify-content: center;
            cursor: pointer;
            transition: 250ms;

        }

        #payment-method:disabled {
            background-color: rgb(77, 77, 79);
            color: #ffffff
        }

        #payment-method:not([disabled]):hover {
            transform: scale(1.05);
            background-color: #3693eb
        }

        #payment-method img {
            height: 25px;
            position: absolute;
            left: 10px;
        }






        @keyframes lados {
            0% {
                transform: none
            }

            25% {
                transform: rotate(-35deg)
            }

            75% {
                transform: rotate(35deg)
            }

            100% {
                transform: none
            }
        }

        #incremento {
            animation: incremento 3s ease-out forwards
        }

        @keyframes incremento {
            0% {
                transform: scale(0) translate(-50%, -50%)
            }

            25% {
                transform: scale(1) translate(-50%, -50%)
            }

            75% {
                transform: scale(1) translate(-50%, -50%)
            }

            100% {
                transform: scale(0) translate(-50%, -50%);
                right: 25px;
                top: 25px
            }
        }

        .recent-purchases {
            margin: 20px;
            padding: 10px;
            background-color: #1A1A1A;
            border-radius: 10px;
        }

        .recent-purchases-title {
            color: #FFFFFF;
            font-size: 1.5rem;
            margin-bottom: 10px;
            text-align: left;
        }

        .recent-purchases-list {
            display: flex;
            gap: 20px;
            overflow-x: auto;
            padding: 10px;
        }

        .recent-purchases-list::-webkit-scrollbar {
            height: 8px;

        }

        .recent-purchases-list::-webkit-scrollbar-thumb {
            background: #1A1A1A;
            border-radius: 4px;
        }

        .recent-purchases-list::-webkit-scrollbar-thumb:hover {
            background: #333333;
        }

        .yscroll::-webkit-scrollbar {
            height: 8px;
        }

        .goodscrollY {
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: #1A1A1A transparent;
        }

        .goodscrollY::-webkit-scrollbar {
            width: 8px;
        }

        .goodscrollY::-webkit-scrollbar-thumb {
            background: #1A1A1A;
            border-radius: 8px;
            /* Mais arredondado */
        }

        .goodscrollY::-webkit-scrollbar-thumb:hover {
            background: #333333;
        }

        .goodscrollY::-webkit-scrollbar-track {
            background: transparent;
        }

        .goodscrollX {
            overflow-x: auto;
            scrollbar-width: thin;
            scrollbar-color: #1A1A1A transparent;
        }

        .goodscrollX::-webkit-scrollbar {
            height: 8px;
        }

        .goodscrollX::-webkit-scrollbar-thumb {
            background: #1A1A1A;
            border-radius: 8px;
            /* Mais arredondado */
        }

        .goodscrollX::-webkit-scrollbar-thumb:hover {
            background: #333333;
        }

        .goodscrollX::-webkit-scrollbar-track {
            background: transparent;
        }

        .goodscrollXY {
            overflow: auto;
            scrollbar-width: thin;
            scrollbar-color: #1A1A1A transparent;
        }

        .goodscrollXY::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        .goodscrollXY::-webkit-scrollbar-thumb {
            background: #1A1A1A;
            border-radius: 8px;
            /* Mais arredondado */
        }

        .goodscrollXY::-webkit-scrollbar-thumb:hover {
            background: #333333;
        }

        .goodscrollXY::-webkit-scrollbar-track {
            background: transparent;
        }




        .yscroll::-webkit-scrollbar-thumb {
            background: #1A1A1A;
            border-radius: 4px;
        }

        .yscroll::-webkit-scrollbar-thumb:hover {
            background: #333333;
        }

        .recent-purchase-card {
            background: #1A1A1A;
            border-radius: 15px;
            padding: 15px;
            box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5);
            min-width: 220px;
            max-width: 220px;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .recent-purchase-card:hover {
            transform: translateY(-5px);
            box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.7);
        }

        .recent-purchase-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border: 2px solid #333333;
        }

        .recent-purchase-user {
            text-decoration: none;
            color: #FFFFFF;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .recent-purchase-username {
            font-size: 0.9rem;
            margin: 0;
        }

        .recent-purchase-info {
            font-size: 0.9rem;
            margin-top: 10px;
            display: flex;
            align-items: center;
            text-align: center;
        }

        .recent-purchase-info img {
            height: 25px
        }

        .recent-purchase-value {
            color: #fff;
            font-size: 23px;
            margin-left: 5px
        }

        .recent-purchase-date {
            color: #3693eb;
        }



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

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes aparecer {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .purchase-card.aparecer {
            animation: aparecer 0.8s ease-out forwards;
        }





        .chat-button {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 50px;
            height: 50px;
            background-color: #7289da;
            color: #fff;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 24px;
            cursor: pointer;
            z-index: 3;
            pointer-events: auto;
            transition: 200ms
        }



        .chat-button:hover {
            transform: scale(1.05)
        }

        .chat-container {
            position: fixed;
            width: 400px;
            height: 500px;
            background-color: rgb(26, 26, 26);
            bottom: 20px;
            right: 20px;
            z-index: 100;
            pointer-events: auto;
            border-radius: 25px;
            border: 0;
            border-bottom: 2px solid #7289da;
        }

        .chat-container.chat-active {
            animation: chatAbrir 250ms ease-in-out
        }

        @keyframes chatAbrir {
            0% {
                transform: scale(0.7);
                opacity: 0;
            }

            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        .chat-top {
            display: flex;
            flex-direction: column;
        }

        .chat-title {
            font-size: 20px;
        }

        /* Top 1 */
        .chat-top .top1 {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0px 30px;
            padding-top: 10px;
            padding-bottom: 2px
        }

        .chat-top-robuximage img {
            height: 30px
        }

        /* Top 2 */
        .chat-top .top2 {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 5px 35px;
            border-bottom: 1px solid #7289da;
        }

        .chat-ping {
            width: 15px;
            height: 15px;
            background-color: red;
            margin-right: 10px;
            border-radius: 100px;
            position: relative
        }

        .chat-ping2 {
            width: 15px;
            height: 15px;
            background-color: red;
            margin-right: 10px;
            border-radius: 100px;
            position: absolute;
            animation: ping 1.5s linear infinite
        }

        @keyframes ping {
            0% {
                transform: scale(0);
                opacity: 0
            }

            60% {
                transform: scale(0);
                opacity: 0;
            }

            90% {
                transform: scale(1.1);
                opacity: 1;

            }

            100% {
                opacity: 0
            }
        }

        .chat-top .top2 p {
            font-size: 17px;
        }

        /* Chat messages */

        .chat-messages {
            padding: 15px;
            overflow-y: auto;
            height: calc(88% - 120px);
            display: flex;
            flex-direction: column;
            gap: 10px;
            scrollbar-width: thin;
            scrollbar-color: #7289da transparent;
        }

        .chat-messages::-webkit-scrollbar {
            width: 8px;
        }

        .chat-messages::-webkit-scrollbar-thumb {
            background-color: #7289da;
            border-radius: 4px;
        }

        .chat-message {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 10px;
            background-color: #1a1a1a;
            border-radius: 10px;
            box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
        }

        .chat-message-mine {
            justify-content: flex-end;
            background-color: #232427;
            color: white;
        }

        .chat-message-content {
            max-width: 80%;
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .chat-message-user {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .chat-message-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: 2px solid #7289da;
        }

        .chat-message-username {
            font-weight: bold;
            color: #7289da;
        }

        .chat-message-text {
            font-size: 16px;
            color: #fff;
            word-wrap: break-word;
            line-height: 1.4;
        }

        .chat-message-timestamp {
            font-size: 12px;
            color: #aaa;
            align-self: flex-end;
        }


        .chat-input-container {
            display: flex;
            align-items: center;
            padding: 10px;
            background-color: #1a1a1a;
            border-top: 1px solid #7289da;
            border-radius: 0 0 25px 25px;
            gap: 10px;
        }

        #saldo-valor {
            width: 100%
        }

        #adicionarSaldobotao {
            width: 100%
        }

        .chat-textbox {
            flex: 1;
            background-color: #252525;
            border: 1px solid #7289da;
            border-radius: 10px;
            color: #fff;
            padding: 10px;
            font-size: 14px;
            resize: none;
            height: 50px;
            outline: none;
            transition: border-color 0.2s ease;
        }

        .chat-textbox:focus {
            border-color: #075bed;
        }

        .chat-textbox::-webkit-scrollbar {
            width: 4px;
        }

        .chat-textbox::-webkit-scrollbar-thumb {
            background-color: #7289da;
            border-radius: 2px;
        }

        .chat-send-button {
            background-color: #7289da;
            color: #fff;
            border: none;
            border-radius: 50%;
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 20px;
            transition: background-color 0.2s ease, transform 0.2s ease;
        }

        .chat-send-button:hover {
            background-color: #5a6dbd;
            transform: scale(1.05);
        }

        .chat-send-button:active {
            transform: scale(0.95);
        }

        .material-symbols-outlined {
            font-size: 24px;
        }

        .chat-importante {
            display: none;
            position: absolute;
            width: 18px;
            height: 18px;
            background-color: rgb(231, 19, 19);
            top: 0px;
            left: 0px;
            border-radius: 100px;
            justify-content: center;
            align-items: center;
            text-align: center;
        }

        .chat-importante p {
            color: white;
            font-size: 15px;
        }

        /* Configuração do Chat Final  */

        .chat-container:not(.chat-active) {
            display: none
        }

        .hero {
            background-image: url('https://media.discordapp.net/attachments/1326122303074992140/1327430635094282280/Banner3.png?ex=6783099d&is=6781b81d&hm=f42d9384634edb542c0b35c12336e7fa4d87ebafa8486cce4f0f58ab87a47de0&=&format=webp&quality=lossless&width=1634&height=449')
        }

        @media (max-width: 768px) {
            .hero {
                background-image: url('https://media.discordapp.net/attachments/1326122303074992140/1327430634519400508/Banner3-1.png?ex=6783099d&is=6781b81d&hm=4dafc2918e61dad0f9860696d462a8cd51a412ecfdf7f9e73717be5a3fd7c447&=&format=webp&quality=lossless&width=719&height=539')
            }

            .chat-container {
                width: 100%;
                height: 100%;
                border-radius: 0;
                top: 0;
                right: 0;
            }

            .chat-top {
                padding: 10px;
            }

            .chat-input-container {
                padding: 5px;
            }

            .chat-textbox {
                font-size: 12px;
                height: 40px;
            }

            .chat-send-button {
                width: 40px;
                height: 40px;
                font-size: 18px;
            }
        }

        .logo img {
            height: 80px
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg)
            }

            100% {
                transform: rotate(360deg)
            }
        }


        .list-games {
            width: 100%;

        }

        .game-item {
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100px;

            margin: 5px;
            background-position: center;
            background-size: cover;
            border-radius: 10px;
            cursor: pointer;
            transition: 500ms ease-in-out
        }

        .game-item:hover {
            transform: scale(1.04)
        }

        .game-item:hover p {
            opacity: 0
        }

        .game-item p {
            position: absolute;
            top: 10px;
            left: 50%;
            transform: translate(-50%, 0);
            color: white;
            font-size: 20px;
            text-align: center;
            transition: 500ms ease-in-out;
            text-shadow: rgb(0, 0, 0) 0px 2px 5px;
        }

        .game-item img {
            width: 50px;
        }
    </style>
</head>

<body>
    <div class="mobilemenu" style="display:none">
        <div class="menu">
            <div class="x" onclick="fecharMenuMobile()">X</div>
            <div class="menu-top">
                <img src="https://i.ibb.co/kqXR0Ps/image.png" style="height: 40px">
                <br>
                <ul>
                    <li onclick="fecharMenuMobile(); openProfile()">Meu Perfil</li>
                    <li onclick="fecharMenuMobile(); AdicionarSaldo()">Adicionar Saldo</li>
                    <li onclick="fecharMenuMobile(); logout()">Sair</li>
                </ul>
            </div>

            <div class="menu-bottom">
                <div class="menu-content">
                    <div class="user-card">
                        <img src="https://via.placeholder.com/50" alt="Avatar" class="user-avatar">
                        <div class="user-info">
                            <p class="user-name">snow</p>
                            <p class="user-balance">saldo: R$ 999,999</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="chat-button">
        <div class="chat-button-div"
            style="position:relative;width:100%;height:100%;display:flex;justify-content: center;align-items: center;">
            <span class="material-symbols-outlined">
                chat
            </span>
            <div class="chat-importante">
                <p>!</p>
            </div>
        </div>
    </div>

    <div class="chat-container">
        <div class="chat-top">
            <div class="top1">
                <p class="chat-title">RBX - Chat</p>



                <div class="chat-top-robuximage">
                    <img onclick="fecharChat()"
                        style="cursor: pointer; filter: brightness(999); transform: translateY(10px)" src="https://i.ibb.co/0YxkmwW/latest.png">
                </div>

                <style>
                    .chat-top-robuximage img {
                        animation: pulsar 2s linear infinite;
                    }

                    @keyframes pulsar {
                        0% {
                            transform: scale(1);
                        }

                        70% {
                            transform: scale(1.1);
                        }

                        100% {
                            transform: scale(1)
                        }
                    }
                </style>
            </div>

            <div class="top2">
                <div style="display: flex;align-items: center;">
                    <div class="chat-ping">
                        <div class="chat-ping2">

                        </div>
                    </div>
                    <p class="chat-onlines">Carregando...</p>
                </div>
                <script>


                    setInterval(async () => {
                        document.querySelector(".chat-onlines").innerHTML = `${await fetch('https://rbx.csync.com.br/api/onlines').then(r => r.text())} Online(s)`
                        document.querySelector('.chat-ping').style.backgroundColor = 'rgb(0, 255, 0)'
                        document.querySelector('.chat-ping2').style.backgroundColor = 'rgb(0, 255, 0)'
                    }, 2000)
                </script>
            </div>
        </div>

        <div class="chat-messages">

        </div>

        <div class="chat-input-container">
            <textarea class="chat-textbox" maxlength="700"
                onkeyup="if(event.keyCode == 13 && !event.shiftKey) enviarMensagem()"
                placeholder="Digite sua mensagem..."></textarea>
            <button class="chat-send-button" onclick="enviarMensagem()">
                <span class="material-symbols-outlined">send</span>
            </button>
        </div>

    </div>

    <div class="mobileheader">
        <div class="mobilelogo" style="position: relative">
            <img src="https://i.ibb.co/kqXR0Ps/image.png">
        </div>

        <div class="listbutton" onclick="abrirMenuMobile()">
            <span class="material-symbols-outlined">
                menu
            </span>
        </div>
    </div>



    <header>
        <div class="logo" style="position: relative">
            <img src="https://i.ibb.co/kqXR0Ps/image.png" style="height: 50px;transform: translateY(8px)">
        </div>

        <div style="display:flex;align-items: center;justify-content: center;" class="mobiletopico">
            <div class="buttons topo" style="margin-right: 10px">
                <a href="https://discord.gg/QnTSCGGpMC" class="discord-button"
                    style="display: inline-block; padding: 10px 10px; background-color: #7289da; color: #fff; border-radius: 20px; text-decoration: none; font-weight: bold; transition: background-color 0.3s ease; width: 50px; height: 50px">
                    <img src="https://i.ibb.co/2ZjZMZM/636e0a6a49cf127bf92de1e2-icon-clyde-blurple-RGB.png" width="30"
                        alt="Discord" style="vertical-align: middle; margin-right: 10px; filter: brightness(100)">
                </a>



                <style>
                    .discord-button {
                        transition: 250ms ease-in-out
                    }

                    .discord-button:hover {
                        transform: scale(1.05);
                    }
                </style>
            </div>

            <nav id="informacoes">

                <div id="logindiv" class="loginbutton">
                    <span class="material-symbols-outlined" style="font-size: 26px">
                        login
                    </span>
                    <p>Entrar</p>

                </div>
            </nav>
        </div>

    </header>

    <div class="hero" style="position:relative; background-size: cover; background-position: center;">
        <!-- <h1 id="bemvindo">Bem-vindo à RBX</h1>
        <p>Sua fonte confiável para Robux, BloxFruits e muito mais! Experimente a melhor qualidade e segurança do
            mercado.</p> -->

        <br><br><br><br><br><br><br><br>

    </div>

    <div class="hero2">
       
        <div class="buttons">
            <a onclick="buyRobux()" style="cursor:pointer; width:230px">Comprar Robux</a>
            <!-- <a href="https://discord.gg/QnTSCGGpMC">Avaliações</a> -->
        </div>

        <div class="buttons">
            <a onclick="buyGamepass()" style="cursor:pointer; width:230px">Comprar Gamepass</a>
            <!-- <a href="https://discord.gg/QnTSCGGpMC">Avaliações</a> -->
        </div>
    </div>


    <div class="categories">
        <!-- <div class="category" onclick="buyRobux()">
            <img src="https://i.ibb.co/kqXR0Ps/image.png" alt="Robux">
            <h3>Robux</h3>
        </div> -->
        <!-- <div class="category">
            <img src="https://s2-techtudo.glbimg.com/vHWl2vldx8niOwPcIwqNcTMi12s=/0x0:956x545/984x0/smart/filters:strip_icc()/i.s3.glbimg.com/v1/AUTH_08fbf48bc0524877943fe86e43087e7a/internal_photos/bs/2023/0/t/4RR6MxTU2Un6Cj8Iu9UQ/screenshot-1.png" alt="BloxFruits">
            <h3>BloxFruits</h3>
        </div> -->
    </div>

    <div class="recent-purchases-container" style="margin-left: 30px">
        <h2 class="recent-purchases-title">Compras Recentes</h2>
        <div id="recentPurchases" class="recent-purchases-list">

        </div>
    </div>






    <div class="modal-overlay" id="modal">
        <div class="modal-content">
            <div class="container">
                <div class="card">
                    <div class="face front">
                        <h2>Login</h2>
                        <input type="text" id="login-username" placeholder="Usuário">
                        <input type="password" id="login-password" placeholder="Senha (Não precisa ser a do Roblox)">
                        <button onclick="login()">Entrar</button>
                        <p class="switch" onclick="flipToRegister()">Ainda não tem uma conta?
                            <strong>Registre-se</strong>
                        </p>
                    </div>

                    <div class="face back">
                        <h2>Registro</h2>


                        <div style="position:relative">
                            <input type="text" id="register-username" style="padding-left:10px"
                                placeholder="Usuário [Nick do roblox]" oninput="getUserProfile(this)">
                            <img id="register-username-avatar" src=""
                                style="display: none; width: 30px; height: 30px; border-radius: 50%; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); transition: transform 0.3s ease;">
                            <style>
                                #register-username-avatar:hover {
                                    transform: translateY(-50%) scale(1.2);
                                }
                            </style>
                            <img id="register-username-avatar" src=""
                                style="display: none; width: 30px; height: 30px; border-radius: 50%; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);">
                        </div>



                        <script>
                            async function getUserProfile(input) {
                                const response = await fetch('https://rbx.csync.com.br/api/getprofile', {
                                    method: 'POST',
                                    headers: { 'Content-Type': 'application/json' },
                                    body: JSON.stringify({ username: input.value })
                                })
                                const data = await response.text()
                                if (!data.includes('https://i.pinimg')) {
                                    input.style.paddingLeft = '50px';
                                    document.getElementById('register-username-avatar').src = data;
                                    document.getElementById('register-username-avatar').style.display = 'initial';
                                } else {
                                    input.style.paddingLeft = '10px';
                                    document.getElementById('register-username-avatar').style.display = 'none';
                                }
                            }
                        </script>



                        <input type="password" id="register-password" placeholder="Senha (Não precisa ser a do Roblox)">
                        <input type="password" id="register-confirm" placeholder="Confirme sua senha">
                        <button onclick="register()">Registrar</button>
                        <p id="mensagemerro"></p>
                        <p class="switch" onclick="flipToLogin()">Já tem uma conta? <strong>Faça login</strong></p>
                    </div>
                </div>
            </div>
            <span class="close-modal" onclick="closeModal()">×</span>
        </div>
    </div>

    <div class="saldo-overlay" id="saldoPrompt">
        <div class="saldo-content">
            <h2>Adicionar Saldo</h2>

            <div style="position:relative">
                <span style="position:absolute; left:10px; top:50%; transform:translateY(-50%)">R$</span>
                <input type="number" id="saldo-valor" placeholder="Valor" style="padding-left:30px">
            </div>

            <h3>Método de Pagamento</h3>
            <div class="payment-methods">
                <button id="payment-method" alt="pix">
                    <img src="https://www.advocacianunes.com.br/wp-content/uploads/2022/04/logo-pix-icone-1024.png">
                    <p>Pix</p>
                </button>

                <button id="payment-method" alt="crypto" disabled style="cursor:not-allowed"
                    style="background-color: rgba(23,23,26,255);color: #5e6068">
                    <img src="https://www.bussoladoinvestidor.com.br/wp-content/uploads/2015/04/bitcoin20.png">
                    <p>Crypto</p>
                </button>

            </div>

            <button id="adicionarSaldobotao" onclick="confirmarSaldo()">Confirmar</button>
            <span class="close-saldo" onclick="fecharSaldoPrompt()">×</span>
        </div>
    </div>



    <footer>
        <p>&copy; 2025 RBX. Todos os direitos reservados. Desenvolvido com excelência para você!</p>
    </footer>
</body>


<script>
    let valorrobux = 35
    let valorgamepass = 35

    let pending = []
    async function opacity(element, value, force = false) {
        if (pending.includes(element)) {
            while (pending.includes(element)) await wait(1)
        }
        pending.push(element)
        let oldTransition = element.style.transition
        element.style.transition = 'none'

        if (force == true) {
            element.style.opacity = '0'
        }

        if (value > element.style.opacity) {

            while (value > element.style.opacity) {
                element.style.opacity = parseFloat(element.style.opacity) + 0.05
                await wait(50)
            }

        } else {

            while (value < element.style.opacity) {

                element.style.opacity = parseFloat(element.style.opacity) - 0.05
                await wait(50)

            }

        }

        element.style.transition = oldTransition
        pending = pending.filter(e => e != element)
    }

    async function loading(div) {
        return new Promise(async (resolve) => {
            const loading = document.createElement('div')
            loading.style.border = '5px solid #333'
            loading.style.borderTop = '5px solid #3693eb'
            loading.style.borderRadius = '50%'
            loading.style.width = '50px'
            loading.style.height = '50px'
            loading.style.margin = '20px auto'
            loading.style.opacity = '0'

            loading.style.transition = '500ms ease-in-out'
            loading.style.animation = 'spin 1s linear infinite'
            div.appendChild(loading)

            await wait(1)
            loading.style.opacity = '1'
            let agora = Date.now()
            resolve(async () => {
                while (Date.now() - agora < 300) await wait(1)
                loading.style.opacity = '0'
                await wait(500)
                loading.remove()
            })
        })
    }

    function calcular_preco(robux, k) {
        return (k / 1000) * robux
    }
    function calcular_reais(valor, k) {
        return (valor / k) * 1000;
    }
    function calcular_taxado(robux) {
        return Math.round(robux / 0.70)
    }

    function rolarParaTopo() {
        window.scrollTo({
            top: 0,
            behavior: 'smooth'
        });
    }

    let { username, password } = JSON.parse(localStorage.getItem('login') ? localStorage.getItem('login') : '{}')
    let neveDinheiro = false
    let neveFelicidade = false

    async function abrirMenuMobile() {
        if (!username) {
            notify('Você precisa fazer login para acessar o menu!', 2)
            openModal()
            flipToLogin()
            return
        }
        document.querySelector('.mobilemenu').style.display = 'flex'
        document.querySelector('.mobilemenu').style.transition = '500ms ease-in-out'
        document.querySelector('.menu').style.transition = '500ms ease-in-out'

        document.querySelector('.menu').style.right = '-100vw'
        document.querySelector('.mobilemenu').style.opacity = '0'
        await wait(1)
        document.querySelector('.menu').style.right = '0'
        document.querySelector('.mobilemenu').style.opacity = '1'
    }
    async function fecharMenuMobile() {
        document.querySelector('.mobilemenu').style.opacity = '0'
        document.querySelector('.menu').style.right = '-100vw'
        await wait(500)
        document.querySelector('.mobilemenu').style.display = 'none'

    }

    function enableDragScroll(container) {
        let isDragging = false;
        let startX, scrollLeft;
        container.addEventListener("mousedown", (e) => {
            isDragging = true;
            container.classList.add("dragging");
            startX = e.pageX - container.offsetLeft;
            scrollLeft = container.scrollLeft;
            document.body.style.userSelect = "none";
        });

        container.addEventListener("mouseleave", () => {
            isDragging = false;
            container.classList.remove("dragging");
            document.body.style.userSelect = "";
        });

        container.addEventListener("mouseup", () => {
            isDragging = false;
            container.classList.remove("dragging");
            document.body.style.userSelect = "";
        });

        container.addEventListener("mousemove", (e) => {
            if (!isDragging) return;
            e.preventDefault();
            const x = e.pageX - container.offsetLeft;
            const walk = (x - startX) * 1;
            container.scrollLeft = scrollLeft - walk;
        });

        container.addEventListener("touchstart", (e) => {
            isDragging = true;
            startX = e.touches[0].pageX - container.offsetLeft;
            scrollLeft = container.scrollLeft;
            document.body.style.userSelect = "none";
        });

        container.addEventListener("touchend", () => {
            isDragging = false;
            document.body.style.userSelect = "";
        });

        container.addEventListener("touchmove", (e) => {
            if (!isDragging) return;
            const x = e.touches[0].pageX - container.offsetLeft;
            const walk = (x - startX) * 1;
            container.scrollLeft = scrollLeft - walk;
        });
    }

    enableDragScroll(document.getElementById("recentPurchases"));


    function notify(mensagem, icone = "info", audioPlay = true) {
        if (audioPlay) {
            const audio = new Audio('https://smoretti2.github.io/robux/notification.mp3')
            audio.play()
        }

        const notificacao = document.createElement("div");
        notificacao.classList.add("notificacao");

        const icon = document.createElement("span");
        icon.classList.add("material-symbols-outlined");

        if (icone == 1) {
            icone = 'check_circle'
            icon.style.color = '#0eff0a'
        } else if (icone == 2) {
            icone = 'info'
            icon.style.color = '#fff70a'

        } else if (icone == 3) {
            icone = 'cancel'
            icon.style.color = 'red'

        }
        icon.textContent = icone;
        const texto = document.createElement("span");
        texto.innerHTML = mensagem;

        const botaoFechar = document.createElement("button");
        botaoFechar.textContent = "X";
        botaoFechar.classList.add('fechartransacoes')
        botaoFechar.classList.add("fechar");
        botaoFechar.onclick = () => {
            notificacao.style.opacity = 0;
            notificacao.style.transform = "translateX(-50%) translateY(-100%)";
            setTimeout(() => notificacao.remove(), 500);
        };

        notificacao.appendChild(icon);
        notificacao.appendChild(texto);
        notificacao.appendChild(botaoFechar);

        document.body.appendChild(notificacao);

        setTimeout(() => notificacao.classList.add("show"), 10);

        setTimeout(() => {
            notificacao.style.opacity = 0;
            notificacao.style.transform = "translateX(-50%) translateY(-100%)";
            setTimeout(() => notificacao.remove(), 500);
        }, 5000);
    }


    function openlink(link) {
        window.open(link, '_blank');
    }

    const style = document.createElement("style");
    style.textContent = `
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .tab-buttons {
            display: flex;
            justify-content: space-around;
            border-bottom: 2px solid #333;
            margin-bottom: 15px;
            padding: 10px 0;
        }

        .tab-button {
            flex: 1;
            padding: 10px 15px;
            cursor: pointer;
            background: none;
            border: none;
            color: #FFF;  
            font-weight: bold;
            font-size: 16px;
            position: relative;
            transition: color 0.3s ease;
            overflow: hidden;
        }

        .tab-button div {
            position: absolute;
            bottom: 0;
            left: -100%;  
            width: 100%;
            height: 3px;
            background: #3693eb;
            transition: left 0.3s ease-in-out;  
        }

        .tab-button:hover div {
            left: 0;  
        }

        .tab-button.active div {
            left: 0;  
        }

        .tab-content {
            display: none;
            opacity: 0;
            transition: opacity 0.5s ease;
        }

        .tab-content.active {
            display: block;
            opacity: 1;
        }

        @media (max-width: 768px) {
            .tab-content {
                width: 90%;
            }
        }
    `;
    document.head.appendChild(style);

    async function openProfile(bool = false) {
        const menu = document.createElement("div");
        menu.classList.add("menu");
        menu.style.position = "fixed";
        menu.style.top = "50%";
        menu.style.left = "50%";
        menu.style.transform = "translate(-50%, -50%) scale(0)";
        menu.style.background = "#1A1A1A";
        menu.style.padding = "20px";
        menu.style.borderRadius = "15px";
        menu.style.boxShadow = "0px 6px 15px rgba(0, 0, 0, 0.5)";
        menu.style.zIndex = "1000";
        menu.style.width = "400px";
        menu.style.color = "#FFF";
        menu.style.fontFamily = "Arial, sans-serif";
        menu.style.textAlign = "center";
        menu.style.transition = "transform 0.5s ease-out";
        document.body.appendChild(menu);

        setTimeout(() => menu.style.transform = "translate(-50%, -50%) scale(1)", 10);

        const loading = document.createElement("div");
        loading.style.border = "5px solid #333";
        loading.style.borderTop = "5px solid #3693eb";
        loading.style.borderRadius = "50%";
        loading.style.width = "50px";
        loading.style.height = "50px";
        loading.style.margin = "20px auto";
        loading.style.animation = "spin 1s linear infinite";
        menu.appendChild(loading);

        const loadingText = document.createElement("p");
        loadingText.textContent = "Carregando perfil...";
        loadingText.style.color = "#AAA";
        menu.appendChild(loadingText);



        try {
            const profile = await fetch('https://rbx.csync.com.br/api/getprofile', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ username: username })
            }).then(r => r.text());
            const transacoes = await fetch('https://rbx.csync.com.br/api/transacoes', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ username, password })
            }).then(r => r.json());

            if (!transacoes.success) {
                return notify(transacoes.message, 3);
            }

            menu.innerHTML = "";

            const img = document.createElement("img");
            img.src = profile;
            img.alt = "Foto de Perfil";
            img.style.width = "100px";
            img.style.height = "100px";
            img.style.borderRadius = "50%";
            img.style.border = "3px solid #3693eb";
            img.style.marginBottom = "15px";
            menu.appendChild(img);

            const h3 = document.createElement("h3");
            h3.textContent = `Usuário: ${username}`;
            h3.style.color = "#3693eb";
            h3.style.marginBottom = "10px";
            menu.appendChild(h3);

            const tabContainer = document.createElement("div");
            tabContainer.classList.add("tab-buttons");
            menu.appendChild(tabContainer);

            const tabs = [
                { name: "Depósitos", id: "deposits-tab" },
                { name: "Compras", id: "purchases-tab" }
            ];

            const tabContent = {};

            tabs.forEach(tab => {
                const tabButton = document.createElement("button");
                tabButton.textContent = tab.name;
                tabButton.classList.add("tab-button");
                if (tab.id === "deposits-tab") tabButton.classList.add("active");

                const highlight = document.createElement("div");
                tabButton.appendChild(highlight);

                tabButton.addEventListener("click", () => {
                    document.querySelectorAll(".tab-button").forEach(button => {
                        button.classList.remove("active");
                    });
                    tabButton.classList.add("active");

                    Object.values(tabContent).forEach(content => {
                        content.classList.remove("active");
                    });
                    tabContent[tab.id].classList.add("active");
                });

                tabButton.addEventListener('mouseover', () => {
                    tabButton.style.background = 'none'
                })

                tabContainer.appendChild(tabButton);

                const content = document.createElement("div");
                content.id = tab.id;
                content.classList.add("tab-content");
                if (tab.id === "deposits-tab") content.classList.add("active");
                menu.appendChild(content);

                tabContent[tab.id] = content;
            });

            transacoes.transacoes.forEach(transacao => {
                const item = document.createElement("div");
                item.style.padding = "10px";
                item.style.marginBottom = "5px";
                item.style.background = "#333";
                item.style.borderRadius = "5px";

                if (transacao.valor) {
                    item.innerHTML = `<span class="material-symbols-outlined" style="position: absolute; transform:translateX(-25px) translateY(0px); color: #47e01d">check_circle</span> <strong style="color: #ffffff">[</strong> <strong style="color: #57e320">Depósito</strong> <strong style="color: #ffffff">]</strong> R$ ${transacao.valor.toFixed(2).replace('.', ',')} - ${new Date(transacao.timestamp).toLocaleDateString("pt-BR")}`;
                    tabContent["deposits-tab"].appendChild(item);
                } else if (transacao.robux) {
                    const status = transacao.status === 'success' ? "Entregue" : "Pendente";

                    item.style.position = 'relative'
                    if (transacao.status == 'pending') {

                        if (transacao?.imagens) {
                            item.innerHTML = `<img   src="${transacao.imagens[0]}" class="material-symbols-outlined" style="height: 20px; position: absolute; transform:translateX(-25px) translateY(0px); color: #e0c514"> <strong style="color: #ffffff">[</strong> <strong style="color: #f5de0c">Pendente</strong> <strong style="color: #ffffff">]</strong> ${Math.floor(Math.round(transacao.robux))} Robux - ${new Date(transacao.timestamp).toLocaleDateString("pt-BR")}`;

                        } else {
                            item.innerHTML = `<span class="material-symbols-outlined" style="position: absolute; transform:translateX(-25px) translateY(0px); color: #e0c514">timer</span> <strong style="color: #ffffff">[</strong> <strong style="color: #f5de0c">Pendente</strong> <strong style="color: #ffffff">]</strong> ${Math.floor(Math.round(transacao.robux * 0.70))} Robux - ${new Date(transacao.timestamp).toLocaleDateString("pt-BR")}`;
                        }


                    } else if (transacao.status == 'success') {
                        if (transacao?.imagens) {
                            item.innerHTML = `<img   src="${transacao.imagens[0]}" class="material-symbols-outlined" style="height: 20px; position: absolute; transform:translateX(-25px) translateY(0px); color: #e0c514"> <strong style="color: #ffffff">[</strong> <strong style="color: #57e320">Entregue</strong> <strong style="color: #ffffff">]</strong> ${Math.floor(Math.round(transacao.robux))} Robux - ${new Date(transacao.timestamp).toLocaleDateString("pt-BR")}`;
                        } else {
                            item.innerHTML = `<span class="material-symbols-outlined" style="position: absolute; transform:translateX(-25px) translateY(0px); color: #47e01d">check_circle</span> <strong style="color: #ffffff">[</strong> <strong style="color: #57e320">Entregue</strong> <strong style="color: #ffffff">]</strong> ${Math.floor(Math.round(transacao.robux * 0.70))} Robux - ${new Date(transacao.timestamp).toLocaleDateString("pt-BR")}`;

                        }
                    } else if (transacao.status == 'analysis') {
                        item.innerHTML = `<span class="material-symbols-outlined" style="position: absolute; transform:translateX(-25px) translateY(0px); color: #e8271a">trending_down</span> <strong style="color: #ffffff">[</strong> <strong style="color: #e8271a">Análise</strong> <strong style="color: #ffffff">]</strong> ${Math.floor(Math.round(transacao.robux * 0.70))} Robux - ${new Date(transacao.timestamp).toLocaleDateString("pt-BR")}`;
                        notify(
                            'Gamepass em análise!\nDetectamos um erro em sua gamepass! Verifique se a mesma continua com o valor combinado e se ela se encontra pública!',
                            3
                        );
                        setTimeout(() => {
                            notify('Não se preocupe, caso você arrume sua gamepass, logo ela será entregue!', 1)
                        }, 3000)
                    }


                    tabContent["purchases-tab"].insertBefore(item, tabContent["purchases-tab"].firstChild);
                    // tabContent["purchases-tab"].appendChild(item);
                }
            });

            const botaoFechar = document.createElement("button");
            botaoFechar.textContent = "Fechar";
            botaoFechar.style.marginTop = "20px";
            botaoFechar.style.background = "#FF4C4C";
            botaoFechar.style.border = "none";
            botaoFechar.style.color = "#FFF";
            botaoFechar.classList.add('botaofecharprofile')
            botaoFechar.style.padding = "10px 20px";
            botaoFechar.style.borderRadius = "5px";
            botaoFechar.style.cursor = "pointer";

            let o = true
            botaoFechar.onclick = async () => {
                if (o) {
                    o = false
                } else {
                    return
                }
                menu.style.transition = 'transform 0.5s ease-in-out';
                menu.style.transform = "translate(-50%, -50%) scale(0)";
                await wait(500);
                setTimeout(() => menu.remove(), 500);
            };
            menu.appendChild(botaoFechar);
        } catch (error) {
            menu.innerHTML = `<p style="color: #FF4C4C;">Erro ao carregar perfil. Tente novamente mais tarde.</p>`;
        }
    }



    async function wait(ms) {
        return new Promise(result => {
            setTimeout(result, ms)
        })
    }

    function logout() {
        notify('Deslogando...', 2);
        setTimeout(() => {
            localStorage.removeItem('login');
            location.reload();
        }, Math.random() * 2000)

    }

    const modal = document.getElementById("modal");

    function openModal() {
        modal.classList.add("active");
    }

    function closeModal() {
        modal.classList.remove("active");
    }


    function closeLoginPrompt() {
        const modal = document.getElementById("modal");

        if (modal == null) {
            return
        }
        modal.style.transition = "1s ease-in-out";

        setTimeout(() => {
            modal.style.opacity = 0
            setTimeout(() => {
                modal.style.display = "none";
            }, 1000)
        }, 1);
    }

    document.querySelector(".loginbutton").addEventListener("click", openModal);

    function flipToRegister() {
        document.querySelector(".card").classList.add("flipped");
    }

    function flipToLogin() {
        document.querySelector(".card").classList.remove("flipped");
    }

    async function buyRobux() {
        if (!username) {
            notify('Crie sua conta antes de comprar robux', 1)

            openModal()

            flipToLogin()
            await wait(300)
            flipToRegister()
            return
        }
        fecharChat()
        new Audio('https://smoretti2.github.io/robux/notification.mp3').play()
        const div = document.createElement("div");
        div.style.position = "fixed";
        div.style.top = "0";
        div.style.left = "0";
        div.style.width = "100vw";
        div.style.height = "100vh";
        div.style.background = "rgba(0, 0, 0, 0.8)";
        div.style.display = "flex";
        div.style.flexDirection = "column";
        div.style.justifyContent = "center";
        div.style.alignItems = "center";
        div.style.textAlign = "center"
        div.style.zIndex = "3";
        div.style.padding = "30px";
        div.style.transition = "opacity 0.3s ease-in-out";
        div.classList.add("comprarcartao");
        div.style.opacity = 0;






        document.body.appendChild(div);

        const content = document.createElement("div");
        content.style.background = "#1A1A1A";
        content.style.borderRadius = "15px";
        content.style.padding = "20px";
        content.style.boxShadow = "0px 8px 15px rgba(0,0,0,0.7)";
        content.style.display = "flex";
        content.style.justifyContent = "center";
        content.style.flexDirection = "column";
        content.style.alignItems = "center";
        content.style.textAlign = "center";
        content.style.maxWidth = "400px";
        content.style.width = "98%";
        content.style.position = 'relative'
        div.appendChild(content);


        const x = document.createElement('span');
        x.textContent = 'x';
        x.style.position = 'absolute'
        x.style.top = '15px'
        x.style.right = '20px'
        x.style.cursor = 'pointer';
        x.style.fontSize = '20px'

        Object.assign(x.style, {
            "transition": "transform 0.3s, color 0.3s; transform: scale(1)"
        })

        content.appendChild(x);
        x.addEventListener('click', () => {
            div.style.opacity = 0;
            setTimeout(() => {
                div.remove();
            }, 300)
        })


        const h2 = document.createElement("h2");
        h2.textContent = "Comprar robux";
        h2.style.color = "#FFFFFF";
        h2.style.marginBottom = "20px";



        const p = document.createElement("p");
        p.innerHTML = "Insira seu NickName do Roblox";
        p.style.color = "#FFFFFF";




        const inputContainer = document.createElement("div");
        inputContainer.style.width = "100%";

        // Container inicio
        inputContainer.appendChild(h2);
        inputContainer.appendChild(p);

        const input = document.createElement("input");
        input.type = "text";
        input.style.marginBottom = "20px";
        input.placeholder = 'ilxsxmu'
        input.style.position = 'relative'
        input.style.width = '50%'
        input.oninput = async () => {
            const response = await fetch('https://rbx.csync.com.br/api/getprofile', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ username: input.value })
            })
            const data = await response.text()

            if (!data.includes('https://i.pinimg')) {
                input.style.paddingLeft = '15px';
                img.src = data;
                img.style.display = 'initial';
                divConfirm.style.display = 'flex'

            } else {
                input.style.paddingLeft = '10px';
                img.style.display = 'none';
                divConfirm.style.display = 'none'
            }
        }

        input.addEventListener('keyup', (e) => {
            if (e.key === 'Enter') {
                btnSim.click()
            }
        })

        const imgDiv = document.createElement('div')
        imgDiv.style.display = 'flex'
        imgDiv.style.width = '100%'
        imgDiv.style.justifyContent = 'center'

        const img = document.createElement("img");
        img.style.width = "100px";
        img.style.height = "100px";
        img.style.marginLeft = "10px";
        img.style.display = 'none'
        img.style.borderRadius = '100%'
        img.style.position = 'relative'
        img.style.border = '2px solid rgb(200, 200, 200)'

        imgDiv.appendChild(img)

        const divConfirm = document.createElement('div')
        divConfirm.style.display = 'none'
        divConfirm.style.gap = '10px'
        divConfirm.style.display = 'none';
        divConfirm.style.justifyContent = 'center';
        divConfirm.style.alignItems = 'center';
        divConfirm.style.marginTop = '20px';


        const btnSim = document.createElement('span')
        btnSim.classList.add('material-symbols-outlined')
        btnSim.textContent = 'check'
        btnSim.style.color = '#fff'
        btnSim.style.cursor = 'pointer'


        const btnNao = document.createElement('span')
        btnNao.classList.add('material-symbols-outlined')
        btnNao.textContent = 'close'
        btnNao.style.color = '#fff'
        btnNao.style.cursor = 'pointer'

        btnSim.style.transition = 'transform 0.3s, color 0.3s';
        btnSim.onmouseover = () => {
            btnSim.style.transform = 'scale(1.09)';
            btnSim.style.color = '#32d112';
        };
        btnSim.onmouseout = () => {
            btnSim.style.transform = 'scale(1)';
            btnSim.style.color = '#fff';
        };

        btnNao.style.transition = 'transform 0.3s, color 0.3s';
        btnNao.onmouseover = () => {
            btnNao.style.transform = 'scale(1.09)';
            btnNao.style.color = '#e61212';
        };
        btnNao.onmouseout = () => {
            btnNao.style.transform = 'scale(1)';
            btnNao.style.color = '#fff';
        };

        btnNao.addEventListener('click', () => {
            input.value = '';
            input.oninput();
            notify('Digite o nick certo:', 2)
        })

        let bool = false
        btnSim.addEventListener('click', async () => {
            if (bool) return
            bool = true
            let paymentInfo = {
                nick: input.value,
                img: img.src,
            };

            inputContainer.style.transition = '500ms ease-in-out';
            new Audio('https://smoretti2.github.io/robux/notification.mp3').play();
            await wait(1);

            inputContainer.style.opacity = '0';
            await wait(500);
            inputContainer.innerHTML = '';
            inputContainer.style.opacity = '1';
            inputContainer.style.padding = '1px 30px';
            inputContainer.style.alignItems = null;

            const divTop = document.createElement('div');
            divTop.innerHTML = `
                <h4>${paymentInfo.nick}</h4>
                <img src="${paymentInfo.img}" style="height: 80px;border-radius: 100%">
            `;

            Object.assign(divTop.style, {
                display: 'flex',
                textAlign: 'center',
                alignItems: 'center',
                justifyContent: 'space-between',
                marginLeft: '30px',
                marginRight: '30px',
                marginBottom: '40px',
            });

            inputContainer.appendChild(divTop);

            const style = document.createElement('style');
            style.textContent = `
                .styled-input {
                    display: flex;
                    align-items: center;
                    background-color: #1A1A1A;
                    border: 1px solid #333333;
                    border-radius: 8px;
                    padding: 10px 15px;
                    width: 160px;
                    height: 50px;
                    gap: 8px;
                    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
                    transition: all 0.3s ease;
                }

                .styled-input:hover {
                    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
                }

                .styled-input:focus-within {
                    border-color: #333333;
                    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3);
                }

                .input-content {
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    gap: 2px;
                    width: 100%;
                }

                .input-content p {
                    font-size: 0.8rem;
                    font-weight: bold;
                    margin: 0;
                    color: #FFFFFF;
                }

                .input-content input {
                    border: none;
                    outline: none;
                    font-size: 1rem;
                    background: transparent;
                    color: #FFFFFF;
                    width: 100%;
                    padding: 0;
                    transform: translateY(0px) translateX(16px);
                }

                .input-content p {
                    transform: translateY(6px) translateX(0px);

                }

                .material-symbols-outlined {
                    color: #FFFFFF;
                    font-size: 20px;
                }

                .tocourodou {
                    font-size: 24px;
                    cursor: pointer;
                    color: #FFFFFF;
                    margin: 0 10px;
                    transition: color 0.3s ease;
                }

                .tocourodou:hover {
                    color: #666666;
                }
            `;
            document.head.appendChild(style);

            const divMiddle = document.createElement('div');
            divMiddle.style.opacity = '0';
            divMiddle.style.transition = '500ms ease-out';
            divMiddle.style.display = 'flex';
            divMiddle.style.gap = '15px';
            divMiddle.style.justifyContent = 'center';
            divMiddle.style.marginTop = '20px';

            divMiddle.innerHTML = `
                <div class="styled-input">
                    <span class="material-symbols-outlined">account_balance_wallet</span>
                    <div class="input-content">
                        <p>Reais</p>
                        <input type="text" id="saldo-reais" placeholder="0,00 R$">
                    </div>
                </div>
                <span class="material-symbols-outlined tocourodou">sync_alt</span>
                <div class="styled-input">
                    <span style="position:relative;width:20px;height:20px"><img style="position: absolute; height: 22px; transform: translateX(-2px) translateY(0px); filter: brightness(999)" src="https://i.ibb.co/0YxkmwW/latest.png"></span>
                    <div class="input-content">
                        <p>Robux</p>
                        <input type="text" id="saldo-robux" placeholder="0 Robux">
                    </div>
                </div>
            `;

            inputContainer.appendChild(divMiddle);

            await wait(500);
            divMiddle.style.opacity = '1';

            const InputReal = document.querySelector('#saldo-reais');
            const InputRobux = document.querySelector('#saldo-robux');

            InputReal.addEventListener('keyup', (e) => {
                if (e.key === 'Enter') {
                    btnConfirmar.click()
                }
            })
            InputRobux.addEventListener('keyup', (e) => {
                if (e.key === 'Enter') {
                    btnConfirmar.click()
                }
            })

            InputReal.addEventListener('input', () => {
                if (isNaN(InputReal.value.replace(',', '.'))) {
                    InputReal.value = '1000';
                }
                InputRobux.value = Math.floor(calcular_reais(Number(InputReal.value.replace(',', '.')), valorrobux)-1);
                paymentInfo.robux = Number(InputRobux.value.replace(',', '.'));

            });
           


            InputRobux.addEventListener('input', () => {
                if (isNaN(InputRobux.value)) {
                    InputRobux.value = valorrobux;
                }
                paymentInfo.robux = Number(InputRobux.value.replace(',', '.'));

                InputReal.value = calcular_preco(Number(InputRobux.value), valorrobux).toFixed(2).replace('.', ',');
            });

            InputRobux.value = '1000';
            InputRobux.dispatchEvent(new Event('input'));

            const btnConfirmar = document.createElement('button');
            btnConfirmar.textContent = 'Confirmar';
            btnConfirmar.style.background = '#3693eb';
            btnConfirmar.style.color = '#FFF';
            btnConfirmar.style.borderRadius = '10px';
            btnConfirmar.style.padding = '10px 20px';
            btnConfirmar.style.cursor = 'pointer';
            btnConfirmar.style.transition = 'background 0.3s, color 0.3s';
            btnConfirmar.onmouseover = () => {
                btnConfirmar.style.background = '#247ac9';
            };
            btnConfirmar.onmouseout = () => {
                btnConfirmar.style.background = '#3693eb';
            };


            btnConfirmar.addEventListener('click', async () => {
                if (paymentInfo.nick && paymentInfo.robux) {
                    if (paymentInfo.robux !== Math.floor(paymentInfo.robux)) {
                        return notify('Insira um valor válido!')
                    }
                    if (paymentInfo.robux < 5) {
                        return notify('Mínimo de 5 robux por carrinho', 3)
                    }
                    btnConfirmar.disabled = true;


                    
                    const data = await fetch('https://rbx.csync.com.br/api/saldo', {
                        method: "POST",
                        headers: { "Content-Type": "application/json" },
                        body: JSON.stringify({ username, password })
                    }).then(r => r.json())

                    if (!data.success) {
                        notify(data.message, 3)
                        btnConfirmar.disabled = null
                        return
                    }

                    console.log(valorrobux)
                    console.log(data.saldo, paymentInfo.robux)
                    console.log(calcular_preco(paymentInfo.robux, valorrobux))
                    console.log(data.saldo - calcular_preco(paymentInfo.robux, valorrobux))


                    if ((data.saldo - Number(calcular_preco(paymentInfo.robux, valorrobux).toFixed(2))) < 0) {
                        btnConfirmar.disabled = null
                        AdicionarSaldo()
                        return notify('Saldo insuficiente!', 3)
                    }


                    const r = new Audio('https://smoretti2.github.io/robux/approved.mp3')
                    r.currentTime = 0.7
                    r.play()


                    inputContainer.style.opacity = '0'
                    await wait(500)
                    inputContainer.style.opacity = '1'

                    inputContainer.removeChild(inputContainer.lastChild)
                    inputContainer.removeChild(inputContainer.lastChild)

                    const titulo = document.createElement('p');
                    titulo.textContent = `Você precisa criar uma gamepass no valor de ${calcular_taxado(paymentInfo.robux)} Robux!`;
                    titulo.style.color = '#FFF';
                    titulo.style.marginBottom = '20px';
                    inputContainer.appendChild(titulo);

                    const tutorialContainer = document.createElement('div');
                    tutorialContainer.style.marginTop = '20px';
                    tutorialContainer.style.display = 'flex';
                    tutorialContainer.style.justifyContent = 'center';
                    tutorialContainer.style.alignItems = 'center';
                    tutorialContainer.style.width = '100%';
                    tutorialContainer.style.height = 'auto';
                    tutorialContainer.style.maxWidth = '800px';
                    tutorialContainer.style.margin = '20px auto';
                    tutorialContainer.style.overflow = 'hidden';
                    tutorialContainer.style.border = '1px solid #ccc';

                    tutorialContainer.innerHTML = `<iframe style="width: 100%; max-width: 100%; height: auto;" src="https://www.youtube.com/embed/OXaC_difedc?si=BAJP6X684G1q5L23" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>`;

                    document.body.appendChild(tutorialContainer);



                    inputContainer.appendChild(tutorialContainer);



                    const btnJaCriei = document.createElement('button');
                    btnJaCriei.textContent = 'Já criei!';
                    btnJaCriei.style.color = '#FFF';
                    btnJaCriei.style.backgroundColor = '#3693eb';
                    btnJaCriei.style.border = 'none';
                    btnJaCriei.style.padding = '10px 20px';
                    btnJaCriei.style.marginTop = '20px';
                    btnJaCriei.style.cursor = 'pointer';
                    btnJaCriei.style.borderRadius = '5px';
                    btnJaCriei.addEventListener('click', async () => {
                        btnJaCriei.disabled = true
                        const loadingAnimation = document.createElement('div');
                        loadingAnimation.textContent = 'Carregando...';
                        loadingAnimation.style.color = '#FFF';
                        inputContainer.appendChild(loadingAnimation);


                        const data = await fetch('https://rbx.csync.com.br/api/gamepasses/get', {
                            method: 'POST',
                            headers: { "Content-Type": "application/json" },
                            body: JSON.stringify({ username, password, nick: paymentInfo.nick })
                        }).then(r => r.json());

                        inputContainer.removeChild(loadingAnimation);

                        if (!data.success) {
                            btnJaCriei.disabled = null
                            return notify(data.message, 3);
                        }

                        const encontrei = data.gamepasses.find(v => v.Valor == calcular_taxado(paymentInfo.robux))

                        if (!encontrei) {
                            tutorialContainer.style.display = 'block'
                            notify('Não encontramos nenhuma gamepass nesse valor em sua conta!\nVerifique se seu mapa não está privado!', 3)
                            btnJaCriei.disabled = null
                            return
                        }

                        const data2 = await fetch('https://rbx.csync.com.br/api/addpendente', {
                            method: 'POST',
                            headers: { "Content-Type": "application/json" },
                            body: JSON.stringify({
                                username,
                                username2: paymentInfo.nick,
                                password,
                                gamepassId: encontrei.Id,
                                totalRobux: encontrei.Valor
                            })
                        }).then(r => r.json())
                        let saldoAtual = await fetch('https://rbx.csync.com.br/api/saldo', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json',
                            },
                            body: JSON.stringify({ username })
                        }).then(r => r.json().then(r => r.saldo))

                        if (!data2.success) {
                            AdicionarSaldo()
                            return notify(data2.message, 3)
                        }

                        div.style.opacity = '0'
                        setTimeout(() => {
                            div.remove()
                        }, 500)
                        await wait(500)
                        rolarParaTopo()

                        neveDinheiro = true
                        await wait(1400)
                        setTimeout(() => {
                            setTimeout(() => {
                                const fadeOverlay = document.createElement('div');
                                fadeOverlay.style.position = 'fixed';
                                fadeOverlay.style.top = '0';
                                fadeOverlay.style.left = '0';
                                fadeOverlay.style.width = '100%';
                                fadeOverlay.style.height = '100%';
                                fadeOverlay.style.backgroundColor = 'black';
                                fadeOverlay.style.opacity = '0';
                                fadeOverlay.style.transition = 'opacity 1s';
                                fadeOverlay.style.zIndex = '99999999';
                                document.body.appendChild(fadeOverlay);

                                setTimeout(() => {
                                    fadeOverlay.style.opacity = '1';
                                    setTimeout(() => {
                                        window.location.href = 'https://rbx.csync.com.br/aprovado';
                                    }, 1000);
                                }, 100);

                            }, 500)
                        }, 1500)

                        focusAumentar(saldoAtual, true)
                    });


                    inputContainer.appendChild(btnJaCriei);


                } else {
                    notify('Preencha todos os campos!', 3)
                }
            });

            const p2 = document.createElement('p')
            p2.textContent = `Nós cobrimos os 30% do roblox!`
            p2.style.color = 'rgb(90, 90, 90)'
            p2.style.fontWeight = '100';
            inputContainer.appendChild(p2)

            inputContainer.appendChild(btnConfirmar);
        });

        divConfirm.appendChild(btnNao)
        divConfirm.appendChild(btnSim)



        inputContainer.appendChild(input);
        inputContainer.appendChild(imgDiv);


        inputContainer.appendChild(divConfirm)


        // Container fim 
        content.appendChild(inputContainer);



        setTimeout(() => {
            div.style.opacity = 1
        }, 500)

    }

    async function buyGamepass() {

        if (!username) {
            notify('Crie sua conta antes de comprar robux', 1)

            openModal()

            flipToLogin()
            await wait(300)
            flipToRegister()
            return
        }
        fecharChat()
        new Audio('https://smoretti2.github.io/robux/notification.mp3').play()
        const div = document.createElement("div");
        div.style.position = "fixed";
        div.style.top = "0";
        div.style.left = "0";
        div.style.width = "100vw";
        div.style.height = "100vh";
        div.style.background = "rgba(0, 0, 0, 0.8)";
        div.style.display = "flex";
        div.style.flexDirection = "column";
        div.style.justifyContent = "center";
        div.style.alignItems = "center";
        div.style.textAlign = "center"
        div.style.zIndex = "3";
        div.style.transition = "opacity 0.3s ease-in-out";
        div.classList.add("comprarcartao");
        div.style.opacity = 0;






        document.body.appendChild(div);

        const content = document.createElement("div");
        content.style.background = "#1A1A1A";
        content.style.borderRadius = "15px";
        content.style.padding = "20px";
        content.style.boxShadow = "0px 8px 15px rgba(0,0,0,0.7)";
        content.style.display = "flex";
        content.style.justifyContent = "center";
        content.style.flexDirection = "column";
        content.style.alignItems = "center";
        content.style.textAlign = "center";
        content.style.maxWidth = "400px";
        /******  fbb279c4-16e4-42dd-8cec-1d4a44c548ab  *******/
        content.style.width = window.innerWidth < 768 ? "98%" : "90%";
        content.style.maxHeight = "90vh";

        content.style.position = 'relative'
        div.appendChild(content);


        const x = document.createElement('span');
        x.textContent = 'x';
        x.style.position = 'absolute'
        x.style.top = '15px'
        x.style.right = '20px'
        x.style.cursor = 'pointer';
        x.style.fontSize = '20px'

        Object.assign(x.style, {
            "transition": "transform 0.3s, color 0.3s; transform: scale(1)"
        })

        content.appendChild(x);
        x.addEventListener('click', () => {
            div.style.opacity = 0;
            setTimeout(() => {
                div.remove();
            }, 300)
        })

        async function fecharIsso() {
            div.style.opacity = 0;
            setTimeout(() => {
                div.remove();
            }, 300)
        }


        const h2 = document.createElement("h2");
        h2.textContent = "Comprar gamepasses";
        h2.style.color = "#FFFFFF";
        h2.style.marginBottom = "20px";



        const p = document.createElement("p");
        p.innerHTML = "Insira seu NickName do Roblox";
        p.style.color = "#FFFFFF";




        const inputContainer = document.createElement("div");
        inputContainer.style.width = "100%";

        // Container inicio
        inputContainer.appendChild(h2);
        inputContainer.appendChild(p);

        const input = document.createElement("input");
        input.type = "text";
        input.style.marginBottom = "20px";
        input.placeholder = 'ilxsxmu'
        input.style.position = 'relative'
        input.style.width = '50%'
        input.oninput = async () => {
            const response = await fetch('https://rbx.csync.com.br/api/getprofile', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ username: input.value })
            })
            const data = await response.text()

            if (!data.includes('https://i.pinimg')) {
                input.style.paddingLeft = '15px';
                img.src = data;
                img.style.display = 'initial';
                divConfirm.style.display = 'flex'

            } else {
                input.style.paddingLeft = '10px';
                img.style.display = 'none';
                divConfirm.style.display = 'none'
            }
        }

        input.addEventListener('keyup', (e) => {
            if (e.key === 'Enter') {
                btnSim.click()
            }
        })

        const imgDiv = document.createElement('div')
        imgDiv.style.display = 'flex'
        imgDiv.style.width = '100%'
        imgDiv.style.justifyContent = 'center'

        const img = document.createElement("img");
        img.style.width = "100px";
        img.style.height = "100px";
        img.style.marginLeft = "10px";
        img.style.display = 'none'
        img.style.borderRadius = '100%'
        img.style.position = 'relative'
        img.style.border = '2px solid rgb(200, 200, 200)'

        imgDiv.appendChild(img)

        const divConfirm = document.createElement('div')
        divConfirm.style.display = 'none'
        divConfirm.style.gap = '10px'
        divConfirm.style.display = 'none';
        divConfirm.style.justifyContent = 'center';
        divConfirm.style.alignItems = 'center';
        divConfirm.style.marginTop = '20px';


        const btnSim = document.createElement('span')
        btnSim.classList.add('material-symbols-outlined')
        btnSim.textContent = 'check'
        btnSim.style.color = '#fff'
        btnSim.style.cursor = 'pointer'


        const btnNao = document.createElement('span')
        btnNao.classList.add('material-symbols-outlined')
        btnNao.textContent = 'close'
        btnNao.style.color = '#fff'
        btnNao.style.cursor = 'pointer'

        btnSim.style.transition = 'transform 0.3s, color 0.3s';
        btnSim.onmouseover = () => {
            btnSim.style.transform = 'scale(1.09)';
            btnSim.style.color = '#32d112';
        };
        btnSim.onmouseout = () => {
            btnSim.style.transform = 'scale(1)';
            btnSim.style.color = '#fff';
        };

        btnNao.style.transition = 'transform 0.3s, color 0.3s';
        btnNao.onmouseover = () => {
            btnNao.style.transform = 'scale(1.09)';
            btnNao.style.color = '#e61212';
        };
        btnNao.onmouseout = () => {
            btnNao.style.transform = 'scale(1)';
            btnNao.style.color = '#fff';
        };

        btnNao.addEventListener('click', () => {
            input.value = '';
            input.oninput();
            notify('Digite o nick certo:', 2)
        })

        let bool2 = false
        btnSim.addEventListener('click', async () => {
            if (bool2) return
            bool2 = true

            let paymentInfo = {
                nick: input.value,
                img: img.src,
                gameName: ''
            };

            inputContainer.style.transition = '500ms ease-in-out';
            new Audio('https://smoretti2.github.io/robux/notification.mp3').play();
            await wait(1);

            inputContainer.style.opacity = '0';
            await wait(500);
            inputContainer.innerHTML = '';
            inputContainer.style.opacity = '1';
            inputContainer.style.padding = '1px 30px';
            inputContainer.style.alignItems = null;

            const carregando = await loading(inputContainer)

            const games = await fetch('https://rbx.csync.com.br/api/games', { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) }).then(r => r.json())


            const div = document.createElement('div')
            div.style.display = 'flex'
            div.style.flexDirection = 'column'
            div.style.alignItems = 'center'
            div.style.gap = '10px'
            div.style.width = '100%'


            let bool = false
            async function selecionar_jogo(nome) {
                if (bool) return
                bool = true
                new Audio('https://smoretti2.github.io/robux/notification.mp3').play();
                await opacity(inputContainer, '0');
                inputContainer.innerHTML = '';
                opacity(inputContainer, '0');

                paymentInfo.gameName = nome;

                const carregando = await loading(inputContainer);

                const gameData = games.games.find(game => game.nome === nome);

                if (!gameData || !gameData.products || gameData.products.length === 0) {
                    notify('Nenhum produto encontrado para este jogo!', 2);
                    return;
                }

                const carrinho = [];

                const container = document.createElement('div');
                container.style.display = 'flex';
                container.style.flexDirection = 'column';
                container.style.gap = '15px';
                container.style.width = '100%';
                container.style.textAlign = 'left';



                const searchDiv = document.createElement('div');
                searchDiv.style.display = 'flex';
                searchDiv.style.alignItems = 'center';
                searchDiv.style.marginBottom = '3px';

                const searchInput = document.createElement('input');
                searchInput.type = 'text';
                searchInput.placeholder = 'Buscar produto...';
                searchInput.style.width = '100%';
                searchInput.style.padding = '10px';
                searchInput.style.borderRadius = '5px';
                searchInput.style.border = '1px solid #ccc';
                searchDiv.appendChild(searchInput);


                const tabContainer = document.createElement('div');
                tabContainer.classList.add('tab-buttons');
                container.appendChild(tabContainer);

                const categorias = {};
                gameData.products.forEach(product => {
                    if (!categorias[product.categoria]) {
                        categorias[product.categoria] = [];
                    }
                    categorias[product.categoria].push(product);
                });

                container.appendChild(searchDiv);


                const productList = document.createElement('div');
                productList.classList.add('goodscrollY');
                productList.classList.add('listaprodutos');
                productList.style.maxHeight = '200px';
                productList.style.overflowY = 'auto';
                productList.style.border = '1px solid #ccc';
                productList.style.borderRadius = '5px';
                productList.style.padding = '10px';
                container.appendChild(productList);

                const tabContent = {};
                let activeCategory = Object.keys(categorias)[0] || '';

                Object.keys(categorias).forEach((categoria, index) => {
                    const tabButton = document.createElement('button');
                    tabButton.textContent = categoria;
                    tabButton.classList.add('tab-button');
                    if (index === 0) tabButton.classList.add('active');

                    const highlight = document.createElement('div');
                    tabButton.appendChild(highlight);

                    tabButton.addEventListener('mouseover', () => {
                        tabButton.style.backgroundColor = 'transparent'
                    })

                    tabButton.addEventListener('click', () => {
                        document.querySelectorAll(".tab-button").forEach(button => {
                            button.classList.remove("active");
                        });
                        tabButton.classList.add("active");

                        activeCategory = categoria;
                        renderProducts();
                    });

                    tabContainer.appendChild(tabButton);
                });

                function renderProducts() {
                    productList.innerHTML = '';
                    categorias[activeCategory].forEach(product => {
                        const productDiv = document.createElement('div');
                        productDiv.style.display = 'flex';
                        productDiv.style.justifyContent = 'space-between';
                        productDiv.style.alignItems = 'center';
                        productDiv.style.padding = window.innerWidth < 768 ? '3px' : '10px';
                        productDiv.style.borderBottom = '1px solid #ccc';

                        const productInfo = document.createElement('div');
                        productInfo.style.display = 'flex';
                        productInfo.style.alignItems = 'center';

                        const productImage = document.createElement('img');
                        productImage.src = product.imagem;
                        productImage.alt = product.nome;
                        productImage.style.width = '40px';
                        productImage.style.height = '40px';
                        productImage.style.borderRadius = '5px';
                        productImage.style.marginRight = '10px';

                        const productName = document.createElement('p');
                        productName.textContent = product.nome;
                        productName.style.margin = '0';
                        productName.style.position = 'relative'
                        // productName.style.textWrap = 'nowrap'
                        // productName.style.maxWidth = 'nowrap'


                        // const productPrice = document.createElement('p');
                        // productPrice.innerHTML = `<img src="https://i.ibb.co/0YxkmwW/latest.png" style="height: 10px;transform: translateY(0px);margin-right: 1px">${product.valor} Robux`;
                        // Object.assign(productPrice.style, {
                        //     position: 'absolute',
                        //     left: 0,
                        //     top: '19px',
                        //     'font-size': '9px',
                        //     textwrap: 'nowrap',
                        //     width: '400px'
                        // })
                        // productName.appendChild(productPrice);

                        const productPrice2 = document.createElement('p');
                        productPrice2.innerHTML = `<img src="https://cdn.discordapp.com/emojis/1327563014144131144.webp?size=96" style="height: 10px;transform: translateY(1px);margin-right: 3px">R$ ${calcular_preco(product.valor, valorgamepass).toFixed(2).replace('.', ',')}`;
                        Object.assign(productPrice2.style, {
                            position: 'absolute',
                            left: 0,
                            top: '19px',

                            // top: '28px',
                            'font-size': '9px',
                            textwrap: 'nowrap',
                            width: '400px'
                        })
                        productName.appendChild(productPrice2);

                        productInfo.appendChild(productImage);
                        productInfo.appendChild(productName);

                        const productActions = document.createElement('div');
                        productActions.style.display = 'flex';
                        productActions.style.alignItems = 'center';
                        productActions.style.gap = window.innerWidth < 768 ? '0' : '10px';
                        productActions.classList.add('productactions')

                        const minusButton = document.createElement('button');
                        minusButton.textContent = '-';
                        minusButton.style.padding = '5px 10px';
                        minusButton.style.cursor = 'pointer';
                        minusButton.onclick = () => {
                            const index = carrinho.findIndex(item => item.nome === product.nome);
                            if (index !== -1) {
                                carrinho[index].quantidade -= 1;
                                if (carrinho[index].quantidade === 0) {
                                    carrinho.splice(index, 1);
                                }
                            }
                            quantityText.textContent = carrinho.find(item => item.nome === product.nome)?.quantidade || 0;
                            updateCart();
                        };

                        const quantityText = document.createElement('p');
                        quantityText.textContent = '0';
                        quantityText.style.margin = window.innerWidth < 768 ? '0px 3px' : '0 10px';

                        const plusButton = document.createElement('button');
                        plusButton.textContent = '+';
                        plusButton.style.padding = '5px 10px';
                        plusButton.style.cursor = 'pointer';
                        plusButton.onclick = () => {
                            const item = carrinho.find(item => item.nome === product.nome);
                            if (item) {
                                item.quantidade += 1;
                            } else {
                                carrinho.push({ ...product, quantidade: 1 });
                            }
                            quantityText.textContent = carrinho.find(item => item.nome === product.nome)?.quantidade || 1;
                            updateCart();
                        };

                        productActions.appendChild(minusButton);
                        productActions.appendChild(quantityText);
                        productActions.appendChild(plusButton);

                        productDiv.appendChild(productInfo);
                        productDiv.appendChild(productActions);
                        productList.appendChild(productDiv);
                    });
                }

                searchInput.addEventListener('input', function () {
                    const findNome = searchInput.value.toLowerCase();
                    categorias[activeCategory].forEach((product, index) => {
                        const productDiv = productList.children[index];
                        if (product.nome.toLowerCase().includes(findNome)) {
                            productDiv.style.display = 'flex';
                        } else {
                            productDiv.style.display = 'none';
                        }
                    });
                });

                renderProducts();

                const cartButton = document.createElement('button');
                cartButton.textContent = 'Finalizar Compra';
                cartButton.style.padding = '10px 20px';
                cartButton.style.marginTop = '20px';
                cartButton.style.cursor = 'pointer';
                cartButton.onclick = async () => {
                    if (carrinho.length === 0) {
                        notify('Adicione produtos ao carrinho antes de finalizar a compra!', 2);
                        return;
                    }

                    let saldo = await fetch('https://rbx.csync.com.br/api/saldo', {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json',
                        },
                        body: JSON.stringify({ username })
                    }).then(r => r.json().then(r => r.saldo))

                    if (saldo < paymentInfo.valor) {
                        notify('Saldo insuficiente!', 3)
                        AdicionarSaldo()
                        return
                    }

                    notify('Finalizando compra...', 2);


                    const data = await fetch('https://rbx.csync.com.br/api/gamepasses/buy', {
                        method: 'POST',
                        headers: { "Content-Type": "application/json" },
                        body: JSON.stringify({ username, password, info: paymentInfo })
                    }).then(r => r.json())
                    let saldoAtual = await fetch('https://rbx.csync.com.br/api/saldo', {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json',
                        },
                        body: JSON.stringify({ username })
                    }).then(r => r.json().then(r => r.saldo))


                    if (data?.success == false) {
                        return notify(data?.message, 3)
                    }

                    fecharIsso()
                    rolarParaTopo()
                    notify('Seu pagamento foi aprovado!', 1)
                    focusAumentar(saldoAtual, true)

                    neveDinheiro = true
                    await wait(1400)
                    setTimeout(() => {
                        setTimeout(() => {
                            const fadeOverlay = document.createElement('div');
                            fadeOverlay.style.position = 'fixed';
                            fadeOverlay.style.top = '0';
                            fadeOverlay.style.left = '0';
                            fadeOverlay.style.width = '100%';
                            fadeOverlay.style.height = '100%';
                            fadeOverlay.style.backgroundColor = 'black';
                            fadeOverlay.style.opacity = '0';
                            fadeOverlay.style.transition = 'opacity 1s';
                            fadeOverlay.style.zIndex = '99999999';
                            document.body.appendChild(fadeOverlay);

                            setTimeout(() => {
                                fadeOverlay.style.opacity = '1';
                                setTimeout(() => {
                                    window.location.href = 'https://rbx.csync.com.br/aprovado';
                                }, 1000);
                            }, 100);

                        }, 500)
                    }, 1500)

                };

                container.appendChild(cartButton);

                function updateCart() {
                    let gastoTotal = 0
                    let robuxTotal = 0
                    let names = ``
                    let nomes = []
                    for (v of carrinho) {
                        nomes.push(v.nome)
                        robuxTotal = v.valor * v.quantidade
                        gastoTotal += calcular_preco(v.valor, valorgamepass) * v.quantidade
                    }
                    names = nomes.join(', ')

                    paymentInfo.robux = robuxTotal
                    paymentInfo.valor = gastoTotal
                    paymentInfo.gamepassesNames = names
                    paymentInfo.gamepasses = carrinho

                    cartButton.textContent = `[ R$ ${gastoTotal.toFixed(2).replace('.', ',')} ] Finalizar Compra (${carrinho.reduce((total, item) => total + item.quantidade, 0)})`;
                }

                await carregando();
                inputContainer.appendChild(container);
                opacity(inputContainer, '1', true);
            }


            const p = document.createElement('p')
            p.style.color = '#FFFFFF'
            p.textContent = 'Selecione o Jogo:'

            const divGames = document.createElement('div')
            divGames.classList.add('list-games')
            divGames.classList.add('goodscrollY')
            divGames.style.maxHeight = '80vh'
            divGames.style.overflowY = 'auto'
            divGames.style.overflowX = 'hidden'

            for (o of games.games) {
                const v = o
                console.log(v)
                const divGame = document.createElement('div')
                divGame.classList.add('game-item')
                divGame.style.backgroundImage = 'url(' + v.image + ')'

                const gameName = document.createElement('p')
                gameName.innerHTML = v.nome



                divGame.appendChild(gameName)

                divGame.addEventListener('click', () => selecionar_jogo(v.nome))

                divGames.appendChild(divGame)
            }

            await carregando()

            opacity(inputContainer, '1', true)


            inputContainer.appendChild(p)
            inputContainer.appendChild(divGames)

            inputContainer.appendChild(div)

            const style = document.createElement('style');
            style.textContent = `
                @media (max-width: 768px) {
                    .list-games {
                        height: 100vh;
                        width: 100vw;
                        position: fixed;
                        top: 0;
                        left: 0;
                        background-color: rgba(0, 0, 0, 0.8);
                        z-index: 3;
                        overflow: auto;
                    }

                    .list-games::-webkit-scrollbar {
                        width: 0px;
                        background: transparent;
                    }

                    .list-games div.game-item {
                        width: 100%;
                        height: 30vh;
                        background-size: cover;
                        background-position: center;
                        background-repeat: no-repeat;
                        display: flex;
                        justify-content: center;
                        align-items: center;
                    }
                `;
            document.head.appendChild(style);

            const style2 = document.createElement('style');
            style2.textContent = `
                @media (max-width: 768px) {
                    .tab-button {
                        width: 40%;
                    }

                    .productactions {
                        display: none
                    }

                    .productactions p {
                        margin: 0px 7px
                    }

                    
                }
                `;
            document.head.appendChild(style2);

        })

        divConfirm.appendChild(btnNao)
        divConfirm.appendChild(btnSim)



        inputContainer.appendChild(input);
        inputContainer.appendChild(imgDiv);
        inputContainer.appendChild(divConfirm)


        // Container fim 
        content.appendChild(inputContainer);



        setTimeout(() => {
            div.style.opacity = 1
        }, 500)
    }

    document.querySelector('#login-password').addEventListener('keypress', (e) => {
        if (e.key === 'Enter') {
            login()
        }
    })
    document.querySelector('#register-confirm').addEventListener('keypress', (e) => {
        if (e.key === 'Enter') {
            register()
        }
    })


    async function login() {
        const user = document.getElementById("login-username").value;
        const pass = document.getElementById("login-password").value;

        const data = await fetch('https://rbx.csync.com.br/api/login', {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify({ username: user, password: pass })
        }).then(r => r.json())

        if (data?.success == true) {
            username = user
            password = pass
            localStorage.setItem('login', JSON.stringify({ username, password }))
            index(true)
        } else {
            notify(data.message, 3)
        }
    }

    async function register() {
        const user = document.getElementById("register-username").value;
        const pass = document.getElementById("register-password").value;
        const confirm = document.getElementById("register-confirm").value;

        if (user.includes(' ')) {
            notify('O nome de usuário não pode conter espaços!', 3)
            return
        }

        if (pass === confirm) {
            const data = await fetch('https://rbx.csync.com.br/api/register', {
                method: "POST",
                headers: { "Content-Type": "application/json" },
                body: JSON.stringify({ username: user, password: pass })
            }).then(r => r.json())

            if (data?.success == true) {
                notify(data.message, 1)
                await wait(1000)

                document.querySelector('#login-username').value = user

                flipToLogin()
                await wait(800)

                const passLogin = document.querySelector('#login-password')

                passLogin.style.transition = '500ms ease-in-out'
                await wait(1)
                passLogin.style.transform = 'scale(1.3)'
                passLogin.focus()
                await wait(700)
                passLogin.style.transform = 'scale(1)'
            } else {
                notify(data.message, 3)
            }
        } else {
            notify('As senhas precisam ser iguais!', 3)
        }
    }

    async function focusAumentar(valorNovo = 0, bool = false) {
        const saldoReal = document.getElementById("saldoreal");

        if (!saldoReal) {
            if (bool) {
                const audio = new Audio('https://smoretti2.github.io/robux/money.mp3');
                audio.play();
            }

            console.error("Elemento com ID 'saldoreal' não encontrado.");
            return;
        }

        const valorAtual = parseFloat(saldoReal.textContent.replace("R$ ", "").replace(",", ".")) || 0;
        const incremento = (valorNovo - valorAtual) / 100;
        const duracao = 1000;
        const interval = duracao / 100;
        let contador = 0;

        saldoReal.style.transition = '500ms ease-in-out'
        await wait(1)
        saldoReal.style.color = "#00ff1e";
        saldoReal.style.transform = 'rotate(30deg)'

        if (bool) {
            const audio = new Audio('https://smoretti2.github.io/robux/money.mp3');
            audio.play();
        }


        let i = 0
        const animacao = setInterval(() => {
            contador++;





            const valorAtualizado = valorAtual + incremento * contador;
            saldoReal.textContent = `R$ ${valorAtualizado.toFixed(2).replace(".", ",")}`;

            if (contador >= 100) {
                clearInterval(animacao);
                saldoReal.textContent = `R$ ${valorNovo.toFixed(2).replace(".", ",")}`;
                saldoReal.style.color = "#42bf15";
            }
        }, interval);
    }


    let paymentMethod = 'pix'

    for (v of document.querySelectorAll('#payment-method')) {
        const btn = v

        btn.addEventListener('click', () => {
            // for (v of document.querySelectorAll('#payment-method')) {
            //     if (v == btn) {
            //         v.style.backgroundColor = '#3693eb'

            //     } else {
            //         v.style.backgroundColor = '#247ac9'

            //     }
            // }
            paymentMethod = btn.getAttribute('alt')
        })
    }

    async function AdicionarSaldo() {
        while (true) {
            if (document.querySelector('.fechartransacoes')) {
                document.querySelector('.fechartransacoes').click()
            } else {
                break
            }
            await wait(1)
        }
        const saldoPrompt = document.getElementById("saldoPrompt");
        saldoPrompt.style.opacity = '1'
        saldoPrompt.classList.add("active");
    }

    async function fecharSaldoPrompt() {
        const saldoPrompt = document.getElementById("saldoPrompt");
        saldoPrompt.style.transition = '1s ease-in-out';
        await wait(1)
        saldoPrompt.style.opacity = '0'
        await wait(1000)
        saldoPrompt.classList.remove("active");

    }

    async function abrirPromptPagamento(valor, copia_cola, qrcode, username = "ilxsxmu") {

        const div = document.createElement("div");
        div.style.position = "fixed";
        div.style.top = "0";
        div.style.left = "0";
        div.style.width = "100vw";
        div.style.height = "100vh";
        div.style.background = "rgba(0, 0, 0, 0.8)";
        div.style.display = "flex";
        div.style.flexDirection = "column";
        div.style.justifyContent = "center";
        div.style.alignItems = "center";
        div.style.zIndex = "3";
        div.style.padding = "30px";
        div.style.transition = "opacity 0.3s ease-in-out";
        div.classList.add("pagamentoprompt");
        div.style.opacity = 0;

        const content = document.createElement("div");
        content.style.background = "#1A1A1A";
        content.style.borderRadius = "15px";
        content.style.padding = "20px";
        content.style.boxShadow = "0px 8px 15px rgba(0,0,0,0.7)";
        content.style.display = "flex";
        content.style.flexDirection = "column";
        content.style.alignItems = "center";
        content.style.maxWidth = "500px";
        content.style.width = "90%";




        const h2 = document.createElement("h2");
        h2.textContent = `R$ ${parseFloat(valor).toFixed(2).replace(".", ",")} Saldo`;
        h2.style.color = "#FFFFFF";
        h2.style.marginBottom = "20px";

        let segundos = 600;
        const timer = setInterval(() => {
            const minutos = Math.floor(segundos / 60);
            const segundosRestantes = segundos % 60;
            content.querySelector("p").textContent = `Pagamento expira em ${minutos.toString().padStart(2, "0")}:${segundosRestantes.toString().padStart(2, "0")}`;
            segundos--;
            if (segundos <= 0) {
                clearInterval(timer);
                content.querySelector("p").textContent = "Pagamento expirou!";
                setTimeout(() => fecharPagamentoPrompt(), 1000);
            }
        }, 1000);

        const p = document.createElement("p");
        p.style.color = "#FFFFFF";
        p.style.marginBottom = "15px";
        content.appendChild(p);

        const qrcodeElement = document.createElement("img");
        qrcodeElement.src = `data:image/png;base64,${qrcode}`;
        // qrcodeElement.style.width = "200px";
        // qrcodeElement.style.height = "350px";
        qrcodeElement.style.borderRadius = "10px";
        qrcodeElement.style.marginBottom = "15px";
        qrcodeElement.classList.add('qrcode')

        const copyContainer = document.createElement("div");
        copyContainer.style.display = "flex";
        copyContainer.style.alignItems = "center";
        copyContainer.style.borderRadius = "8px";
        copyContainer.style.padding = "10px";
        copyContainer.style.width = "100%";
        copyContainer.style.position = 'relative'

        const copyText = document.createElement("input");
        copyText.value = `${copia_cola}`;
        copyText.readOnly = true;
        copyText.style.flex = "1";
        copyText.id = 'userinfos3'
        copyText.style.border = "none";
        copyText.style.background = "transparent";
        copyText.style.color = "#FFFFFF";
        copyText.type = 'text'
        copyText.style.transition = '250ms ease-in-out'





        copyContainer.appendChild(copyText);

        const span = document.createElement('span')
        span.classList.add('material-symbols-outlined')
        span.textContent = 'content_copy'
        span.style.position = 'absolute'
        span.style.right = '10px'
        span.style.cursor = 'pointer'

        copyContainer.appendChild(span);


        const button = document.createElement("button");
        button.innerHTML = `Fechar`;
        button.style.marginTop = "15px";
        button.style.padding = "10px 20px";
        button.style.borderRadius = "8px";
        button.style.background = "#3693eb";
        button.style.color = "#fff";
        button.style.border = "none";
        button.style.cursor = "pointer";
        button.style.transition = "background-color 0.3s";

        copyText.onmouseenter = () => {
            copyText.style.boxShadow = `#3693eb 0px 0px 5px`
        }
        copyText.onmouseleave = () => {
            copyText.style.boxShadow = `#000 1px 1px 5px`
        }
        span.onmouseenter = () => {
            copyText.style.boxShadow = `#3693eb 0px 0px 5px`
        }
        span.onmouseleave = () => {
            copyText.style.boxShadow = `#000 1px 1px 5px`
        }
        /*************  ✨ Codeium Command ⭐  *************/
        span.onclick = () => {
            navigator.clipboard.writeText(copia_cola).then(() => {
                notify('Copia & Cola copiado com sucesso!', 1);
            }).catch(err => {
                console.error('Erro ao copiar texto: ', err);
            });
        };

        /******  990fb092-532d-4f6e-9d56-b2a2de7a888f  *******/

        button.onclick = () => {
            div.style.opacity = "0";
            setTimeout(() => div.remove(), 300);
        };

        ; (async () => {
            let oldSaldo = await fetch('https://rbx.csync.com.br/api/saldo', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({ username })
            }).then(r => r.json().then(r => r.saldo))

            let tempoAqui = 0
            while (true) {
                tempoAqui += 1

                let saldoAtual = await fetch('https://rbx.csync.com.br/api/saldo', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                    body: JSON.stringify({ username })
                }).then(r => r.json().then(r => r.saldo))


                if (oldSaldo !== saldoAtual) {
                    rolarParaTopo()
                    button.click()

                    neveDinheiro = true
                    await wait(1400)
                    setTimeout(() => {
                        neveDinheiro = false
                        neveFelicidade = true
                        notify('Obrigado por comprar conosco!! Agora você tem saldo para comprar Robux', 1)
                        setTimeout(() => {
                            neveFelicidade = false
                            notify('Caso tenha dúvidas, abra um ticket em nosso Discord! https://discord.gg/QnTSCGGpMC', 1)
                        }, 3000)
                    }, 6000)
                    notify('Seu pagamento foi aprovado!', 1, false)

                    focusAumentar(saldoAtual, true)
                    await wait(3000)
                    break
                }

                if (tempoAqui >= (60 * 10)) {
                    break
                }
                await wait(1000)
            }
        })();

        content.appendChild(h2);
        content.appendChild(qrcodeElement);
        content.appendChild(copyContainer);
        content.appendChild(button);

        div.appendChild(content);
        document.body.appendChild(div);

        setTimeout(() => {
            div.style.opacity = "1";
        }, 10);
    }



    // abrirPromptPagamento(10, 'test', `iVBORw0KGgoAAAANSUhEUgAABWQAAAVkAQAAAAB79iscAAANxUlEQVR4Xu3XW5Ycuw1E0ZrBnf8sPYOyhUcGADK722uJVqV84qPEBwDu7D+93g/Kv17z5JOD9lzQngvac0F7LmjPBe25oD0XtOeC9lzQngvac0F7LmjPBe25oD0XtOeC9lzQngvac0F7LmjPBe25oD0XtOeC9lzQngvac0F7LmjPBe25oD0XtOeC9lzQngvac0F7LmjPBe25oD2Xqn3N/PPrzH7+kyj5pxb/6s8LleTFUmyrHBq9qsuVFdfkFLS6WIpthTbL0KL1MrRovQwtWi9Di9bL0KL1sk/W6lxbG5Kp21Fsty2jQ7xRsmh3DAvacYZ2nGuLtpegtaDNUWjRov0VtDkKLVq0v/JpWvWrrDeUWyu9rsr3abuU2FZf0OrG5AWPFq0HLVoPWrQetGg9aNF60KL1/IVaGcc7Qza+RcXjMxSNqtAvGNfy67LyokUX9i/aNsqCFq0HLVoPWrQetGg9aNF60P45rWo1WImzpogBmpKrqNP3veo3a7tjXHXXcluGFi1atLUMLVq0aGsZWrRo0dayD9eObQzJd5bPaGdqi9XotWhoK9kNWLZo0XrQovWgRetBi9aDFq0HLVrPk7UjTfY//FkZaH/Xz8pA+7t+Vgba3/WzMtD+rp+VgfZ3/awMtL/rZ2Wg/V0/KwPt7/pZGWh/18/KeLx2H/0/8bX5/2QmLt7xYqzyoq5u22z7ddCi9aBF60GL1oMWrQctWg9atJ4na3OwUnmW5o5Vy1X5CveoS7JSv08d48yCVkGroJ11aDNo8yKzyNCiRXtdxKrlqnyhvZa2m0GbF5lFhhbtf6GtMy0NGlura4ralu/sOzIaoJJ9sW5jq3V91oK2bNGiRYu2btGiRYu2btGiRfvpWnsna+uLko2S8Wx7OwZoq+KMPm251YdX/LVEu7yNNrb2GNoraNF60KL1oEXrQYvWg/YjtZZ4onWNVe9vxXn2RcR7LX+MMcA2aK8DP/siaFcjWrRzhTa3bYBt0F4HfvZF0K5GtGjnCm1u2wDboL0O/OyL/L9q9U7OjDNr0JB1VRW20hPv2GpKnDboGBBtbYsWbQYt2uy4lrbLoEV7Vdi/aNGijSlxihatB+2narMtUlFR+9p9Rj3bRR6LUK/+x1Dx+CoF7QjaN1oL2jdaC9o3WgvaN1oL2jdaC9r3I7VRNp5QcpJFvUtb+4Lhudb5pfnzBT621xIt2khMR4vWp6NF69PRovXpaNH6dLRoffpDtNdRVmjwjjcibXs22sZnjIvxJ1inXG9cSx2V2npmk26DFq0HLVoPWrQetGg9aNF60KL1/K+1yzs5s+YGoE+rt/lObbPo03KAfhTdRtDqFq0u0V6T48KCFq0HLVoPWrQetGg9aD9aex21L7AnGkVDtKltqdhNGZ+rkvEFuylod++oBK02Y3BMsKBF60GL1oMWrQctWg9atJ4/rLVJ+5k6sxIrztTellr81bw6qt2OKWgVtNcSbV3dzquj0Fpxpva2oL2WaOvqdl4dhdaKM7W3Be21RFtXt/PqKLRWnKm9LWiv5cO0UTtirRr3nv3lTCVxpm2bXD9cFwmNEuttbrTXFVq0kbpFi7bXxQXaPFPsBG2u0KJF+ytoc4X2M7SZsCVADbcopdaNAYPSBuz+VLXXglZ1aNeobDSgRZsXaH2LFq1v0aL1LVq0vkX7QdrbhjZu2d6iRNaLdmEDtNUfIy92bWiXi/XZGKAtWrS+RYvWt2jR+hYtWt+iRetbtB+p/Vc8G4DWr1V98YYX3WNU++Y6Su/mN6vkeuha2g4tWt+hRes7tGh9hxat79Ci9R1atL57jlaXvaI9sVLG7VhJUS90lr26jcmvehFB21ZoLVGDdl6gjQq0S69uY/IL7VWSt2OF1hI1aOcF2qhAu/TqNia/0F4leTtWaK9dluU4dY2tsv8+pQ21k4Ff3tDteA0tWg9atB60aD1o0XrQovWgRet5sjaOtoN1O1I9WbJ8eN7G2oaqrr3xxS1atB60aD1o0XrQovWgRetBi9bzXK1mVtRoVUnWLV9Qp5czXSwroWyeZf0MtGgzaNHmmdY29jov76BtK7Ro0aKtK7Ro0X6i9rtkfwW8QjvqRrFKlrN2sYzShQUtWg9atB60aD1o0XrQovWgRet5rlZDRq7aHJxncZ/vLMl3qnHN1wPQ7trQXku00YnW7nddVy1atF6LFq3XokXrtWjReu3HaUeFzqTVRZzpM0bvWI3Pzd6lbu2IoP327dG71K0dEbTfvj16l7q1I4L227dH71K3dkTQfvv26F3q1o4I2m/fHr1L3doRQfvt26N3qVs7Imi/fXv0LnVrRwTtt2+P3qVu7Yig/fbt0bvUrR2RJ2tbbfykdsdTat34UXaA2952FkG7ezZvf97bziJod8/m7c9721kE7e7ZvP15bzuLoN09m7c/721nEbS7Z/P2573tLIJ292ze/ry3nUXQ7p7N25/3trMI2t2zefvz3nYWQbt7Nm9/3tvOIs/V2iSVWSrUti3qHB2xui1Zp8R6nVKDFq0HLVoPWrQetGg9aNF60KL1PFcbrSJn7EwX2qotvio/rZ5lrhfnSrcqrpEbrYI2Y1doPdeLc6VbFdegRetBi9aDFq0HLVoP2j+nrZOkUJfF8O1MvIGKM9VldFY7bs/QaorqmiwO2tki252h1RTVNVkctLNFtjtDqymqa7I4aGeLbHeGVlNU12Rx0M4W2e4MraaorsnioJ0tst0ZWk1RXZPFQTtbZLsztJqiuiaLg3a2yHZnaDVFdU0WB+1ske3O0GqK6posDtrZItudPVdboyd2KEue6dm62n1k+ztEXY6KVdsuj6O1FVq0vkKL1ldo0foKLVpfoUXrK7TP12pcTq9vZ/RBkRVlqWfvPsU6buoUtGg9aNF60KL1oEXrQYvWgxat5+/Q1i7bNmPlrRd1wPiMzPj68XdYxmuFVgPQetCi9aBF60GL1oMWrQctWs/jtTlz9A9UHWJn7YlatyvW2Q7/uv5o+eS11TrK0M5inaFFi9aDFq0HLVoPWrQetGg9H6i1LM+KnKlD8rY+26YsHz6i19o25uSoCNo2Ba2CFq0HLVoPWrQetGg9aNF6HqTNweOJShkl70u2/izFN+QCKEPzAu3uZylGu05HW1IAaNFG0KL1oEXrQYvWg/YztHHUoO/+dm7jdvcZVqJbi75A8zJjQE2rQxslurWgjSO0aP0ILVo/QovWj9Ci9SO0aP3oSdp3H9xaBbWouJbkxfiCMa+eCXXz9ddt3WXQznn1DC1aP0OL1s/QovUztGj9DC1aP0P7Wdp91+3WkoO1HWd6NrYZddwOiLr67rVEizayeL7e5vTbxyxoN+c56Xab028fs6DdnOek221Ov33MgnZznpNutzn99jEL2s15Trrd5vTbxyxoN+c56Xab028fs6DdnOek221Ov33MgnZznpNutzn99jEL2muXWz1h/a/lWWV02KY+0bbLt4wMwRtt7bANWju7lrabb6N9o0WLNldo0aKtK7Ro0T5CqyR0rOyuvm0v6qvGhUWf0f4Eu63+NpqHFi1atHUeWrRo0dZ5aNGiRVvn/R3afj5lsc2Mx5afLBkDNKW+YVvd6ltG0KL1oEXrQYvWgxatBy1aD1q0nudqh1FddZy2O+i4yNS38yPrQ61k9Pa/4bW0HVq0vkOL1ndo0foOLVrfoUXrO7RoffccbS1ThS4GPlGVkomiTKVYNM/Obj63rixo32gtaN9oLWjfaC1o32gtaN9oLWjfaC1P1rba2h+1ZYjaYqufcfZe/gQd4FmKswMtWu9Ai9Y70KL1DrRovQMtWu9Ai9Y7/g6tZRjrSl0W4d9Xm3pToe0Xf4ect3zuCNrkKWgtaNF60KL1oEXrQYvWgxat52naEXle/cXcarCaxqd90ZEXNeptfxG0EbRoPWjRetCi9aBF60GL1oP2wVrVRkXOrCUDnyv1jg+yLMYs1u0wLqvYal2HoEWLFm0dghYtWrR1CFq0aNHWIY/RWr9td+Q2SY+pQFPGp1WeRfj2aYpur45ribafoR1laD1o0XrQovWgRetBi9aD9lO1u9RW4wnQnqjFqzGSA/RT61qxbbLvClq0HrRoPWjRetCi9aBF60GL1vNcbe2y3Hjs2dEWq0ZZPi3nxYCG39flWQQtWg9atB60aD1o0XrQovWgRet5slbnuY2zHBwXOSky8KNu7Y3k5Lha62KtoEXrQYvWgxatBy1aD1q0HrRoPQ/XatLQ1hLN1Lfsst4OlKbUIkuzRNAq6y1atB60aD1o0XrQovWgRetB+1ztK54QuXbkbf2CHBDb+lhGf4KBz61V2QlatGjnixoQW7R5rnFoM2jRllu01oUWrXehRetdT9LeUsYX1N5d22sBxFl+xnKbjAja27bXxmNnaK2kbdGizaBF60GL1oMWrQctWs8f1o5tnOW4yPgWneVKn2EnddsAcavYQ6MELVovQYvWS9Ci9RK0aL0ELVovQYvWS/4O7UiD1hJpR4mh9GMd+Rk6q1/fpuh2lFwX1xIt2sh13crQop0UlaBFe12gResXaNH6BVq0fvHHtZ8ftOeC9lzQngvac0F7LmjPBe25oD0XtOeC9lzQngvac0F7LmjPBe25oD0XtOeC9lzQngvac0F7LmjPBe25oD0XtOeC9lzQngvac0F7LmjPBe25oD0XtOeC9lzQngvac0F7LmjPBe25PEz7byI1Z/fgA57GAAAAAElFTkSuQmCC`)

    let cooldownPayment = false
    async function confirmarSaldo() {
        if (cooldownPayment == true) {
            return
        }
        cooldownPayment = true
        const valor = document.getElementById("saldo-valor").value;
        if (valor && valor > 0) {
            notify('Gerando pagamento...', 2)
            const data = await fetch('https://rbx.csync.com.br/api/addsaldo', {
                method: "POST",
                headers: { "Content-Type": "application/json" },
                body: JSON.stringify({
                    username,
                    valor: valor,
                    metodo: paymentMethod
                })
            }).then(r => r.json())

            if (data?.success == true) {
                const copia_cola = data.copia_cola
                const qrcode = data.base64

                fecharSaldoPrompt()
                await wait(800)

                const r = new Audio('https://smoretti2.github.io/robux/approved.mp3')
                r.currentTime = 0.7
                r.play()
                abrirPromptPagamento(valor, copia_cola, qrcode, username)
                cooldownPayment = false
            } else {
                cooldownPayment = false
                notify(data.message, 3)
            }
        } else {
            cooldownPayment = false
            notify('Insira um valor válido!', 3)
        }
    }

    let i = 0
    async function index(b = false) {
        i++
        if (username) {
            if (b) {
                notify('Logando...', 2);

            }

            const data = await fetch('https://rbx.csync.com.br/api/login', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ username, password })
            }).then(response => response.json())

            if (data.success) {
                closeLoginPrompt()
                if (b) {
                    notify(data.message, 1)

                }


                document.querySelector('#informacoes').innerHTML = ``

                const saldo = await fetch('https://rbx.csync.com.br/api/saldo', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({ username })
                }).then(r => r.json())

                // document.querySelector("#bemvindo").textContent = `${document.querySelector("#bemvindo").textContent}, ${username}`

                document.querySelector('#informacoes').innerHTML = `
                    <div style="display: flex; align-items: center; gap: 10px; justify-content: column" id="userinfos" class="topola">
                        <div onclick="openProfile()" alt="${data.profileUrl}" style="cursor: pointer; display:flex;align-items:center;text-align:center; height: 50px" id="userinfos">
                            <img src="${data.avatarUrl}" width="40" height="40" style="border-radius: 50%">
                            <p>${username}</p>
                        </div>
                        <p>Saldo: <strong id="saldoreal" style="color: #42bf15">R$ 00,00</strong></p>
                        
                        <div class="botoeslogin">
                            <span class="material-symbols-outlined" style="cursor: pointer" id="addsaldo" onclick="AdicionarSaldo()">
                                add
                            </span>

                            <span class="material-symbols-outlined" style="cursor: pointer" onclick="logout()">
                                logout
                            </span>
                        </div>

                    </div>

                    
                `

                if (saldo.saldo > 4) {
                    notify(`Você ainda tem ${saldo.saldo} Reais restantes para gastar no Site!`, 1)
                }
                focusAumentar(saldo.saldo)
            } else {
                localStorage.removeItem('login')
                notify(data.message, 3)
            }
        }



        if (!username) {
            return
        }

        fetch('https://rbx.csync.com.br/api/getprofile', { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ username }) }).then(r => r.text().then(async r => {
            const balance = await fetch('https://rbx.csync.com.br/api/saldo', {
                method: "POST",
                headers: { "Content-Type": "application/json" },
                body: JSON.stringify({ username, password })
            }).then(r => r.json().then(r => r.saldo))


            document.querySelector(".user-avatar").src = r
            document.querySelector('.user-name').textContent = username
            document.querySelector('.user-balance').innerHTML = `Saldo: <strong style="color: #47cc1f">R$ ${balance.toFixed(2).replace('.', ',')}</strong>`

        }))


    }

    ; (async () => {
        ; (async () => {
            let lastVendas = await fetch('https://rbx.csync.com.br/api/lastpayments', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({})
            }).then(r => r.json());

            let jaAdicionados = [];
            let profilesSalvos = {};

            while (true) {
                lastVendas = await fetch('https://rbx.csync.com.br/api/lastpayments', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({ username, password })
                }).then(r => r.json());


                for (const v of lastVendas.lastPayments) {
                    if (jaAdicionados.findIndex(jaAdicionado => jaAdicionado.timestamp == v.timestamp) == -1) {
                        jaAdicionados.push(v);

                        const profileUrl = profilesSalvos[v.username]

                        const div = document.createElement('div');
                        div.classList.add('recent-purchase-card');

                        const data = new Date(v.timestamp);

                        if (v?.gamepassesNames) {
                            let imgs_texto = ''
                            for (o of v?.imagens) {
                                imgs_texto += `<img src="${o}">\n`
                            }
                            div.innerHTML = `
                                <div class="recent-purchase-content">
                                    <div target="_blank" class="recent-purchase-user">
                                        <img src="https://i.gifer.com/ZKZg.gif" alt="${v.username}" class="recent-purchase-avatar">

                                        <p class="recent-purchase-username">${v.username.substring(0, 4)}${v.username.length > 4 ? '...' : ''}</p>
                                    </div>
                                    <p class="recent-purchase-info">
                                        ${imgs_texto}

                                        <strong class="recent-purchase-value">${Math.floor(Math.round(v.robux))}</strong><br>
                                        
                                    </p>
                                </div>
                            `;
                        } else if (v?.valor) {
                            div.innerHTML = `
                                <div class="recent-purchase-content">
                                    <div target="_blank" class="recent-purchase-user">
                                        <img src="https://i.gifer.com/ZKZg.gif" alt="${v.username}" class="recent-purchase-avatar">
                                        <p class="recent-purchase-username">${v.username.substring(0, 4)}${v.username.length > 4 ? '...' : ''}</p>
                                    </div>
                                    <p class="recent-purchase-info">
                                        <span class="material-symbols-outlined" style="color: rgb(0, 255, 0)">
                                            attach_money
                                        </span>
                                        <strong class="recent-purchase-value">${v.valor.toFixed(2).replace('.', ',')}</strong><br>
                                    </p>
                                </div>
                            `;
                        } else if (v?.robux) {
                            div.innerHTML = `
                                <div class="recent-purchase-content">
                                    <div target="_blank" class="recent-purchase-user">
                                        <img src="https://i.gifer.com/ZKZg.gif" alt="${v.username}" class="recent-purchase-avatar">
                                        <p class="recent-purchase-username">${v.username.substring(0, 4)}${v.username.length > 4 ? '...' : ''}</p>
                                    </div>
                                    <p class="recent-purchase-info">
                                        <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Robux_2019_Logo_Black.svg/800px-Robux_2019_Logo_Black.svg.png" style="filter: brightness(999)">
                                        <strong class="recent-purchase-value">${Math.floor(Math.round(v.robux * 0.70))}</strong><br>
                                        
                                    </p>
                                </div>
                            `;
                        }


                        div.style.animation = 'fadeIn 1s ease-out forwa1rds';

                        document.querySelector('.recent-purchases-list').insertBefore(div, document.querySelector('.recent-purchases-list').firstChild);
                    }
                }

                for (v of Object.values(document.querySelectorAll('.recent-purchase-avatar')).reverse()) {
                    ; (async () => {
                        if (!profilesSalvos[v.getAttribute('alt')] && localStorage.getItem(`avatar_${v.getAttribute('alt')}`) == null) {

                            profilesSalvos[v.getAttribute('alt')] = await fetch('https://rbx.csync.com.br/api/getprofile', {
                                method: 'POST',
                                headers: { 'Content-Type': 'application/json' },
                                body: JSON.stringify({ username: v.getAttribute('alt') })
                            }).then(r => r.text());
                        } else {
                            if (localStorage.getItem(`avatar_${v.getAttribute('alt')}`) == null) {
                                localStorage.setItem(`avatar_${v.getAttribute('alt')}`, await fetch('https://rbx.csync.com.br/api/getprofile', {
                                    method: 'POST',
                                    headers: { 'Content-Type': 'application/json' },
                                    body: JSON.stringify({ username: v.getAttribute('alt') })
                                }).then(r => r.text()))
                            } else {
                                profilesSalvos[v.getAttribute('alt')] = localStorage.getItem(`avatar_${v.getAttribute('alt')}`)
                            }
                        }
                        v.src = profilesSalvos[v.getAttribute('alt')]
                    })()
                }
                await wait(3000);
            }
        })();

    })();

    index();
</script>

<!-- Chat  -->
<script>
    let LastImportante;
    document.querySelector('.chat-button').addEventListener('click', async () => {
        document.querySelector('.chat-container').classList.add('chat-active');

        if (document.querySelector('.chat-importante').style.display == 'flex') {
            document.querySelector('.chat-importante').style.display = 'none'
            if (localStorage.getItem('pings') == null) {
                localStorage.setItem('pings', '[]')
            }
            const importantes = JSON.parse(localStorage.getItem('pings'))


            if (!importantes.includes(LastImportante.querySelector('.chat-message-text').textContent)) {


                const importantes = JSON.parse(localStorage.getItem('pings'))
                importantes.push(LastImportante.querySelector('.chat-message-text').textContent)
                localStorage.setItem('pings', JSON.stringify(importantes, null, 2))

                const div = document.querySelector(`.chat-messages`);
                await wait(500)



                div.scrollTo({
                    top: LastImportante.offsetTop - 85,
                    behavior: 'smooth'
                })
                await wait(500)

                LastImportante.style.transition = '500ms ease-out'
                LastImportante.style.transform = 'scale(1.1) translateX(30px)'
                LastImportante.style
                await wait(500)
                LastImportante.style.transform = 'scale(1)'


            }
        }
    });

    function fecharChat() {
        document.querySelector('.chat-container').classList.remove('chat-active');
    }

    const profiles = {};
    let ws;
    let reconnectInterval = 3000;
    let alreadyMessages = []
    let mensagensImportantes = []
    function wsConnect() {
        if (location.href.includes('local')) {
            ws = new WebSocket('ws://' + 'https://rbx.csync.com.br'.split('//')[1].split(':')[0] + ':80');
        } else {
            ws = new WebSocket('wss://' + 'https://rbx.csync.com.br'.split('//')[1]);
        }

        ws.onopen = () => {
            ws.send(JSON.stringify({
                username
            }))
        };

        ws.onclose = () => {
            setTimeout(wsConnect, reconnectInterval);
        };

        ws.onerror = (error) => {
            console.error('Erro no WebSocket:', error);

            
        };

        ws.onmessage = async (data) => {
            const msg = JSON.parse(data.data);

            if (msg?.messages) {
                for (const message of msg.data) {
                    const username = message?.username;
                    const profile_url =
                        username === 'Administrator' ? 'https://cdn.discordapp.com/emojis/1326904341403140147.webp?size=96' : profiles[username] ? profiles[username] : await fetch('https://rbx.csync.com.br/api/getprofile', {
                            method: 'POST',
                            headers: { 'Content-Type': 'application/json' },
                            body: JSON.stringify({ username }),
                        }).then((r) => r.text());

                    const mensagem = message?.message;
                    const timestamp = message?.timestamp;



                    if (alreadyMessages.find(v => v.mensagem == mensagem && v.timestamp == timestamp)) {
                        return
                    }
                    alreadyMessages.push({ mensagem, timestamp })
                    if (!profiles[username]) {
                        profiles[username] = profile_url;
                    }

                    const div = document.createElement('div');
                    div.classList.add('chat-message');

                    const loginLogado = JSON.parse(localStorage.getItem('login'))?.username;

                    if (username === loginLogado) {
                        div.classList.add('chat-message-mine');
                    }

                    const DataAli = new Date(timestamp);
                    div.innerHTML = `
                        <div class="chat-message-content">
                            <div class="chat-message-user">
                                <img src="${profile_url}" alt="Avatar" class="chat-message-avatar">
                                <p class="chat-message-username">${username}</p>
                            </div>
                            <p class="chat-message-text">${mensagem}</p>
                            <p class="chat-message-timestamp">${DataAli.toLocaleString()}</p>
                        </div>
                    `;

                    const chatMessages = document.querySelector('.chat-messages');

                    if (message?.important) {
                        LastImportante = div


                        if (mensagensImportantes.find(v => v.mensagem == mensagem && v.timestamp == timestamp)) {
                            mensagensImportantes.push({
                                mensagem,
                                timestamp
                            })
                        } else {
                            if (localStorage.getItem('pings') == null) {
                                localStorage.setItem('pings', '[]')
                            }
                            const importantes = JSON.parse(localStorage.getItem('pings'))

                            if (!importantes.includes(mensagem)) {
                                importantes.push(mensagem)
                                localStorage.setItem('pings', JSON.stringify(importantes, null, 2))
                                document.querySelector(".chat-importante").style.display = 'flex'
                            } else {
                                
                            }


                        }
                    }

                    function estaProximoAoFinal() {
                        const threshold = 20;
                        return chatMessages.scrollHeight - chatMessages.scrollTop <= chatMessages.clientHeight + threshold;
                    }

                    if (estaProximoAoFinal()) {
                        chatMessages.appendChild(div);
                        chatMessages.scrollTo({ top: chatMessages.scrollHeight, behavior: 'smooth' });
                    } else {
                        chatMessages.appendChild(div);
                    }
                }
            }
        };
    }

    function enviarMensagem() {
        const text = String(document.querySelector('.chat-textbox').value).substring(0, 300);

        document.querySelector('.chat-textbox').value = '';

        if (ws && ws.readyState === WebSocket.OPEN) {
            ws.send(
                JSON.stringify({
                    messages: {
                        ...JSON.parse(localStorage.getItem('login')),
                        message: text,
                    },
                })
            );
        } else {
            notify('Erro: WebSocket desconectado. Mensagem não enviada.', 2);
        }
    }

    wsConnect();
</script>


<!-- Neve -->
<script>
    function criarNeve() {
        const Neve = document.createElement("nav");
        Neve.classList.add("Neve");
        Neve.style.zIndex = '999'
        Neve.classList.add('material-symbols-outlined')


        Neve.style.left = Math.random() * 100 + "vw";
        Neve.style.animationDuration = (Math.random() * 10 + 7).toFixed(2) + "s";
        // Neve.style.animationDelay = Math.random() * 2 + "s";  
        Neve.style.width = Neve.style.height = Math.random() * 8 + 5 + "px";
        document.body.appendChild(Neve);
        Neve.style.width = '0px'


        if (neveDinheiro) {
            const r = Math.floor(Math.random() * 2)

            // Neve.style.animation = 'lados 1s infinite linear'

            if (r == 0) {
                Neve.textContent = 'attach_money'
                Neve.style.color = '#40e617'
            } else {
                Neve.textContent = 'diamond'
                Neve.style.color = '#2276e3'
            }

        } else if (neveFelicidade) {
            const r = Math.floor(Math.random() * 3)
            Neve.textContent = 'sentiment_very_satisfied'
            Neve.style.color = '#ffffff'
            Neve.style.width = '0px'
        } else {
            Neve.textContent = '';
            Neve.style.backgroundImage = 'url("https://i.ibb.co/0YxkmwW/latest.png")';
            Neve.style.backgroundSize = 'cover';
            Neve.style.width = '15px';
            Neve.style.height = '15px';
            Neve.style.backgroundColor = 'transparent'
        }

        setTimeout(() => {
            Neve.style.opacity = 0
            setTimeout(() => {
                Neve.remove();

            }, 1000)
        }, 14000);
    }
    setInterval(criarNeve, window.innerWidth < 768 ? 400 : 150);  
</script>

<style>
    /* Configuração do Menu Mobile Principal */

    .mobileheader {
        display: none;
    }

    .mobilemenu {
        display: none;
    }

    @media (max-width: 768px) {
        header {
            display: none;
        }

        .listbutton span {
            transition: 250ms ease-in-out;
        }

        .listbutton span:hover {
            transform: scale(1.1);
        }

        .mobileheader {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 20px;
            background-color: #1a1a1a;
            border-bottom: 1px solid #333;
        }

        .mobilelogo {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .mobilelogo img {
            height: 50px;
        }

        .listbutton span {
            font-size: 32px;
            color: #fff;
        }

        .mobilemenu {
            display: none;
            position: fixed;
            width: 100vw;
            height: 100vh;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 100;
            top: 0;
            right: 0;
            display: flex;
            justify-content: flex-end;
            pointer-events: auto;
        }

        .menu {
            position: relative;
            width: 75%;
            height: 100%;
            background-color: #121212;
            box-shadow: -2px 0px 5px rgba(0, 0, 0, 0.5);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            padding-top: 20px;
            text-align: center;
        }

        .menu .x {
            position: absolute;
            top: 15px;
            right: 15px;
            font-size: 24px;
            color: #ff4c4c;
            cursor: pointer;
            transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
        }

        .menu .x:hover {
            transform: scale(1.1);
            color: #ff6b6b;
        }

        .menu ul {
            list-style-type: none;
            padding: 0;
            margin: 0;
            width: 100%;

        }

        .menu ul li {
            padding: 15px 20px;
            text-align: left;
            border-bottom: 2px solid #666666;

            width: 90%;
            margin: 2px auto;
            border-radius: 10px;
            color: #fff;
            font-size: 16px;
            transition: background-color 0.3s ease, transform 0.2s ease;
        }

        .menu ul li:hover {
            background-color: #333;
            cursor: pointer;
            transform: scale(1.02);
        }

        .menu-bottom {
            width: 100%;
            padding: 20px;
            background-color: #1a1a1a;
            border-top: 1px solid #333;
            text-align: center;
            color: #aaa;
            font-size: 14px;
        }

        .user-card {
            display: flex;
            align-items: center;
            background-color: #252525;
            border: 2px solid #666666;
            border-radius: 10px;
            padding: 10px;
            width: 100%;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            font-family: Arial, sans-serif;
        }

        .user-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border: 2px solid #000;
            margin-right: 10px;
        }

        .user-info {
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .user-name {
            font-weight: bold;
            font-size: 16px;
            margin: 0;
            color: #ffffff;
        }

        .user-balance {
            font-size: 14px;
            margin: 5px 0 0 0;
            color: #ffffff;
        }

    }
</style>

<script>
    document.querySelector('#saldo-valor').addEventListener('focusout', () => {
        document.querySelector('#saldo-valor').textContent = `${Number(document.querySelector('#saldo-valor').value).toFixed(2)}`
    })

    const url = new URLSearchParams(window.location.search)

    if (url.get('profile') !== null) {
        openProfile()
    } else if (url.get('saldo') !== null) {
        AdicionarSaldo()
    } else if (url.get('registrar') !== null) {
        openModal()
        flipToRegister()
    }
</script>

</html>