.market-container {
    padding: 16px;
    padding-bottom: 100px;
    max-width: 600px;
    margin: 0 auto;
}

.market-profile-card {
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.8), rgba(20, 20, 30, 0.9));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.market-profile-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 12px;
    margin-top: 0;
}

.balance-container {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.balance-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}

.balance-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.balance-content {
    display: flex;
    flex-direction: column;
}

.balance-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
}

.balance-value {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-top: 2px;
}

.balance-divider {
    display: none;
}

.market-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.market-item {
    background: rgba(30, 32, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto;
    width: 100%;
    box-sizing: border-box;
}

.market-item-image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.market-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.market-item-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.market-item-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 35px;
}

.market-item-description {
    font-size: 11px;
    color: #aaa;
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.market-item-footer {
    margin-top: auto;
    width: 100%;
}

.market-item-prices {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 6px;
    width: 100%;
}

.price-badge {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.price-badge.affordable {
    border: 1px solid rgba(76, 175, 80, 0.3);
    background: rgba(76, 175, 80, 0.1);
}

.price-badge.not-affordable {
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    opacity: 0.75;
}

.price-icon {
    font-size: 11px;
    flex-shrink: 0;
}

.price-value {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.price-plus {
    color: #777;
    font-size: 10px;
}

.market-item-quantity {
    font-size: 10px;
    text-align: center;
    margin-bottom: 10px;
    color: #4caf50;
    font-weight: 500;
}

.market-item-quantity.out-of-stock {
    color: #f44336;
}

.market-buy-btn {
    width: 100%;
    background: linear-gradient(90deg, #6c5ce7, #a29bfe);
    border: none;
    border-radius: 10px;
    padding: 12px 16px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.market-buy-btn:active {
    transform: scale(0.97);
}

.market-buy-btn.disabled {
    background: #2d2d3a;
    color: #777;
    cursor: not-allowed;
    opacity: 1;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

@media (min-width: 600px) {
    .market-container {
        max-width: 1200px;
        padding: 24px;
    }

    .market-items {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 24px;
    }

    .market-item {
        padding: 20px;
    }

    .market-item-title {
        font-size: 16px;
    }
}

.bottom-cart-container.expanded {
    display: flex !important;
    flex-direction: column !important;
    max-height: 80vh !important;
}

.bottom-cart-items {
    flex: 1 !important;
    max-height: none !important;
    overflow-y: auto !important;
    padding: 16px !important;
    -webkit-overflow-scrolling: touch;
}

.bottom-cart-header {
    flex-shrink: 0 !important;
    background: rgba(20, 20, 25, 0.98) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 16px 20px 24px !important;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3) !important;
    z-index: 5 !important;
}

.cart-summary {
    flex-direction: column !important;
    gap: 16px !important;
    align-items: stretch !important;
}

.cart-summary-info {
    width: 100% !important;
    justify-content: center !important;
}

.cart-toggle-btn {
    width: 100% !important;
    height: 52px !important;
    margin: 0 !important;
    font-size: 16px !important;
    border-radius: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.bottom-cart-items::-webkit-scrollbar {
    width: 6px;
}

.bottom-cart-items::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.bottom-cart-items::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 10px;
}