body {
    background: #19192a;
    color: #fff;
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0 0 90px 0;
    letter-spacing: 0.01em;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 24px 12px 0 12px;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #23233a;
    border-radius: 22px;
    padding: 16px 22px;
    margin-bottom: 26px;
    box-shadow: 0 4px 24px rgba(38,125,255,0.08), 0 1.5px 8px rgba(0,0,0,0.10);
    gap: 16px;
    min-width: 0; /* Убираем минимальную ширину для гибкости */
    flex-wrap: nowrap; /* Предотвращаем перенос */
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid #267dff33;
    background: #2c2c44;
    box-shadow: 0 2px 8px rgba(38,125,255,0.10);
    display: block; /* Убеждаемся, что элемент виден */
}

.user-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin-left: 14px;
    margin-right: auto;
    letter-spacing: 0.02em;
    white-space: nowrap; /* Предотвращаем перенос текста */
    overflow: hidden; /* Обрезаем, если не помещается */
    text-overflow: ellipsis; /* Показываем три точки, если обрезаем */
    max-width: 60%; /* Ограничиваем ширину для баланса */
}

.top-balance-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-balance {
    background: #181828;
    color: #267dff;
    font-size: 1.08rem;
    font-weight: 700;
    border-radius: 16px;
    padding: 6px 18px;
    margin-right: 2px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 4px rgba(38,125,255,0.10);
}

.user-topup {
    background: linear-gradient(90deg, #267dff 60%, #4e9cff 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 8px 22px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s;
    box-shadow: 0 2px 12px rgba(38,125,255,0.13);
}

.user-topup:hover, .user-topup:focus {
    background: linear-gradient(90deg, #1a5dcc 60%, #267dff 100%);
    transform: scale(1.04);
}

/* --- Market Controls --- */
.market-controls {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}

.market-filter, .market-sort {
    border-radius: 14px;
    border: none;
    padding: 12px 16px;
    font-size: 1.08rem;
    background: #23233a;
    color: #fff;
    outline: none;
    box-shadow: 0 1px 4px rgba(38,125,255,0.07);
    transition: box-shadow 0.18s, background 0.18s;
}

.market-filter:focus, .market-sort:focus {
    background: #23234a;
    box-shadow: 0 0 0 2px #267dff55;
}

/* --- Pages --- */
.page { display: none; }
.page.active { display: block; }

/* --- Products Grid --- */
.products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.product-card {
    background: #23233a;
    border-radius: 26px;
    padding: 16px 14px 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-shadow: 0 4px 24px rgba(38,125,255,0.10), 0 1.5px 8px rgba(0,0,0,0.10);
    position: relative;
    min-height: 180px;
    justify-content: flex-end;
    transition: box-shadow 0.18s, transform 0.13s;
}

.product-card:hover {
    box-shadow: 0 8px 32px rgba(38,125,255,0.16), 0 2px 12px rgba(0,0,0,0.13);
    transform: translateY(-2px) scale(1.02);
}

.product-image {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 18px;
    background: #2c2c44;
    margin-bottom: 14px;
    border: none;
    box-shadow: 0 1.5px 8px rgba(38,125,255,0.07);
}

.product-info-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: auto;
    gap: 10px;
}

.product-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 2px 0;
    flex: 1;
    line-height: 1.13;
    letter-spacing: 0.01em;
}

.product-price {
    font-size: 1.13rem;
    font-weight: 700;
    color: #ffb347;
    margin: 0 0 0 0;
    white-space: nowrap;
}

.product-cart-btn {
    background: linear-gradient(90deg, #267dff 60%, #4e9cff 100%);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 2px 12px rgba(38,125,255,0.13);
    margin-left: 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
}

.product-cart-btn:hover, .product-cart-btn:focus {
    background: linear-gradient(90deg, #1a5dcc 60%, #267dff 100%);
    transform: scale(1.07);
}

/* --- Cart --- */
.page-cart h2 { margin-top: 0; }
#cartList { margin-bottom: 16px; }
.cart-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #23233a;
    border-radius: 16px;
    padding: 16px 22px;
    font-size: 1.13rem;
    color: #fff;
    box-shadow: 0 2px 8px rgba(38,125,255,0.07);
}
#checkoutBtn {
    background: linear-gradient(90deg, #267dff 60%, #4e9cff 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 8px 22px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    box-shadow: 0 2px 12px rgba(38,125,255,0.13);
}
#checkoutBtn:hover, #checkoutBtn:focus { background: linear-gradient(90deg, #1a5dcc 60%, #267dff 100%); transform: scale(1.04); }

.cart-item { display: flex; align-items: center; background: #181828; border-radius: 14px; margin-bottom: 10px; padding: 10px; box-shadow: 0 1.5px 8px rgba(38,125,255,0.07); }
.cart-item-img { width: 44px; height: 44px; border-radius: 10px; margin-right: 14px; }
.cart-item-info { flex: 1; }
.cart-item-title { font-size: 1.05rem; font-weight: 600; }
.cart-item-price { color: #ffb347; font-size: 1.01rem; }
.cart-remove-btn { background: #267dff; color: #fff; border: none; border-radius: 10px; width: 32px; height: 32px; font-size: 1.2rem; cursor: pointer; margin-left: 10px; transition: background 0.15s, transform 0.12s; }
.cart-remove-btn:hover, .cart-remove-btn:focus { background: #1a5dcc; transform: scale(1.08); }

/* --- Partners --- */
.page-partners h2 { margin-top: 0; }
.partners-block {
    background: #23233a;
    border-radius: 22px;
    padding: 24px 18px;
    box-shadow: 0 4px 24px rgba(38,125,255,0.10), 0 1.5px 8px rgba(0,0,0,0.10);
    margin-bottom: 26px;
}
.partners-logo-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}
.partners-logo {
    width: 44px;
    height: 44px;
}
.copy-link-btn {
    background: linear-gradient(90deg, #267dff 60%, #4e9cff 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 8px 22px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    box-shadow: 0 2px 12px rgba(38,125,255,0.13);
}
.copy-link-btn:hover, .copy-link-btn:focus { background: linear-gradient(90deg, #1a5dcc 60%, #267dff 100%); transform: scale(1.04); }
.partners-desc {
    color: #bdbdf7;
    margin-bottom: 16px;
    font-size: 1.05rem;
    text-align: center;
}
.partners-info {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
}
.partners-info-block {
    background: #181828;
    border-radius: 14px;
    padding: 14px 16px;
    text-align: center;
    flex: 1;
    box-shadow: 0 1.5px 8px rgba(38,125,255,0.07);
}
.partners-info-label {
    font-size: 1.13rem;
    font-weight: 700;
    color: #267dff;
}
.partners-info-value {
    font-size: 1.01rem;
    color: #fff;
}
.partners-top {
    margin-top: 14px;
    color: #bdbdf7;
    font-size: 1.01rem;
    display: flex;
    justify-content: space-between;
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #23233a;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -4px 24px rgba(38,125,255,0.10), 0 -1.5px 8px rgba(0,0,0,0.10);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 14px 0 8px 0;
    z-index: 100;
    max-width: 500px;
    margin: 0 auto;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 8px 0;
    border-radius: 18px;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
    cursor: pointer;
    position: relative;
}
.nav-item.active, .nav-item:hover {
    background: #188cff;
    color: #fff;
    box-shadow: 0 0 8px 2px #267dff44;
}
.nav-svg {
    width: 32px;
    height: 32px;
    margin-bottom: 2px;
    display: block;
    filter: none;
}
.nav-item.active .nav-svg {
    color: #188cff;
    fill: #188cff;
    background: #fff;
    border-radius: 10px;
    padding: 4px;
}
.nav-label {
    font-size: 0.93rem;
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(24,24,40,0.55);
    justify-content: center;
    align-items: center;
}
.modal.active {
    display: flex;
}
.modal-content {
    background: #23233a;
    border-radius: 22px;
    padding: 36px 28px 24px 28px;
    max-width: 370px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(38,125,255,0.16), 0 2px 12px rgba(0,0,0,0.13);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.modal-content h2 {
    margin: 0 0 4px 0;
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.01em;
}
.modal-desc {
    color: #bdbdf7;
    font-size: 1.05rem;
    text-align: center;
}
.modal-label {
    font-size: 1.01rem;
    margin-bottom: 2px;
    color: #bdbdf7;
}
.modal-copy-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 4px;
}
.modal-input {
    width: 100%;
    border-radius: 12px;
    border: none;
    padding: 10px 14px;
    font-size: 1.13rem;
    background: #181828;
    color: #fff;
    margin-bottom: 0;
    box-shadow: 0 1px 4px rgba(38,125,255,0.07);
    transition: box-shadow 0.18s, background 0.18s;
}
.modal-input:focus {
    background: #23234a;
    box-shadow: 0 0 0 2px #267dff55;
}
.modal-copy-btn {
    background: linear-gradient(90deg, #267dff 60%, #4e9cff 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 1.01rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(38,125,255,0.13);
}
.modal-copy-btn.copied, .modal-copy-btn:hover, .modal-copy-btn:focus {
    background: linear-gradient(90deg, #1a5dcc 60%, #267dff 100%);
    transform: scale(1.04);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 8px;
    font-size: 1rem;
}
.modal-actions .modal-close {
    padding: 6px 18px;
    font-size: 1.05rem;
    border-radius: 8px;
    margin-top: 8px;
    background: #23233a;
    color: #bdbdf7;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.modal-actions .modal-close:hover {
    background: #23234a;
    color: #fff;
}

@media (max-width: 600px) {
    .container {
        padding: 6px 2px 0 2px;
        max-width: 100vw;
    }
    .top-bar {
        border-radius: 14px;
        padding: 8px 6px;
        gap: 6px;
        margin-bottom: 12px;
    }
    .avatar {
        width: 32px;
        height: 32px;
    }
    .user-name {
        font-size: 0.98rem;
        margin-left: 6px;
    }
    .user-balance {
        font-size: 0.95rem;
        padding: 4px 10px;
    }
    .user-topup {
        padding: 6px 12px;
        font-size: 0.98rem;
        border-radius: 10px;
    }
    .market-controls {
        gap: 6px;
        margin-bottom: 10px;
    }
    .market-filter, .market-sort {
        padding: 8px 8px;
        font-size: 0.98rem;
        border-radius: 10px;
    }
    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .product-card {
        padding: 8px 4px 10px 4px;
        border-radius: 12px;
        min-height: 100px;
    }
    .product-image {
        border-radius: 8px;
        margin-bottom: 8px;
    }
    .product-title {
        font-size: 0.98rem;
    }
    .product-price {
        font-size: 1.01rem;
    }
    .product-cart-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        margin-left: 4px;
    }
    .cart-item {
        border-radius: 8px;
        padding: 6px;
        margin-bottom: 6px;
    }
    .cart-item-img {
        width: 32px;
        height: 32px;
        border-radius: 6px;
        margin-right: 8px;
    }
    .cart-item-title {
        font-size: 0.98rem;
    }
    .cart-item-price {
        font-size: 0.95rem;
    }
    .cart-remove-btn {
        width: 24px;
        height: 24px;
        font-size: 1rem;
        border-radius: 6px;
        margin-left: 4px;
    }
    .cart-summary {
        border-radius: 10px;
        padding: 8px 8px;
        font-size: 1.01rem;
    }
    #checkoutBtn {
        padding: 6px 10px;
        font-size: 0.98rem;
        border-radius: 10px;
    }
    .bottom-nav {
        max-width: 100vw;
        border-radius: 12px 12px 0 0;
        padding: 4px 0 2px 0;
    }
    .nav-item {
        font-size: 0.93rem;
        border-radius: 8px;
        padding: 4px 0;
    }
    .nav-svg {
        width: 24px;
        height: 24px;
    }
    .modal {
        align-items: flex-end !important;
        padding: 0;
    }
    .modal-content {
        align-items: center;
        gap: 10px;
        padding: 14px 8px 10px 8px;
        min-width: 0;
        max-width: 100vw;
        width: 100vw;
    }
    .modal-close {
        padding: 6px 16px;
        font-size: 1.5rem;
        border-radius: 8px;
        top: 6px;
        right: 8px;
    }
    .modal-details > div {
        font-size: 0.98rem !important;
    }
    #modalPrice {
        font-size: 1.18rem;
        margin-bottom: 6px;
    }
    #modalAddToCart {
        font-size: 1.05rem;
        padding: 10px 0;
    }
}

.partner-stats {
    display: flex;
    gap: 18px;
    background: #188cff;
    padding: 18px 0;
    border-radius: 18px;
    justify-content: center;
    margin-bottom: 24px;
}
.partner-card {
    background: rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 18px 32px 14px 32px;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.04);
}
.partner-value {
    color: #fff;
    font-size: 1.5em;
    font-weight: 600;
    margin-bottom: 4px;
}
.partner-label {
    color: #bde0ff;
    font-size: 1em;
    font-weight: 400;
}
@media (max-width: 600px) {
    .partner-card {
        padding: 10px 8px 8px 8px;
        min-width: 0;
    }
    .partner-stats {
        gap: 8px;
        padding: 8px 0;
        border-radius: 10px;
    }
    .partner-value {
        font-size: 1.1em;
    }
    .partner-label {
        font-size: 0.93em;
    }
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
}
.history-empty-icon {
    width: 90px;
    height: 90px;
    background: #393949;
    border-radius: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.history-empty-icon::before {
    content: '';
    display: block;
    width: 54px;
    height: 54px;
    margin: 18px auto;
    background: url('data:image/svg+xml;utf8,<svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="8" y="10" width="38" height="34" rx="8" fill="%23666"/><rect x="16" y="18" width="22" height="4" rx="2" fill="%23888"/><rect x="16" y="26" width="22" height="4" rx="2" fill="%23888"/><rect x="16" y="34" width="12" height="4" rx="2" fill="%23888"/></svg>') center/contain no-repeat;
}
#goToMarketBtn {
    background: #188cff;
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 14px 32px;
    font-size: 1.13rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(38,125,255,0.10);
    transition: background 0.18s, transform 0.12s;
}
#goToMarketBtn:hover {
    background: #267dff;
    transform: scale(1.04);
}
.bottom-nav .nav-item {
    color: #fff;
    background: none;
    border-radius: 18px;
    position: relative;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.bottom-nav .nav-item.active {
    background: #188cff;
    color: #fff;
    box-shadow: 0 0 8px 2px #267dff44;
}
.bottom-nav .nav-item .nav-svg {
    color: #fff;
    fill: #fff;
    width: 32px;
    height: 32px;
    margin-bottom: 2px;
    display: block;
    filter: none;
}
.bottom-nav .nav-item.active .nav-svg {
    color: #188cff;
    fill: #188cff;
    background: #fff;
    border-radius: 10px;
    padding: 4px;
}

.topup-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
.topup-tab {
    flex: 1;
    background: #23233a;
    color: #bdbdf7;
    border: none;
    border-radius: 12px 12px 0 0;
    padding: 12px 0;
    font-size: 1.08rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.topup-tab-active, .topup-tab:focus {
    background: #188cff;
    color: #fff;
    outline: none;
} 